@coveo/quantic 3.45.5 → 3.45.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,36 +14,36 @@ 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("CoveoHeadlessInsight",["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["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var oO=Object.create;var oc=Object.defineProperty;var aO=Object.getOwnPropertyDescriptor;var iO=Object.getOwnPropertyNames;var sO=Object.getPrototypeOf,cO=Object.prototype.hasOwnProperty;var uO=(e,t,r)=>t in e?oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $a=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Et=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ac=(e,t)=>{for(var r in t)oc(e,r,{get:t[r],enumerable:!0})},aA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of iO(t))!cO.call(e,o)&&o!==r&&oc(e,o,{get:()=>t[o],enumerable:!(n=aO(t,o))||n.enumerable});return e};var Pr=(e,t,r)=>(r=e!=null?oO(sO(e)):{},aA(t||!e||!e.__esModule?oc(r,"default",{value:e,enumerable:!0}):r,e)),lO=e=>aA(oc({},"__esModule",{value:!0}),e);var de=(e,t,r)=>uO(e,typeof t!="symbol"?t+"":t,r);var v,c=$a(()=>{"use strict";v=typeof globalThis<"u"?globalThis:window});function Uu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Uu=function(t){return typeof t}:Uu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}function fO(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=mO.bind(this))}function mO(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","*/*"),dO(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):pO(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var dO,pO,u=$a(()=>{"use strict";dO=function(t){return typeof t=="string"},pO=function(t){return t instanceof Blob};fO.call((typeof window>"u"?"undefined":Uu(window))==="object"?window:{})});var Jg=Et(ic=>{"use strict";d();c();l();u();Object.defineProperty(ic,"__esModule",{value:!0});function iA(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 gO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hO(e,t,r){return t=Ha(t),SO(e,lA()?Reflect.construct(t,r||[],Ha(e).constructor):t.apply(e,r))}function Kg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sA(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,CO(n.key),n)}}function Xg(e,t,r){return t&&sA(e.prototype,t),r&&sA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function cA(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=xO(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(m){throw m},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 a,i=!0,p=!1;return{s:function(){r=r.call(e)},n:function(){var m=r.next();return i=m.done,m},e:function(m){p=!0,a=m},f:function(){try{i||r.return==null||r.return()}finally{if(p)throw a}}}}function Wg(){return Wg=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=vO(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Wg.apply(null,arguments)}function Ha(e){return Ha=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ha(e)}function yO(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&&Yg(e,t)}function lA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lA=function(){return!!e})()}function SO(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 gO(e)}function Yg(e,t){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Yg(e,t)}function vO(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ha(e))!==null;);return e}function AO(e,t,r,n){var o=Wg(Ha(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function bO(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 CO(e){var t=bO(e,"string");return typeof t=="symbol"?t:t+""}function xO(e,t){if(e){if(typeof e=="string")return iA(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)?iA(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function RO(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 wO(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 uA=function(){function e(){Kg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Xg(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],a=0,i=o.length;a<i;a++)if(o[a].callback===n){o.splice(a,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],a=o.slice(),i=function(){var g=a[p];try{g.callback.call(n,r)}catch(S){Promise.resolve().then(function(){throw S})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,m=a.length;p<m;p++)i();return!r.defaultPrevented}}}])}(),Zg=function(e){function t(){var r;return Kg(this,t),r=hO(this,t),r.listeners||uA.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 yO(t,e),Xg(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)),AO(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,a=o===void 0?"Aborted":o;if(n)throw a}}],[{key:"timeout",value:function(n){var o=new Qu;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 Qu;function a(){o.abort(this.reason),i()}function i(){var g=cA(n),S;try{for(g.s();!(S=g.n()).done;){var C=S.value;C.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=cA(n),m;try{for(p.s();!(m=p.n()).done;){var f=m.value;if(f.aborted){o.abort(f.reason);break}else f.addEventListener("abort",a)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(uA),Qu=function(){function e(){Kg(this,e),Object.defineProperty(this,"signal",{value:new Zg,writable:!0,configurable:!0})}return Xg(e,[{key:"abort",value:function(r){var n=wO(r),o=RO(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Qu.prototype[Symbol.toStringTag]="AbortController",Zg.prototype[Symbol.toStringTag]="AbortSignal");function IO(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 EO(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,a=t.AbortController,i=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=i===void 0?!1:i;if(!IO({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:m};var m=o;(m&&!m.prototype.hasOwnProperty("signal")||p)&&(m=function(C,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var x=new o(C,h);return y&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),x},m.prototype=o.prototype);var f=r,g=function(C,h){var y=m&&m.prototype.isPrototypeOf(C)?C.signal:h?h.signal:void 0;if(y){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(y.aborted)return Promise.reject(x);var w=new Promise(function(E,T){y.addEventListener("abort",function(){return T(x)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,f(C,h)])}return f(C,h)};return{fetch:g,Request:m}}ic.AbortController=Qu;ic.AbortSignal=Zg;ic.abortableFetch=EO});var dA,s,A,l=$a(()=>{"use strict";dA=Pr(Jg(),1),s=Pr(Jg(),1),{fetch:A}=(0,dA.abortableFetch)({fetch})});function eh(e){return typeof e!="string"||e in{}}function th(){return Object.create(null)}function pA(e){return typeof e=="string"&&!!e.trim()}function rh(e,t){var r=e.split(";").filter(pA),n=r.shift();if(!n)return null;var o=FO(n),a=o.name,i=o.value;if(t=t?Object.assign({},Bu,t):Bu,eh(a))return null;try{i=t.decodeValues?decodeURIComponent(i):i}catch(m){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",m)}var p=th();return p.name=a,p.value=i,r.forEach(function(m){var f=m.split("="),g=f.shift().trim().toLowerCase();if(!eh(g)){var S=f.join("=").trim();if(g==="expires")p.expires=new Date(S);else if(g==="max-age"){var C=parseInt(S,10);Number.isNaN(C)||(p.maxAge=C)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=S:g==="partitioned"?p.partitioned=!0:g&&(p[g]=S)}}),p}function FO(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function za(e,t){if(t=t?Object.assign({},Bu,t):Bu,!e)return t.map?th():[];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(i){return i.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(pA),n&&(e=e.map(Gu).flat()),t.map){var a=th();return e.reduce(function(i,p){var m=rh(p,t);return m&&!eh(m.name)&&(i[m.name]=m),i},a)}else return e.map(function(i){return rh(i,t)}).filter(Boolean)}function Gu(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,p;function m(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function f(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;m();)if(o=e.charAt(r),o===","){for(a=r,r+=1,m(),i=r;r<e.length&&f();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Bu,fA=$a(()=>{"use strict";d();c();l();u();Bu={decodeValues:!0,map:!1,silent:!1,split:"auto"};za.parseSetCookie=za;za.parse=za;za.parseString=rh;za.splitCookiesString=Gu});function sc(e){if(TO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function nh(e){return e.replace(PO,"")}function cc(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||!kO(r))return!1}return!0}function kO(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function gA(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 TO,mA,PO,hA,Wa,oh,yA,b,vA=$a(()=>{"use strict";d();c();l();u();fA();TO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;mA=[`
19
- `,"\r","\t"," "],PO=new RegExp(`(^[${mA.join("")}]|$[${mA.join("")}])`,"g");Wa=Symbol("normalizedHeaders"),oh=Symbol("rawHeaderNames"),yA=", ",b=class SA{constructor(t){this[Wa]={},this[oh]=new Map,this[hA]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof SA||typeof v.Headers<"u"&&t instanceof v.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(yA):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(yA):n)})}[(hA=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[Wa]).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(!cc(t))throw new TypeError(`Invalid header name "${t}"`);return this[Wa].hasOwnProperty(sc(t))}get(t){if(!cc(t))throw TypeError(`Invalid header name "${t}"`);return this[Wa][sc(t)]??null}set(t,r){if(!cc(t)||!gA(r))return;let n=sc(t),o=nh(r);this[Wa][n]=nh(o),this[oh].set(n,t)}append(t,r){if(!cc(t)||!gA(r))return;let n=sc(t),o=nh(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!cc(t)||!this.has(t))return;let r=sc(t);delete this[Wa][r],this[oh].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===""?[""]:Gu(t)}}});var d=$a(()=>{"use strict";vA()});var wA=Et(dc=>{"use strict";d();c();l();u();var Xu=dc&&dc.__assign||function(){return Xu=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},Xu.apply(this,arguments)};Object.defineProperty(dc,"__esModule",{value:!0});var LO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function UO(e){var t=Xu(Xu({},LO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}dc.getSanitizedOptions=UO});var IA=Et(uh=>{"use strict";d();c();l();u();Object.defineProperty(uh,"__esModule",{value:!0});function QO(e){var t=Math.random()*e;return Math.round(t)}uh.fullJitter=QO});var EA=Et(lh=>{"use strict";d();c();l();u();Object.defineProperty(lh,"__esModule",{value:!0});function BO(e){return e}lh.noJitter=BO});var FA=Et(dh=>{"use strict";d();c();l();u();Object.defineProperty(dh,"__esModule",{value:!0});var GO=IA(),$O=EA();function HO(e){return e.jitter==="full"?GO.fullJitter:$O.noJitter}dh.JitterFactory=HO});var fh=Et(ph=>{"use strict";d();c();l();u();Object.defineProperty(ph,"__esModule",{value:!0});var zO=FA(),WO=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=zO.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}();ph.Delay=WO});var TA=Et(En=>{"use strict";d();c();l();u();var YO=En&&En.__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 a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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)}}(),KO=En&&En.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{f(n.next(g))}catch(S){i(S)}}function m(g){try{f(n.throw(g))}catch(S){i(S)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},XO=En&&En.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(En,"__esModule",{value:!0});var ZO=fh(),JO=function(e){YO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return KO(this,void 0,void 0,function(){return XO(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}(ZO.Delay);En.SkipFirstDelay=JO});var PA=Et(pc=>{"use strict";d();c();l();u();var e0=pc&&pc.__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 a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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(pc,"__esModule",{value:!0});var t0=fh(),r0=function(e){e0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(t0.Delay);pc.AlwaysDelay=r0});var kA=Et(mh=>{"use strict";d();c();l();u();Object.defineProperty(mh,"__esModule",{value:!0});var n0=TA(),o0=PA();function a0(e,t){var r=i0(e);return r.setAttemptNumber(t),r}mh.DelayFactory=a0;function i0(e){return e.delayFirstAttempt?new o0.AlwaysDelay(e):new n0.SkipFirstDelay(e)}});var OA=Et(jo=>{"use strict";d();c();l();u();var gh=jo&&jo.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{f(n.next(g))}catch(S){i(S)}}function m(g){try{f(n.throw(g))}catch(S){i(S)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},hh=jo&&jo.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(jo,"__esModule",{value:!0});var s0=wA(),c0=kA();function u0(e,t){return t===void 0&&(t={}),gh(this,void 0,void 0,function(){var r,n;return hh(this,function(o){switch(o.label){case 0:return r=s0.getSanitizedOptions(t),n=new l0(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}jo.backOff=u0;var l0=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return gh(this,void 0,void 0,function(){var t,r;return hh(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 gh(this,void 0,void 0,function(){var t;return hh(this,function(r){switch(r.label){case 0:return t=c0.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Ju=Et((yh,Sh)=>{"use strict";d();c();l();u();(function(e,t){typeof yh=="object"&&typeof Sh<"u"?Sh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs=t()})(yh,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",p="day",m="week",f="month",g="quarter",S="year",C="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+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(V){var L=["th","st","nd","rd"],Q=V%100;return"["+V+(L[(Q-20)%10]||L[Q]||L[0])+"]"}},E=function(V,L,Q){var W=String(V);return!W||W.length>=L?V:""+Array(L+1-W.length).join(Q)+V},T={s:E,z:function(V){var L=-V.utcOffset(),Q=Math.abs(L),W=Math.floor(Q/60),z=Q%60;return(L<=0?"+":"-")+E(W,2,"0")+":"+E(z,2,"0")},m:function V(L,Q){if(L.date()<Q.date())return-V(Q,L);var W=12*(Q.year()-L.year())+(Q.month()-L.month()),z=L.clone().add(W,f),ne=Q-z<0,Z=L.clone().add(W+(ne?-1:1),f);return+(-(W+(Q-z)/(ne?z-Z:Z-z))||0)},a:function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},p:function(V){return{M:f,y:S,w:m,d:p,D:C,h:i,m:a,s:o,ms:n,Q:g}[V]||String(V||"").toLowerCase().replace(/s$/,"")},u:function(V){return V===void 0}},F="en",O={};O[F]=w;var I="$isDayjsObject",k=function(V){return V instanceof B||!(!V||!V[I])},P=function V(L,Q,W){var z;if(!L)return F;if(typeof L=="string"){var ne=L.toLowerCase();O[ne]&&(z=ne),Q&&(O[ne]=Q,z=ne);var Z=L.split("-");if(!z&&Z.length>1)return V(Z[0])}else{var K=L.name;O[K]=L,z=K}return!W&&z&&(F=z),z||!W&&F},_=function(V,L){if(k(V))return V.clone();var Q=typeof L=="object"?L:{};return Q.date=V,Q.args=arguments,new B(Q)},j=T;j.l=P,j.i=k,j.w=function(V,L){return _(V,{locale:L.$L,utc:L.$u,x:L.$x,$offset:L.$offset})};var B=function(){function V(Q){this.$L=P(Q.locale,null,!0),this.parse(Q),this.$x=this.$x||Q.x||{},this[I]=!0}var L=V.prototype;return L.parse=function(Q){this.$d=function(W){var z=W.date,ne=W.utc;if(z===null)return new Date(NaN);if(j.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var Z=z.match(y);if(Z){var K=Z[2]-1||0,ce=(Z[7]||"0").substring(0,3);return ne?new Date(Date.UTC(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)):new Date(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)}}return new Date(z)}(Q),this.init()},L.init=function(){var Q=this.$d;this.$y=Q.getFullYear(),this.$M=Q.getMonth(),this.$D=Q.getDate(),this.$W=Q.getDay(),this.$H=Q.getHours(),this.$m=Q.getMinutes(),this.$s=Q.getSeconds(),this.$ms=Q.getMilliseconds()},L.$utils=function(){return j},L.isValid=function(){return this.$d.toString()!==h},L.isSame=function(Q,W){var z=_(Q);return this.startOf(W)<=z&&z<=this.endOf(W)},L.isAfter=function(Q,W){return _(Q)<this.startOf(W)},L.isBefore=function(Q,W){return this.endOf(W)<_(Q)},L.$g=function(Q,W,z){return j.u(Q)?this[W]:this.set(z,Q)},L.unix=function(){return Math.floor(this.valueOf()/1e3)},L.valueOf=function(){return this.$d.getTime()},L.startOf=function(Q,W){var z=this,ne=!!j.u(W)||W,Z=j.p(Q),K=function(Oe,Ee){var Me=j.w(z.$u?Date.UTC(z.$y,Ee,Oe):new Date(z.$y,Ee,Oe),z);return ne?Me:Me.endOf(p)},ce=function(Oe,Ee){return j.w(z.toDate()[Oe].apply(z.toDate("s"),(ne?[0,0,0,0]:[23,59,59,999]).slice(Ee)),z)},Ae=this.$W,Ge=this.$M,it=this.$D,Ye="set"+(this.$u?"UTC":"");switch(Z){case S:return ne?K(1,0):K(31,11);case f:return ne?K(1,Ge):K(0,Ge+1);case m:var rt=this.$locale().weekStart||0,nt=(Ae<rt?Ae+7:Ae)-rt;return K(ne?it-nt:it+(6-nt),Ge);case p:case C:return ce(Ye+"Hours",0);case i:return ce(Ye+"Minutes",1);case a:return ce(Ye+"Seconds",2);case o:return ce(Ye+"Milliseconds",3);default:return this.clone()}},L.endOf=function(Q){return this.startOf(Q,!1)},L.$set=function(Q,W){var z,ne=j.p(Q),Z="set"+(this.$u?"UTC":""),K=(z={},z[p]=Z+"Date",z[C]=Z+"Date",z[f]=Z+"Month",z[S]=Z+"FullYear",z[i]=Z+"Hours",z[a]=Z+"Minutes",z[o]=Z+"Seconds",z[n]=Z+"Milliseconds",z)[ne],ce=ne===p?this.$D+(W-this.$W):W;if(ne===f||ne===S){var Ae=this.clone().set(C,1);Ae.$d[K](ce),Ae.init(),this.$d=Ae.set(C,Math.min(this.$D,Ae.daysInMonth())).$d}else K&&this.$d[K](ce);return this.init(),this},L.set=function(Q,W){return this.clone().$set(Q,W)},L.get=function(Q){return this[j.p(Q)]()},L.add=function(Q,W){var z,ne=this;Q=Number(Q);var Z=j.p(W),K=function(Ge){var it=_(ne);return j.w(it.date(it.date()+Math.round(Ge*Q)),ne)};if(Z===f)return this.set(f,this.$M+Q);if(Z===S)return this.set(S,this.$y+Q);if(Z===p)return K(1);if(Z===m)return K(7);var ce=(z={},z[a]=t,z[i]=r,z[o]=e,z)[Z]||1,Ae=this.$d.getTime()+Q*ce;return j.w(Ae,this)},L.subtract=function(Q,W){return this.add(-1*Q,W)},L.format=function(Q){var W=this,z=this.$locale();if(!this.isValid())return z.invalidDate||h;var ne=Q||"YYYY-MM-DDTHH:mm:ssZ",Z=j.z(this),K=this.$H,ce=this.$m,Ae=this.$M,Ge=z.weekdays,it=z.months,Ye=z.meridiem,rt=function(Ee,Me,_e,ht){return Ee&&(Ee[Me]||Ee(W,ne))||_e[Me].slice(0,ht)},nt=function(Ee){return j.s(K%12||12,Ee,"0")},Oe=Ye||function(Ee,Me,_e){var ht=Ee<12?"AM":"PM";return _e?ht.toLowerCase():ht};return ne.replace(x,function(Ee,Me){return Me||function(_e){switch(_e){case"YY":return String(W.$y).slice(-2);case"YYYY":return j.s(W.$y,4,"0");case"M":return Ae+1;case"MM":return j.s(Ae+1,2,"0");case"MMM":return rt(z.monthsShort,Ae,it,3);case"MMMM":return rt(it,Ae);case"D":return W.$D;case"DD":return j.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return rt(z.weekdaysMin,W.$W,Ge,2);case"ddd":return rt(z.weekdaysShort,W.$W,Ge,3);case"dddd":return Ge[W.$W];case"H":return String(K);case"HH":return j.s(K,2,"0");case"h":return nt(1);case"hh":return nt(2);case"a":return Oe(K,ce,!0);case"A":return Oe(K,ce,!1);case"m":return String(ce);case"mm":return j.s(ce,2,"0");case"s":return String(W.$s);case"ss":return j.s(W.$s,2,"0");case"SSS":return j.s(W.$ms,3,"0");case"Z":return Z}return null}(Ee)||Z.replace(":","")})},L.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},L.diff=function(Q,W,z){var ne,Z=this,K=j.p(W),ce=_(Q),Ae=(ce.utcOffset()-this.utcOffset())*t,Ge=this-ce,it=function(){return j.m(Z,ce)};switch(K){case S:ne=it()/12;break;case f:ne=it();break;case g:ne=it()/3;break;case m:ne=(Ge-Ae)/6048e5;break;case p:ne=(Ge-Ae)/864e5;break;case i:ne=Ge/r;break;case a:ne=Ge/t;break;case o:ne=Ge/e;break;default:ne=Ge}return z?ne:j.a(ne)},L.daysInMonth=function(){return this.endOf(f).$D},L.$locale=function(){return O[this.$L]},L.locale=function(Q,W){if(!Q)return this.$L;var z=this.clone(),ne=P(Q,W,!0);return ne&&(z.$L=ne),z},L.clone=function(){return j.w(this.$d,this)},L.toDate=function(){return new Date(this.valueOf())},L.toJSON=function(){return this.isValid()?this.toISOString():null},L.toISOString=function(){return this.$d.toISOString()},L.toString=function(){return this.$d.toUTCString()},V}(),U=B.prototype;return _.prototype=U,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",f],["$y",S],["$D",C]].forEach(function(V){U[V[1]]=function(L){return this.$g(L,V[0],V[1])}}),_.extend=function(V,L){return V.$i||(V(L,B,_),V.$i=!0),_},_.locale=P,_.isDayjs=k,_.unix=function(V){return _(1e3*V)},_.en=O[F],_.Ls=O,_.p={},_})});var MA=Et((vh,Ah)=>{"use strict";d();c();l();u();(function(e,t){typeof vh=="object"&&typeof Ah<"u"?Ah.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_quarterOfYear=t()})(vh,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var a=o.add;o.add=function(p,m){return p=Number(p),this.$utils().p(m)===t?this.add(3*p,e):a.bind(this)(p,m)};var i=o.startOf;o.startOf=function(p,m){var f=this.$utils(),g=!!f.u(m)||m;if(f.p(p)===t){var S=this.quarter()-1;return g?this.month(3*S).startOf(e).startOf("day"):this.month(3*S+2).endOf(e).endOf("day")}return i.bind(this)(p,m)}}})});var VA=Et((bh,Ch)=>{"use strict";d();c();l();u();(function(e,t){typeof bh=="object"&&typeof Ch<"u"?Ch.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_customParseFormat=t()})(bh,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?/,a=/\d*[^-_:/,()\s\d]+/,i={},p=function(y){return(y=+y)+(y>68?1900:2e3)},m=function(y){return function(x){this[y]=+x}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var w=x.match(/([+-]|\d\d)/g),E=60*w[1]+(+w[2]||0);return E===0?0:w[0]==="+"?-E:E}(y)}],g=function(y){var x=i[y];return x&&(x.indexOf?x:x.s.concat(x.f))},S=function(y,x){var w,E=i.meridiem;if(E){for(var T=1;T<=24;T+=1)if(y.indexOf(E(T,0,x))>-1){w=T>12;break}}else w=y===(x?"pm":"PM");return w},C={A:[a,function(y){this.afternoon=S(y,!1)}],a:[a,function(y){this.afternoon=S(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,m("seconds")],ss:[o,m("seconds")],m:[o,m("minutes")],mm:[o,m("minutes")],H:[o,m("hours")],h:[o,m("hours")],HH:[o,m("hours")],hh:[o,m("hours")],D:[o,m("day")],DD:[n,m("day")],Do:[a,function(y){var x=i.ordinal,w=y.match(/\d+/);if(this.day=w[0],x)for(var E=1;E<=31;E+=1)x(E).replace(/\[|\]/g,"")===y&&(this.day=E)}],w:[o,m("week")],ww:[n,m("week")],M:[o,m("month")],MM:[n,m("month")],MMM:[a,function(y){var x=g("months"),w=(g("monthsShort")||x.map(function(E){return E.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(y){var x=g("months").indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,m("year")],YY:[n,function(y){this.year=p(y)}],YYYY:[/\d{4}/,m("year")],Z:f,ZZ:f};function h(y){var x,w;x=y,w=i&&i.formats;for(var E=(y=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(_,j,B){var U=B&&B.toUpperCase();return j||w[B]||e[B]||w[U].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(V,L,Q){return L||Q.slice(1)})})).match(t),T=E.length,F=0;F<T;F+=1){var O=E[F],I=C[O],k=I&&I[0],P=I&&I[1];E[F]=P?{regex:k,parser:P}:O.replace(/^\[|\]$/g,"")}return function(_){for(var j={},B=0,U=0;B<T;B+=1){var V=E[B];if(typeof V=="string")U+=V.length;else{var L=V.regex,Q=V.parser,W=_.slice(U),z=L.exec(W)[0];Q.call(j,z),_=_.replace(z,"")}}return function(ne){var Z=ne.afternoon;if(Z!==void 0){var K=ne.hours;Z?K<12&&(ne.hours+=12):K===12&&(ne.hours=0),delete ne.afternoon}}(j),j}}return function(y,x,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(p=y.parseTwoDigitYear);var E=x.prototype,T=E.parse;E.parse=function(F){var O=F.date,I=F.utc,k=F.args;this.$u=I;var P=k[1];if(typeof P=="string"){var _=k[2]===!0,j=k[3]===!0,B=_||j,U=k[2];j&&(U=k[2]),i=this.$locale(),!_&&U&&(i=w.Ls[U]),this.$d=function(W,z,ne,Z){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*W);var K=h(z)(W),ce=K.year,Ae=K.month,Ge=K.day,it=K.hours,Ye=K.minutes,rt=K.seconds,nt=K.milliseconds,Oe=K.zone,Ee=K.week,Me=new Date,_e=Ge||(ce||Ae?1:Me.getDate()),ht=ce||Me.getFullYear(),Ct=0;ce&&!Ae||(Ct=Ae>0?Ae-1:Me.getMonth());var Fr,sr=it||0,Ur=Ye||0,gr=rt||0,Tr=nt||0;return Oe?new Date(Date.UTC(ht,Ct,_e,sr,Ur,gr,Tr+60*Oe.offset*1e3)):ne?new Date(Date.UTC(ht,Ct,_e,sr,Ur,gr,Tr)):(Fr=new Date(ht,Ct,_e,sr,Ur,gr,Tr),Ee&&(Fr=Z(Fr).week(Ee).toDate()),Fr)}catch{return new Date("")}}(O,P,I,w),this.init(),U&&U!==!0&&(this.$L=this.locale(U).$L),B&&O!=this.format(P)&&(this.$d=new Date("")),i={}}else if(P instanceof Array)for(var V=P.length,L=1;L<=V;L+=1){k[1]=P[L-1];var Q=w.apply(this,k);if(Q.isValid()){this.$d=Q.$d,this.$L=Q.$L,this.init();break}L===V&&(this.$d=new Date(""))}else T.call(this,F)}}})});var gw=Et((OS,_S)=>{"use strict";d();c();l();u();(function(e,t){typeof OS=="object"&&typeof _S<"u"?_S.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_timezone=t()})(OS,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var a,i=function(g,S,C){C===void 0&&(C={});var h=new Date(g),y=function(x,w){w===void 0&&(w={});var E=w.timeZoneName||"short",T=x+"|"+E,F=t[T];return F||(F=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),t[T]=F),F}(S,C);return y.formatToParts(h)},p=function(g,S){for(var C=i(g,S),h=[],y=0;y<C.length;y+=1){var x=C[y],w=x.type,E=x.value,T=e[w];T>=0&&(h[T]=parseInt(E,10))}var F=h[3],O=F===24?0:F,I=h[0]+"-"+h[1]+"-"+h[2]+" "+O+":"+h[4]+":"+h[5]+":000",k=+g;return(o.utc(I).valueOf()-(k-=k%1e3))/6e4},m=n.prototype;m.tz=function(g,S){if(g===void 0&&(g=a),!this.isValid())return this;var C,h=this.utcOffset(),y=this.toDate(),x=y.toLocaleString("en-US",{timeZone:g}),w=p(+y,g);if(!Number(w))C=this.utcOffset(0,S);else if(C=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),S){var E=C.utcOffset();C=C.add(h-E,"minute")}return C.$x.$timezone=g,C},m.offsetName=function(g){var S=this.$x.$timezone||o.tz.guess(),C=i(this.valueOf(),S,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return C&&C.value};var f=m.startOf;m.startOf=function(g,S){if(!this.$x||!this.$x.$timezone)return f.call(this,g,S);var C=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return f.call(C,g,S).tz(this.$x.$timezone,!0)},o.tz=function(g,S,C){var h=C&&S,y=C||S||a,x=p(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=o.utc(g,h).valueOf();if(Number.isNaN(w)){var E=o(NaN);return E.$x.$timezone=y,E}var T=function(k,P,_){var j=k-60*P*1e3,B=p(j,_);if(P===B)return[j,P];var U=p(j-=60*(B-P)*1e3,_);return B===U?[j,B]:[k-60*Math.min(B,U)*1e3,Math.max(B,U)]}(w,x,y),F=T[0],O=T[1],I=o(F).utcOffset(O);return I.$x.$timezone=y,I},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var hw=Et((NS,DS)=>{"use strict";d();c();l();u();(function(e,t){typeof NS=="object"&&typeof DS<"u"?DS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_utc=t()})(NS,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},i.utc=function(h){var y=a(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var p=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var m=i.init;i.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 m.call(this)};var f=i.utcOffset;i.utcOffset=function(h,y){var x=this.$utils().u;if(x(h))return this.$u?0:x(this.$offset)?f.call(this):this.$offset;if(typeof h=="string"&&(h=function(F){F===void 0&&(F="");var O=F.match(t);if(!O)return null;var I=(""+O[0]).match(r)||["-",0,0],k=I[0],P=60*+I[1]+ +I[2];return P===0?0:k==="+"?P:-P}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var E=this.clone();if(y)return E.$offset=w,E.$u=!1,E;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(E=this.local().add(w+T,e)).$offset=w,E.$x.$localOffset=T,E};var g=i.format;i.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var S=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():S.call(this)};var C=i.diff;i.diff=function(h,y,x){if(h&&this.$u===h.$u)return C.call(this,h,y,x);var w=this.local(),E=a(h).local();return C.call(w,E,y,x)}}})});var WE=Et((Wwe,zE)=>{"use strict";d();c();l();u();function KQ(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}zE.exports=XQ;function XQ(e,t,r){var n=r&&r.stringify||KQ,o=1;if(typeof e=="object"&&e!==null){var a=t.length+o;if(a===1)return e;var i=new Array(a);i[0]=n(e);for(var p=1;p<a;p++)i[p]=n(t[p]);return i.join(" ")}if(typeof e!="string")return e;var m=t.length;if(m===0)return e;for(var f="",g=1-o,S=-1,C=e&&e.length||0,h=0;h<C;){if(e.charCodeAt(h)===37&&h+1<C){switch(S=S>-1?S:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=m||t[g]==null)break;S<h&&(f+=e.slice(S,h)),f+=Number(t[g]),S=h+2,h++;break;case 105:if(g>=m||t[g]==null)break;S<h&&(f+=e.slice(S,h)),f+=Math.floor(Number(t[g])),S=h+2,h++;break;case 79:case 111:case 106:if(g>=m||t[g]===void 0)break;S<h&&(f+=e.slice(S,h));var y=typeof t[g];if(y==="string"){f+="'"+t[g]+"'",S=h+2,h++;break}if(y==="function"){f+=t[g].name||"<anonymous>",S=h+2,h++;break}f+=n(t[g]),S=h+2,h++;break;case 115:if(g>=m)break;S<h&&(f+=e.slice(S,h)),f+=String(t[g]),S=h+2,h++;break;case 37:S<h&&(f+=e.slice(S,h)),f+="%",S=h+2,h++,g--;break}++g}++h}return S===-1?e:(S<C&&(f+=e.slice(S)),f)}});var tF=Et((Jwe,Jf)=>{"use strict";d();c();l();u();var YE=WE();Jf.exports=Un;var vu=pB().console||{},ZQ={mapHttpRequest:Zf,mapHttpResponse:Zf,wrapRequestSerializer:Iv,wrapResponseSerializer:Iv,wrapErrorSerializer:Iv,req:Zf,res:Zf,err:XE,errWithCause:XE};function bo(e,t){return e==="silent"?1/0:t.levels.values[e]}var Tv=Symbol("pino.logFuncs"),Ev=Symbol("pino.hierarchy"),JQ={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function KE(e,t){let r={logger:t,parent:e[Ev]};t[Ev]=r}function eB(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:vu[o]||vu[JQ[o]||"log"]||hs}),e[Tv]=n}function tB(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Un(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||vu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=tB(e.browser.serialize,n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);let i=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&p.forEach(function(x){r[x]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let m=e.level||"info",f=Object.create(r);f.log||(f.log=hs),eB(f,p,r),KE({},f),Object.defineProperty(f,"levelVal",{get:S}),Object.defineProperty(f,"level",{get:C,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:p,timestamp:uB(e),messageKey:e.messageKey||"msg",onChild:e.onChild||hs};f.levels=rB(e),f.level=m,f.isLevelEnabled=function(x){return this.levels.values[x]?this.levels.values[x]>=this.levels.values[this.level]:!1},f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=hs,f.serializers=n,f._serialize=o,f._stdErrSerialize=a,f.child=function(...x){return y.call(this,g,...x)},t&&(f._logEvent=Fv());function S(){return bo(this.level,this)}function C(){return this._level}function h(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,Ma(this,g,f,"error"),Ma(this,g,f,"fatal"),Ma(this,g,f,"warn"),Ma(this,g,f,"info"),Ma(this,g,f,"debug"),Ma(this,g,f,"trace"),i.forEach(w=>{Ma(this,g,f,w)})}function y(x,w,E){if(!w)throw new Error("missing bindings for child Pino");E=E||{},o&&w.serializers&&(E.serializers=w.serializers);let T=E.serializers;if(o&&T){var F=Object.assign({},n,T),O=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,Pv([w],O,F,this._stdErrSerialize)}function I(P){this._childLevel=(P._childLevel|0)+1,this.bindings=w,F&&(this.serializers=F,this._serialize=O),t&&(this._logEvent=Fv([].concat(P._logEvent.bindings,w)))}I.prototype=this;let k=new I(this);return KE(this,k),k.child=function(...P){return y.call(this,x,...P)},k.level=E.level||this.level,x.onChild(k),k}return f}function rB(e){let t=e.customLevels||{},r=Object.assign({},Un.levels.values,t),n=Object.assign({},Un.levels.labels,nB(t));return{values:r,labels:n}}function nB(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Un.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"}};Un.stdSerializers=ZQ;Un.stdTimeFunctions=Object.assign({},{nullTime:JE,epochTime:eF,unixTime:lB,isoTime:dB});function oB(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Ev];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Ma(e,t,r,n){if(Object.defineProperty(e,n,{value:bo(e.level,r)>bo(n,r)?hs:r[Tv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===hs){if(!t.transmit)return;let a=t.transmit.level||e.level,i=bo(a,r);if(bo(n,r)<i)return}e[n]=iB(e,t,r,n);let o=oB(e);o.length!==0&&(e[n]=aB(o,e[n]))}function aB(e,t){return function(){return t.apply(this,[...e,...arguments])}}function iB(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),m=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vu?vu:this;for(var f=0;f<p.length;f++)p[f]=arguments[f];var g=!1;if(t.serialize&&(Pv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let S=sB(this,n,p,i,t);if(t.reportCaller&&S&&S.length>0&&S[0]&&typeof S[0]=="object")try{let C=ZE();C&&(S[0].caller=C)}catch{}o.call(m,...S)}else{if(t.reportCaller)try{let S=ZE();S&&p.push(S)}catch{}o.apply(m,p)}if(t.transmit){let S=t.transmit.level||e._level,C=bo(S,r),h=bo(n,r);if(h<C)return;cB(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:S,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:bo(e._level,r)},p,g)}}}(e[Tv][n])}function sB(e,t,r,n,o){let{level:a,log:i=S=>S}=o.formatters||{},p=r.slice(),m=p[0],f={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(f.time=n),a){let S=a(t,e.levels.values[t]);Object.assign(f,S)}else f.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(m!==null&&typeof m=="object")for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());return[i(f),...p]}else{if(m!==null&&typeof m=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());m=p.length?YE(p.shift(),p):void 0}else typeof m=="string"&&(m=YE(p.shift(),p));return m!==void 0&&(f[o.messageKey]=m),[i(f)]}}function Pv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Un.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let a in e[o])t.indexOf(a)>-1&&a in r&&(e[o][a]=r[a](e[o][a]))}function cB(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,p=t.methodValue,m=t.val,f=e._logEvent.bindings;n||Pv(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=r.filter(function(g){return f.indexOf(g)===-1}),e._logEvent.level.label=i,e._logEvent.level.value=p,o(i,e._logEvent,m),e._logEvent=Fv(f)}function Fv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function XE(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 uB(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?JE:eF}function Zf(){return{}}function Iv(e){return e}function hs(){}function JE(){return!1}function eF(){return Date.now()}function lB(){return Math.round(Date.now()/1e3)}function dB(){return new Date(Date.now()).toISOString()}function pB(){function e(t){return typeof t<"u"&&t}try{return typeof v<"u"?v:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),v)}catch{return e(self)||e(window)||e(this)||{}}}Jf.exports.default=Un;Jf.exports.pino=Un;function ZE(){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 a=o[1],i=o[2],p=o[3];return a+":"+i+":"+p}}return null}});var p$={};ac(p$,{HighlightUtils:()=>ch,ResultTemplatesHelpers:()=>mR,SortOrder:()=>Xl,VERSION:()=>Kn,buildAttachToCase:()=>pF,buildAttachedResults:()=>fF,buildBreadcrumbManager:()=>QF,buildCategoryFacet:()=>fT,buildController:()=>Se,buildCriterionExpression:()=>Wr,buildDateFacet:()=>_T,buildDateFilter:()=>DT,buildDateRange:()=>ks,buildDateSortCriterion:()=>sx,buildDidYouMean:()=>KF,buildFacet:()=>ET,buildFacetConditionsManager:()=>eT,buildFacetManager:()=>rT,buildFoldedResultList:()=>XT,buildGeneratedAnswer:()=>tP,buildInsightEngine:()=>cF,buildInsightInterface:()=>$k,buildInteractiveCitation:()=>nP,buildInteractiveResult:()=>RP,buildNotifyTrigger:()=>qk,buildNumericFacet:()=>jT,buildNumericFilter:()=>UT,buildNumericRange:()=>ig,buildPager:()=>cP,buildQueryError:()=>lP,buildQuerySummary:()=>pP,buildQuickview:()=>hP,buildRecentQueriesList:()=>CP,buildRelevanceSortCriterion:()=>Jl,buildResultList:()=>wP,buildResultTemplatesManager:()=>tO,buildResultsPerPage:()=>EP,buildSearchBox:()=>LP,buildSearchParameterManager:()=>lk,buildSearchStatus:()=>wk,buildSmartSnippet:()=>hk,buildSmartSnippetQuestionsList:()=>vk,buildSort:()=>Rk,buildTab:()=>Ek,buildUserActions:()=>Gk,deserializeRelativeDate:()=>YA,getAnalyticsNextApiBaseUrl:()=>Zu,getOrganizationEndpoint:()=>gt,getSampleInsightEngineConfiguration:()=>kv,loadAttachedResultsActions:()=>H2,loadAttachedResultsAnalyticsActions:()=>z2,loadCaseContextActions:()=>W2,loadContextActions:()=>K2,loadDateFacetSetActions:()=>X2,loadFieldActions:()=>J2,loadFoldingActions:()=>e$,loadGeneratedAnswerActions:()=>t$,loadGenericAnalyticsActions:()=>G2,loadInsightAnalyticsActions:()=>$2,loadInsightInterfaceActions:()=>r$,loadInsightSearchActions:()=>o$,loadInsightSearchAnalyticsActions:()=>a$,loadInsightUserActionsActions:()=>i$,loadNumericFacetSetActions:()=>Z2,loadQuerySetActions:()=>n$,loadQuerySuggestActions:()=>s$,loadQuestionAnsweringActions:()=>c$,loadRecentResultsActions:()=>u$});module.exports=lO(p$);d();c();l();u();var ch={};ac(ch,{escapeHtml:()=>Ja,getHighlightedSuggestion:()=>sh,highlightString:()=>jO});d();c();l();u();d();c();l();u();function OO(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessInsight",["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["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var iO=Object.create;var nc=Object.defineProperty;var aO=Object.getOwnPropertyDescriptor;var sO=Object.getOwnPropertyNames;var cO=Object.getPrototypeOf,uO=Object.prototype.hasOwnProperty;var lO=(e,t,r)=>t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $i=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Et=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},oc=(e,t)=>{for(var r in t)nc(e,r,{get:t[r],enumerable:!0})},sA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of sO(t))!uO.call(e,o)&&o!==r&&nc(e,o,{get:()=>t[o],enumerable:!(n=aO(t,o))||n.enumerable});return e};var Pr=(e,t,r)=>(r=e!=null?iO(cO(e)):{},sA(t||!e||!e.__esModule?nc(r,"default",{value:e,enumerable:!0}):r,e)),dO=e=>sA(nc({},"__esModule",{value:!0}),e);var le=(e,t,r)=>lO(e,typeof t!="symbol"?t+"":t,r);var v,c=$i(()=>{"use strict";v=typeof globalThis<"u"?globalThis:window});function Mu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mu=function(t){return typeof t}:Mu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}function mO(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=gO.bind(this))}function gO(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","*/*"),pO(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):fO(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var pO,fO,u=$i(()=>{"use strict";pO=function(t){return typeof t=="string"},fO=function(t){return t instanceof Blob};mO.call((typeof window>"u"?"undefined":Mu(window))==="object"?window:{})});var Xg=Et(ic=>{"use strict";d();c();l();u();Object.defineProperty(ic,"__esModule",{value:!0});function cA(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 hO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yO(e,t,r){return t=Hi(t),vO(e,pA()?Reflect.construct(t,r||[],Hi(e).constructor):t.apply(e,r))}function Wg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uA(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,xO(n.key),n)}}function Yg(e,t,r){return t&&uA(e.prototype,t),r&&uA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function lA(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=RO(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(m){throw m},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,p=!1;return{s:function(){r=r.call(e)},n:function(){var m=r.next();return a=m.done,m},e:function(m){p=!0,i=m},f:function(){try{a||r.return==null||r.return()}finally{if(p)throw i}}}}function Hg(){return Hg=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=AO(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Hg.apply(null,arguments)}function Hi(e){return Hi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hi(e)}function SO(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&&zg(e,t)}function pA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pA=function(){return!!e})()}function vO(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 hO(e)}function zg(e,t){return zg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},zg(e,t)}function AO(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Hi(e))!==null;);return e}function CO(e,t,r,n){var o=Hg(Hi(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function bO(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 xO(e){var t=bO(e,"string");return typeof t=="symbol"?t:t+""}function RO(e,t){if(e){if(typeof e=="string")return cA(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)?cA(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function wO(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 IO(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 dA=function(){function e(){Wg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Yg(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[p];try{g.callback.call(n,r)}catch(S){Promise.resolve().then(function(){throw S})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,m=i.length;p<m;p++)a();return!r.defaultPrevented}}}])}(),Kg=function(e){function t(){var r;return Wg(this,t),r=yO(this,t),r.listeners||dA.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 SO(t,e),Yg(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)),CO(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 Vu;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 Vu;function i(){o.abort(this.reason),a()}function a(){var g=lA(n),S;try{for(g.s();!(S=g.n()).done;){var b=S.value;b.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var p=lA(n),m;try{for(p.s();!(m=p.n()).done;){var f=m.value;if(f.aborted){o.abort(f.reason);break}else f.addEventListener("abort",i)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(dA),Vu=function(){function e(){Wg(this,e),Object.defineProperty(this,"signal",{value:new Kg,writable:!0,configurable:!0})}return Yg(e,[{key:"abort",value:function(r){var n=IO(r),o=wO(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Vu.prototype[Symbol.toStringTag]="AbortController",Kg.prototype[Symbol.toStringTag]="AbortSignal");function EO(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 FO(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,p=a===void 0?!1:a;if(!EO({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:m};var m=o;(m&&!m.prototype.hasOwnProperty("signal")||p)&&(m=function(b,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var x=new o(b,h);return y&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),x},m.prototype=o.prototype);var f=r,g=function(b,h){var y=m&&m.prototype.isPrototypeOf(b)?b.signal:h?h.signal:void 0;if(y){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(y.aborted)return Promise.reject(x);var w=new Promise(function(E,k){y.addEventListener("abort",function(){return k(x)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,f(b,h)])}return f(b,h)};return{fetch:g,Request:m}}ic.AbortController=Vu;ic.AbortSignal=Kg;ic.abortableFetch=FO});var fA,s,A,l=$i(()=>{"use strict";fA=Pr(Xg(),1),s=Pr(Xg(),1),{fetch:A}=(0,fA.abortableFetch)({fetch})});function Zg(e){return typeof e!="string"||e in{}}function Jg(){return Object.create(null)}function hA(e){return typeof e=="string"&&!!e.trim()}function eh(e,t){var r=e.split(";").filter(hA),n=r.shift();if(!n)return null;var o=TO(n),i=o.name,a=o.value;if(t=t?Object.assign({},ju,t):ju,Zg(i))return null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(m){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",m)}var p=Jg();return p.name=i,p.value=a,r.forEach(function(m){var f=m.split("="),g=f.shift().trim().toLowerCase();if(!Zg(g)){var S=f.join("=").trim();if(g==="expires"){var b=new Date(S);Number.isNaN(b.getTime())||(p.expires=b)}else g==="max-age"?/^-?\d+$/.test(S)&&(p.maxAge=parseInt(S,10)):g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=S:g==="partitioned"?p.partitioned=!0:g&&(p[g]=S)}}),p}function TO(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:mA(t),value:mA(r)}}function mA(e){for(var t=0,r=e.length;t<r&&gA(e.charCodeAt(t));)t+=1;for(;r>t&&gA(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function gA(e){return e===32||e===9}function zi(e,t){if(t=t?Object.assign({},ju,t):ju,!e)return t.map?Jg():[];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(hA),n&&(e=e.map(Lu).flat()),t.map){var i=Jg();return e.reduce(function(a,p){var m=eh(p,t);return m&&!Zg(m.name)&&(a[m.name]=m),a},i)}else return e.map(function(a){return eh(a,t)}).filter(Boolean)}function Lu(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,p;function m(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function f(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;m();)if(o=e.charAt(r),o===","){for(i=r,r+=1,m(),a=r;r<e.length&&f();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var ju,yA=$i(()=>{"use strict";d();c();l();u();ju={decodeValues:!0,map:!1,silent:!1,split:"auto"};zi.parseSetCookie=zi;zi.parse=zi;zi.parseString=eh;zi.splitCookiesString=Lu});function ac(e){if(PO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function th(e){return e.replace(kO,"")}function sc(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||!OO(r))return!1}return!0}function OO(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function vA(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 PO,SA,kO,AA,Wi,rh,CA,C,xA=$i(()=>{"use strict";d();c();l();u();yA();PO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;SA=[`
19
+ `,"\r","\t"," "],kO=new RegExp(`(^[${SA.join("")}]|$[${SA.join("")}])`,"g");Wi=Symbol("normalizedHeaders"),rh=Symbol("rawHeaderNames"),CA=", ",C=class bA{constructor(t){this[Wi]={},this[rh]=new Map,this[AA]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof bA||typeof v.Headers<"u"&&t instanceof v.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(CA):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(CA):n)})}[(AA=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[Wi]).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(!sc(t))throw new TypeError(`Invalid header name "${t}"`);return this[Wi].hasOwnProperty(ac(t))}get(t){if(!sc(t))throw TypeError(`Invalid header name "${t}"`);return this[Wi][ac(t)]??null}set(t,r){if(!sc(t)||!vA(r))return;let n=ac(t),o=th(r);this[Wi][n]=th(o),this[rh].set(n,t)}append(t,r){if(!sc(t)||!vA(r))return;let n=ac(t),o=th(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!sc(t)||!this.has(t))return;let r=ac(t);delete this[Wi][r],this[rh].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===""?[""]:Lu(t)}}});var d=$i(()=>{"use strict";xA()});var TA=Et(lc=>{"use strict";d();c();l();u();var zu=lc&&lc.__assign||function(){return zu=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},zu.apply(this,arguments)};Object.defineProperty(lc,"__esModule",{value:!0});var UO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function QO(e){var t=zu(zu({},UO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}lc.getSanitizedOptions=QO});var PA=Et(sh=>{"use strict";d();c();l();u();Object.defineProperty(sh,"__esModule",{value:!0});function BO(e){var t=Math.random()*e;return Math.round(t)}sh.fullJitter=BO});var kA=Et(ch=>{"use strict";d();c();l();u();Object.defineProperty(ch,"__esModule",{value:!0});function GO(e){return e}ch.noJitter=GO});var OA=Et(uh=>{"use strict";d();c();l();u();Object.defineProperty(uh,"__esModule",{value:!0});var $O=PA(),HO=kA();function zO(e){return e.jitter==="full"?$O.fullJitter:HO.noJitter}uh.JitterFactory=zO});var dh=Et(lh=>{"use strict";d();c();l();u();Object.defineProperty(lh,"__esModule",{value:!0});var WO=OA(),YO=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=WO.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}();lh.Delay=YO});var _A=Et(En=>{"use strict";d();c();l();u();var KO=En&&En.__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)}}(),XO=En&&En.__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 p(g){try{f(n.next(g))}catch(S){a(S)}}function m(g){try{f(n.throw(g))}catch(S){a(S)}}function f(g){g.done?i(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},ZO=En&&En.__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:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=f[0]&2?o.return:f[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,f[1])).done)return i;switch(o=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(En,"__esModule",{value:!0});var JO=dh(),e0=function(e){KO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return XO(this,void 0,void 0,function(){return ZO(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}(JO.Delay);En.SkipFirstDelay=e0});var NA=Et(dc=>{"use strict";d();c();l();u();var t0=dc&&dc.__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(dc,"__esModule",{value:!0});var r0=dh(),n0=function(e){t0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(r0.Delay);dc.AlwaysDelay=n0});var DA=Et(ph=>{"use strict";d();c();l();u();Object.defineProperty(ph,"__esModule",{value:!0});var o0=_A(),i0=NA();function a0(e,t){var r=s0(e);return r.setAttemptNumber(t),r}ph.DelayFactory=a0;function s0(e){return e.delayFirstAttempt?new i0.AlwaysDelay(e):new o0.SkipFirstDelay(e)}});var qA=Et(Vo=>{"use strict";d();c();l();u();var fh=Vo&&Vo.__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 p(g){try{f(n.next(g))}catch(S){a(S)}}function m(g){try{f(n.throw(g))}catch(S){a(S)}}function f(g){g.done?i(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},mh=Vo&&Vo.__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:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=f[0]&2?o.return:f[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,f[1])).done)return i;switch(o=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(Vo,"__esModule",{value:!0});var c0=TA(),u0=DA();function l0(e,t){return t===void 0&&(t={}),fh(this,void 0,void 0,function(){var r,n;return mh(this,function(o){switch(o.label){case 0:return r=c0.getSanitizedOptions(t),n=new d0(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Vo.backOff=l0;var d0=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return fh(this,void 0,void 0,function(){var t,r;return mh(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 fh(this,void 0,void 0,function(){var t;return mh(this,function(r){switch(r.label){case 0:return t=u0.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Yu=Et((gh,hh)=>{"use strict";d();c();l();u();(function(e,t){typeof gh=="object"&&typeof hh<"u"?hh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs=t()})(gh,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",p="day",m="week",f="month",g="quarter",S="year",b="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+)?$/,x=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var $=["th","st","nd","rd"],Q=L%100;return"["+L+($[(Q-20)%10]||$[Q]||$[0])+"]"}},E=function(L,$,Q){var K=String(L);return!K||K.length>=$?L:""+Array($+1-K.length).join(Q)+L},k={s:E,z:function(L){var $=-L.utcOffset(),Q=Math.abs($),K=Math.floor(Q/60),z=Q%60;return($<=0?"+":"-")+E(K,2,"0")+":"+E(z,2,"0")},m:function L($,Q){if($.date()<Q.date())return-L(Q,$);var K=12*(Q.year()-$.year())+(Q.month()-$.month()),z=$.clone().add(K,f),Z=Q-z<0,Y=$.clone().add(K+(Z?-1:1),f);return+(-(K+(Q-z)/(Z?z-Y:Y-z))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:f,y:S,w:m,d:p,D:b,h:a,m:i,s:o,ms:n,Q:g}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},F="en",_={};_[F]=w;var I="$isDayjsObject",O=function(L){return L instanceof G||!(!L||!L[I])},P=function L($,Q,K){var z;if(!$)return F;if(typeof $=="string"){var Z=$.toLowerCase();_[Z]&&(z=Z),Q&&(_[Z]=Q,z=Z);var Y=$.split("-");if(!z&&Y.length>1)return L(Y[0])}else{var J=$.name;_[J]=$,z=J}return!K&&z&&(F=z),z||!K&&F},T=function(L,$){if(O(L))return L.clone();var Q=typeof $=="object"?$:{};return Q.date=L,Q.args=arguments,new G(Q)},V=k;V.l=P,V.i=O,V.w=function(L,$){return T(L,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var G=function(){function L(Q){this.$L=P(Q.locale,null,!0),this.parse(Q),this.$x=this.$x||Q.x||{},this[I]=!0}var $=L.prototype;return $.parse=function(Q){this.$d=function(K){var z=K.date,Z=K.utc;if(z===null)return new Date(NaN);if(V.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var Y=z.match(y);if(Y){var J=Y[2]-1||0,Se=(Y[7]||"0").substring(0,3);return Z?new Date(Date.UTC(Y[1],J,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,Se)):new Date(Y[1],J,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,Se)}}return new Date(z)}(Q),this.init()},$.init=function(){var Q=this.$d;this.$y=Q.getFullYear(),this.$M=Q.getMonth(),this.$D=Q.getDate(),this.$W=Q.getDay(),this.$H=Q.getHours(),this.$m=Q.getMinutes(),this.$s=Q.getSeconds(),this.$ms=Q.getMilliseconds()},$.$utils=function(){return V},$.isValid=function(){return this.$d.toString()!==h},$.isSame=function(Q,K){var z=T(Q);return this.startOf(K)<=z&&z<=this.endOf(K)},$.isAfter=function(Q,K){return T(Q)<this.startOf(K)},$.isBefore=function(Q,K){return this.endOf(K)<T(Q)},$.$g=function(Q,K,z){return V.u(Q)?this[K]:this.set(z,Q)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(Q,K){var z=this,Z=!!V.u(K)||K,Y=V.p(Q),J=function(Oe,Ie){var Me=V.w(z.$u?Date.UTC(z.$y,Ie,Oe):new Date(z.$y,Ie,Oe),z);return Z?Me:Me.endOf(p)},Se=function(Oe,Ie){return V.w(z.toDate()[Oe].apply(z.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(Ie)),z)},ke=this.$W,$e=this.$M,ct=this.$D,Ye="set"+(this.$u?"UTC":"");switch(Y){case S:return Z?J(1,0):J(31,11);case f:return Z?J(1,$e):J(0,$e+1);case m:var rt=this.$locale().weekStart||0,nt=(ke<rt?ke+7:ke)-rt;return J(Z?ct-nt:ct+(6-nt),$e);case p:case b:return Se(Ye+"Hours",0);case a:return Se(Ye+"Minutes",1);case i:return Se(Ye+"Seconds",2);case o:return Se(Ye+"Milliseconds",3);default:return this.clone()}},$.endOf=function(Q){return this.startOf(Q,!1)},$.$set=function(Q,K){var z,Z=V.p(Q),Y="set"+(this.$u?"UTC":""),J=(z={},z[p]=Y+"Date",z[b]=Y+"Date",z[f]=Y+"Month",z[S]=Y+"FullYear",z[a]=Y+"Hours",z[i]=Y+"Minutes",z[o]=Y+"Seconds",z[n]=Y+"Milliseconds",z)[Z],Se=Z===p?this.$D+(K-this.$W):K;if(Z===f||Z===S){var ke=this.clone().set(b,1);ke.$d[J](Se),ke.init(),this.$d=ke.set(b,Math.min(this.$D,ke.daysInMonth())).$d}else J&&this.$d[J](Se);return this.init(),this},$.set=function(Q,K){return this.clone().$set(Q,K)},$.get=function(Q){return this[V.p(Q)]()},$.add=function(Q,K){var z,Z=this;Q=Number(Q);var Y=V.p(K),J=function($e){var ct=T(Z);return V.w(ct.date(ct.date()+Math.round($e*Q)),Z)};if(Y===f)return this.set(f,this.$M+Q);if(Y===S)return this.set(S,this.$y+Q);if(Y===p)return J(1);if(Y===m)return J(7);var Se=(z={},z[i]=t,z[a]=r,z[o]=e,z)[Y]||1,ke=this.$d.getTime()+Q*Se;return V.w(ke,this)},$.subtract=function(Q,K){return this.add(-1*Q,K)},$.format=function(Q){var K=this,z=this.$locale();if(!this.isValid())return z.invalidDate||h;var Z=Q||"YYYY-MM-DDTHH:mm:ssZ",Y=V.z(this),J=this.$H,Se=this.$m,ke=this.$M,$e=z.weekdays,ct=z.months,Ye=z.meridiem,rt=function(Ie,Me,_e,ht){return Ie&&(Ie[Me]||Ie(K,Z))||_e[Me].slice(0,ht)},nt=function(Ie){return V.s(J%12||12,Ie,"0")},Oe=Ye||function(Ie,Me,_e){var ht=Ie<12?"AM":"PM";return _e?ht.toLowerCase():ht};return Z.replace(x,function(Ie,Me){return Me||function(_e){switch(_e){case"YY":return String(K.$y).slice(-2);case"YYYY":return V.s(K.$y,4,"0");case"M":return ke+1;case"MM":return V.s(ke+1,2,"0");case"MMM":return rt(z.monthsShort,ke,ct,3);case"MMMM":return rt(ct,ke);case"D":return K.$D;case"DD":return V.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return rt(z.weekdaysMin,K.$W,$e,2);case"ddd":return rt(z.weekdaysShort,K.$W,$e,3);case"dddd":return $e[K.$W];case"H":return String(J);case"HH":return V.s(J,2,"0");case"h":return nt(1);case"hh":return nt(2);case"a":return Oe(J,Se,!0);case"A":return Oe(J,Se,!1);case"m":return String(Se);case"mm":return V.s(Se,2,"0");case"s":return String(K.$s);case"ss":return V.s(K.$s,2,"0");case"SSS":return V.s(K.$ms,3,"0");case"Z":return Y}return null}(Ie)||Y.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(Q,K,z){var Z,Y=this,J=V.p(K),Se=T(Q),ke=(Se.utcOffset()-this.utcOffset())*t,$e=this-Se,ct=function(){return V.m(Y,Se)};switch(J){case S:Z=ct()/12;break;case f:Z=ct();break;case g:Z=ct()/3;break;case m:Z=($e-ke)/6048e5;break;case p:Z=($e-ke)/864e5;break;case a:Z=$e/r;break;case i:Z=$e/t;break;case o:Z=$e/e;break;default:Z=$e}return z?Z:V.a(Z)},$.daysInMonth=function(){return this.endOf(f).$D},$.$locale=function(){return _[this.$L]},$.locale=function(Q,K){if(!Q)return this.$L;var z=this.clone(),Z=P(Q,K,!0);return Z&&(z.$L=Z),z},$.clone=function(){return V.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},L}(),j=G.prototype;return T.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",p],["$M",f],["$y",S],["$D",b]].forEach(function(L){j[L[1]]=function($){return this.$g($,L[0],L[1])}}),T.extend=function(L,$){return L.$i||(L($,G,T),L.$i=!0),T},T.locale=P,T.isDayjs=O,T.unix=function(L){return T(1e3*L)},T.en=_[F],T.Ls=_,T.p={},T})});var UA=Et((yh,Sh)=>{"use strict";d();c();l();u();(function(e,t){typeof yh=="object"&&typeof Sh<"u"?Sh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_quarterOfYear=t()})(yh,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var i=o.add;o.add=function(p,m){return p=Number(p),this.$utils().p(m)===t?this.add(3*p,e):i.bind(this)(p,m)};var a=o.startOf;o.startOf=function(p,m){var f=this.$utils(),g=!!f.u(m)||m;if(f.p(p)===t){var S=this.quarter()-1;return g?this.month(3*S).startOf(e).startOf("day"):this.month(3*S+2).endOf(e).endOf("day")}return a.bind(this)(p,m)}}})});var QA=Et((vh,Ah)=>{"use strict";d();c();l();u();(function(e,t){typeof vh=="object"&&typeof Ah<"u"?Ah.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_customParseFormat=t()})(vh,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={},p=function(y){return(y=+y)+(y>68?1900:2e3)},m=function(y){return function(x){this[y]=+x}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var w=x.match(/([+-]|\d\d)/g),E=60*w[1]+(+w[2]||0);return E===0?0:w[0]==="+"?-E:E}(y)}],g=function(y){var x=a[y];return x&&(x.indexOf?x:x.s.concat(x.f))},S=function(y,x){var w,E=a.meridiem;if(E){for(var k=1;k<=24;k+=1)if(y.indexOf(E(k,0,x))>-1){w=k>12;break}}else w=y===(x?"pm":"PM");return w},b={A:[i,function(y){this.afternoon=S(y,!1)}],a:[i,function(y){this.afternoon=S(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,m("seconds")],ss:[o,m("seconds")],m:[o,m("minutes")],mm:[o,m("minutes")],H:[o,m("hours")],h:[o,m("hours")],HH:[o,m("hours")],hh:[o,m("hours")],D:[o,m("day")],DD:[n,m("day")],Do:[i,function(y){var x=a.ordinal,w=y.match(/\d+/);if(this.day=w[0],x)for(var E=1;E<=31;E+=1)x(E).replace(/\[|\]/g,"")===y&&(this.day=E)}],w:[o,m("week")],ww:[n,m("week")],M:[o,m("month")],MM:[n,m("month")],MMM:[i,function(y){var x=g("months"),w=(g("monthsShort")||x.map(function(E){return E.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[i,function(y){var x=g("months").indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,m("year")],YY:[n,function(y){this.year=p(y)}],YYYY:[/\d{4}/,m("year")],Z:f,ZZ:f};function h(y){var x,w;x=y,w=a&&a.formats;for(var E=(y=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,V,G){var j=G&&G.toUpperCase();return V||w[G]||e[G]||w[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(L,$,Q){return $||Q.slice(1)})})).match(t),k=E.length,F=0;F<k;F+=1){var _=E[F],I=b[_],O=I&&I[0],P=I&&I[1];E[F]=P?{regex:O,parser:P}:_.replace(/^\[|\]$/g,"")}return function(T){for(var V={},G=0,j=0;G<k;G+=1){var L=E[G];if(typeof L=="string")j+=L.length;else{var $=L.regex,Q=L.parser,K=T.slice(j),z=$.exec(K)[0];Q.call(V,z),T=T.replace(z,"")}}return function(Z){var Y=Z.afternoon;if(Y!==void 0){var J=Z.hours;Y?J<12&&(Z.hours+=12):J===12&&(Z.hours=0),delete Z.afternoon}}(V),V}}return function(y,x,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(p=y.parseTwoDigitYear);var E=x.prototype,k=E.parse;E.parse=function(F){var _=F.date,I=F.utc,O=F.args;this.$u=I;var P=O[1];if(typeof P=="string"){var T=O[2]===!0,V=O[3]===!0,G=T||V,j=O[2];V&&(j=O[2]),a=this.$locale(),!T&&j&&(a=w.Ls[j]),this.$d=function(K,z,Z,Y){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*K);var J=h(z)(K),Se=J.year,ke=J.month,$e=J.day,ct=J.hours,Ye=J.minutes,rt=J.seconds,nt=J.milliseconds,Oe=J.zone,Ie=J.week,Me=new Date,_e=$e||(Se||ke?1:Me.getDate()),ht=Se||Me.getFullYear(),bt=0;Se&&!ke||(bt=ke>0?ke-1:Me.getMonth());var gr,sr=ct||0,Tr=Ye||0,hr=rt||0,In=nt||0;return Oe?new Date(Date.UTC(ht,bt,_e,sr,Tr,hr,In+60*Oe.offset*1e3)):Z?new Date(Date.UTC(ht,bt,_e,sr,Tr,hr,In)):(gr=new Date(ht,bt,_e,sr,Tr,hr,In),Ie&&(gr=Y(gr).week(Ie).toDate()),gr)}catch{return new Date("")}}(_,P,I,w),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),G&&_!=this.format(P)&&(this.$d=new Date("")),a={}}else if(P instanceof Array)for(var L=P.length,$=1;$<=L;$+=1){O[1]=P[$-1];var Q=w.apply(this,O);if(Q.isValid()){this.$d=Q.$d,this.$L=Q.$L,this.init();break}$===L&&(this.$d=new Date(""))}else k.call(this,F)}}})});var yw=Et((_S,NS)=>{"use strict";d();c();l();u();(function(e,t){typeof _S=="object"&&typeof NS<"u"?NS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_timezone=t()})(_S,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,S,b){b===void 0&&(b={});var h=new Date(g),y=function(x,w){w===void 0&&(w={});var E=w.timeZoneName||"short",k=x+"|"+E,F=t[k];return F||(F=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),t[k]=F),F}(S,b);return y.formatToParts(h)},p=function(g,S){for(var b=a(g,S),h=[],y=0;y<b.length;y+=1){var x=b[y],w=x.type,E=x.value,k=e[w];k>=0&&(h[k]=parseInt(E,10))}var F=h[3],_=F===24?0:F,I=h[0]+"-"+h[1]+"-"+h[2]+" "+_+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(I).valueOf()-(O-=O%1e3))/6e4},m=n.prototype;m.tz=function(g,S){if(g===void 0&&(g=i),!this.isValid())return this;var b,h=this.utcOffset(),y=this.toDate(),x=y.toLocaleString("en-US",{timeZone:g}),w=p(+y,g);if(!Number(w))b=this.utcOffset(0,S);else if(b=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),S){var E=b.utcOffset();b=b.add(h-E,"minute")}return b.$x.$timezone=g,b},m.offsetName=function(g){var S=this.$x.$timezone||o.tz.guess(),b=a(this.valueOf(),S,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return b&&b.value};var f=m.startOf;m.startOf=function(g,S){if(!this.$x||!this.$x.$timezone)return f.call(this,g,S);var b=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return f.call(b,g,S).tz(this.$x.$timezone,!0)},o.tz=function(g,S,b){var h=b&&S,y=b||S||i,x=p(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=o.utc(g,h).valueOf();if(Number.isNaN(w)){var E=o(NaN);return E.$x.$timezone=y,E}var k=function(O,P,T){var V=O-60*P*1e3,G=p(V,T);if(P===G)return[V,P];var j=p(V-=60*(G-P)*1e3,T);return G===j?[V,G]:[O-60*Math.min(G,j)*1e3,Math.max(G,j)]}(w,x,y),F=k[0],_=k[1],I=o(F).utcOffset(_);return I.$x.$timezone=y,I},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Sw=Et((DS,qS)=>{"use strict";d();c();l();u();(function(e,t){typeof DS=="object"&&typeof qS<"u"?qS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof v<"u"?v:e||self).dayjs_plugin_utc=t()})(DS,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 p=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var m=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 m.call(this)};var f=a.utcOffset;a.utcOffset=function(h,y){var x=this.$utils().u;if(x(h))return this.$u?0:x(this.$offset)?f.call(this):this.$offset;if(typeof h=="string"&&(h=function(F){F===void 0&&(F="");var _=F.match(t);if(!_)return null;var I=(""+_[0]).match(r)||["-",0,0],O=I[0],P=60*+I[1]+ +I[2];return P===0?0:O==="+"?P:-P}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var E=this.clone();if(y)return E.$offset=w,E.$u=!1,E;var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(E=this.local().add(w+k,e)).$offset=w,E.$x.$localOffset=k,E};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 S=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():S.call(this)};var b=a.diff;a.diff=function(h,y,x){if(h&&this.$u===h.$u)return b.call(this,h,y,x);var w=this.local(),E=i(h).local();return b.call(w,E,y,x)}}})});var KE=Et((Bwe,YE)=>{"use strict";d();c();l();u();function XQ(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}YE.exports=ZQ;function ZQ(e,t,r){var n=r&&r.stringify||XQ,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 p=1;p<i;p++)a[p]=n(t[p]);return a.join(" ")}if(typeof e!="string")return e;var m=t.length;if(m===0)return e;for(var f="",g=1-o,S=-1,b=e&&e.length||0,h=0;h<b;){if(e.charCodeAt(h)===37&&h+1<b){switch(S=S>-1?S:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=m||t[g]==null)break;S<h&&(f+=e.slice(S,h)),f+=Number(t[g]),S=h+2,h++;break;case 105:if(g>=m||t[g]==null)break;S<h&&(f+=e.slice(S,h)),f+=Math.floor(Number(t[g])),S=h+2,h++;break;case 79:case 111:case 106:if(g>=m||t[g]===void 0)break;S<h&&(f+=e.slice(S,h));var y=typeof t[g];if(y==="string"){f+="'"+t[g]+"'",S=h+2,h++;break}if(y==="function"){f+=t[g].name||"<anonymous>",S=h+2,h++;break}f+=n(t[g]),S=h+2,h++;break;case 115:if(g>=m)break;S<h&&(f+=e.slice(S,h)),f+=String(t[g]),S=h+2,h++;break;case 37:S<h&&(f+=e.slice(S,h)),f+="%",S=h+2,h++,g--;break}++g}++h}return S===-1?e:(S<b&&(f+=e.slice(S)),f)}});var nF=Et((Wwe,Kf)=>{"use strict";d();c();l();u();var XE=KE();Kf.exports=Ln;var hu=fB().console||{},JQ={mapHttpRequest:Yf,mapHttpResponse:Yf,wrapRequestSerializer:Ev,wrapResponseSerializer:Ev,wrapErrorSerializer:Ev,req:Yf,res:Yf,err:JE,errWithCause:JE};function Ao(e,t){return e==="silent"?1/0:t.levels.values[e]}var Pv=Symbol("pino.logFuncs"),Fv=Symbol("pino.hierarchy"),eB={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function ZE(e,t){let r={logger:t,parent:e[Fv]};t[Fv]=r}function tB(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:hu[o]||hu[eB[o]||"log"]||hs}),e[Pv]=n}function rB(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Ln(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||hu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=rB(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||{}),p=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&p.forEach(function(x){r[x]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let m=e.level||"info",f=Object.create(r);f.log||(f.log=hs),tB(f,p,r),ZE({},f),Object.defineProperty(f,"levelVal",{get:S}),Object.defineProperty(f,"level",{get:b,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:p,timestamp:lB(e),messageKey:e.messageKey||"msg",onChild:e.onChild||hs};f.levels=nB(e),f.level=m,f.isLevelEnabled=function(x){return this.levels.values[x]?this.levels.values[x]>=this.levels.values[this.level]:!1},f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=hs,f.serializers=n,f._serialize=o,f._stdErrSerialize=i,f.child=function(...x){return y.call(this,g,...x)},t&&(f._logEvent=Tv());function S(){return Ao(this.level,this)}function b(){return this._level}function h(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,Mi(this,g,f,"error"),Mi(this,g,f,"fatal"),Mi(this,g,f,"warn"),Mi(this,g,f,"info"),Mi(this,g,f,"debug"),Mi(this,g,f,"trace"),a.forEach(w=>{Mi(this,g,f,w)})}function y(x,w,E){if(!w)throw new Error("missing bindings for child Pino");E=E||{},o&&w.serializers&&(E.serializers=w.serializers);let k=E.serializers;if(o&&k){var F=Object.assign({},n,k),_=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,kv([w],_,F,this._stdErrSerialize)}function I(P){this._childLevel=(P._childLevel|0)+1,this.bindings=w,F&&(this.serializers=F,this._serialize=_),t&&(this._logEvent=Tv([].concat(P._logEvent.bindings,w)))}I.prototype=this;let O=new I(this);return ZE(this,O),O.child=function(...P){return y.call(this,x,...P)},O.level=E.level||this.level,x.onChild(O),O}return f}function nB(e){let t=e.customLevels||{},r=Object.assign({},Ln.levels.values,t),n=Object.assign({},Ln.levels.labels,oB(t));return{values:r,labels:n}}function oB(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Ln.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"}};Ln.stdSerializers=JQ;Ln.stdTimeFunctions=Object.assign({},{nullTime:tF,epochTime:rF,unixTime:dB,isoTime:pB});function iB(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Fv];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Mi(e,t,r,n){if(Object.defineProperty(e,n,{value:Ao(e.level,r)>Ao(n,r)?hs:r[Pv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===hs){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Ao(i,r);if(Ao(n,r)<a)return}e[n]=sB(e,t,r,n);let o=iB(e);o.length!==0&&(e[n]=aB(o,e[n]))}function aB(e,t){return function(){return t.apply(this,[...e,...arguments])}}function sB(e,t,r,n){return function(o){return function(){let a=t.timestamp(),p=new Array(arguments.length),m=Object.getPrototypeOf&&Object.getPrototypeOf(this)===hu?hu:this;for(var f=0;f<p.length;f++)p[f]=arguments[f];var g=!1;if(t.serialize&&(kv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let S=cB(this,n,p,a,t);if(t.reportCaller&&S&&S.length>0&&S[0]&&typeof S[0]=="object")try{let b=eF();b&&(S[0].caller=b)}catch{}o.call(m,...S)}else{if(t.reportCaller)try{let S=eF();S&&p.push(S)}catch{}o.apply(m,p)}if(t.transmit){let S=t.transmit.level||e._level,b=Ao(S,r),h=Ao(n,r);if(h<b)return;uB(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:S,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Ao(e._level,r)},p,g)}}}(e[Pv][n])}function cB(e,t,r,n,o){let{level:i,log:a=S=>S}=o.formatters||{},p=r.slice(),m=p[0],f={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(f.time=n),i){let S=i(t,e.levels.values[t]);Object.assign(f,S)}else f.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(m!==null&&typeof m=="object")for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());return[a(f),...p]}else{if(m!==null&&typeof m=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());m=p.length?XE(p.shift(),p):void 0}else typeof m=="string"&&(m=XE(p.shift(),p));return m!==void 0&&(f[o.messageKey]=m),[a(f)]}}function kv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Ln.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 uB(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,p=t.methodValue,m=t.val,f=e._logEvent.bindings;n||kv(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 f.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=p,o(a,e._logEvent,m),e._logEvent=Tv(f)}function Tv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function JE(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 lB(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?tF:rF}function Yf(){return{}}function Ev(e){return e}function hs(){}function tF(){return!1}function rF(){return Date.now()}function dB(){return Math.round(Date.now()/1e3)}function pB(){return new Date(Date.now()).toISOString()}function fB(){function e(t){return typeof t<"u"&&t}try{return typeof v<"u"?v:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),v)}catch{return e(self)||e(window)||e(this)||{}}}Kf.exports.default=Ln;Kf.exports.pino=Ln;function eF(){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],p=o[3];return i+":"+a+":"+p}}return null}});var f$={};oc(f$,{HighlightUtils:()=>ah,ResultTemplatesHelpers:()=>yR,SortOrder:()=>Wl,VERSION:()=>Yn,buildAttachToCase:()=>mF,buildAttachedResults:()=>gF,buildBreadcrumbManager:()=>GF,buildCategoryFacet:()=>gT,buildController:()=>ye,buildCriterionExpression:()=>zr,buildDateFacet:()=>DT,buildDateFilter:()=>MT,buildDateRange:()=>ks,buildDateSortCriterion:()=>lx,buildDidYouMean:()=>ZF,buildFacet:()=>TT,buildFacetConditionsManager:()=>rT,buildFacetManager:()=>oT,buildFoldedResultList:()=>JT,buildGeneratedAnswer:()=>nP,buildInsightEngine:()=>lF,buildInsightInterface:()=>zk,buildInteractiveCitation:()=>iP,buildInteractiveResult:()=>IP,buildNotifyTrigger:()=>Vk,buildNumericFacet:()=>UT,buildNumericFilter:()=>BT,buildNumericRange:()=>ng,buildPager:()=>lP,buildQueryError:()=>pP,buildQuerySummary:()=>mP,buildQuickview:()=>SP,buildRecentQueriesList:()=>RP,buildRelevanceSortCriterion:()=>Kl,buildResultList:()=>EP,buildResultTemplatesManager:()=>nO,buildResultsPerPage:()=>TP,buildSearchBox:()=>QP,buildSearchParameterManager:()=>pk,buildSearchStatus:()=>Ek,buildSmartSnippet:()=>Sk,buildSmartSnippetQuestionsList:()=>Ck,buildSort:()=>Ik,buildTab:()=>Tk,buildUserActions:()=>Hk,deserializeRelativeDate:()=>JA,getAnalyticsNextApiBaseUrl:()=>Wu,getOrganizationEndpoint:()=>gt,getSampleInsightEngineConfiguration:()=>Ov,loadAttachedResultsActions:()=>z2,loadAttachedResultsAnalyticsActions:()=>W2,loadCaseContextActions:()=>Y2,loadContextActions:()=>X2,loadDateFacetSetActions:()=>Z2,loadFieldActions:()=>e$,loadFoldingActions:()=>t$,loadGeneratedAnswerActions:()=>r$,loadGenericAnalyticsActions:()=>$2,loadInsightAnalyticsActions:()=>H2,loadInsightInterfaceActions:()=>n$,loadInsightSearchActions:()=>i$,loadInsightSearchAnalyticsActions:()=>a$,loadInsightUserActionsActions:()=>s$,loadNumericFacetSetActions:()=>J2,loadQuerySetActions:()=>o$,loadQuerySuggestActions:()=>c$,loadQuestionAnsweringActions:()=>u$,loadRecentResultsActions:()=>l$});module.exports=dO(f$);d();c();l();u();var ah={};oc(ah,{escapeHtml:()=>Ji,getHighlightedSuggestion:()=>ih,highlightString:()=>LO});d();c();l();u();d();c();l();u();function _O(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 Vo(r)}var Vo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},De=class{constructor(e){de(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let a=this.definition[o].validate(r[o]);a&&n.push(`${o}: ${a}`)}if(n.length)throw OO(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}},Ke=class{constructor(e={}){de(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&J(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 Ya(e){return e===void 0}function _O(e){return e===null}function J(e){return Ya(e)||_O(e)}var pe=class{constructor(e={}){de(this,"value");this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t||(NO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function NO(e){return Ya(e)||$u(e)}function $u(e){return typeof e=="boolean"}var oe=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t||(DO(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 DO(e){return Ya(e)||AA(e)}function AA(e){return typeof e=="number"&&!Number.isNaN(e)}var qO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){de(this,"value");de(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Ke(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:a}=this.config,i=this.value.validate(e);if(i)return i;if(Ya(e))return null;if(!Ka(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(", ")}.`:a&&!(qO.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 Ka(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){de(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ya(e))return this.config.options.required?"value is required and is currently undefined":null;if(!bA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&J(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],a=n.validate(o);a!==null&&(t+=` ${a}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function bA(e){return e!==void 0&&typeof e=="object"}var ae=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new Ke(this.config)}validate(e){if(!J(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(J(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&&J(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 $u(e)||Ka(e)||AA(e)||bA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Xa(e){return Array.isArray(e)}var uc=class{constructor(e){de(this,"config");de(this,"value");this.config=e,this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ya(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}};d();c();l();u();var Hu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function zu(e){return Array.isArray(e)}function Wu(e){return e.trim()===""}function CA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function MO(e){return btoa(encodeURI(e))}function Yu(e,t){let{[e]:r,...n}=t;return n}function Za(e){return MO(JSON.stringify(e))}var VO=new Set(["1",1,"yes",!0]);function ah(){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=>VO.has(r))}function xA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function RA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function lc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ku(e,t,r={}){let n;return(...o)=>{let a=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),a)return e.apply(void 0,o)}}function jO(e){if(Wu(e.openingDelimiter)||Wu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(J(e.content)||Wu(e.content))return e.content;if(e.highlights.length===0)return Ja(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let a=e.highlights[o],i=a.offset,p=i+a.length;if(p>t)break;r+=Ja(e.content.slice(n,i)),r+=e.openingDelimiter,r+=Ja(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Ja(e.content.slice(n))),r}function sh(e,t){return e=Ja(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?ih(n,t.notMatchDelimiters):o?ih(o,t.exactMatchDelimiters):a?ih(a,t.correctionDelimiters):r)}function ih(e,t){return t?t.open+e+t.close:e}function Ja(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,a=>t[a]):e}d();c();l();u();var qA=Pr(OA(),1);d();c();l();u();var ie=new Error("Failed to load reducers."),ei=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."}},Lo=class extends Error{constructor(r,n){super();de(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function _A(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function NA(e){return typeof e!="object"||!e?!1:Object.values(e).every(d0)}function d0(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function DA(e){return e===429}var Qr=class e{static call(t){return _asyncToGenerator(function*(){let r=p0(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let m=yield A(a,i);if(DA(m.status))throw m;return m});return function p(){return _ref.apply(this,arguments)}}();try{let m=yield(0,qA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(f){let g=f&&DA(f.status);return g&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(m.status){case 419:case 401:throw n.info("Platform renewing token"),new ei;case 404:throw new Lo(a,m.status);default:return n.info({response:m,requestInfo:o},"Platform response"),m}}catch(m){return m.message==="Failed to fetch"?new Lo(a):m}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...m}=t,f=lc(m);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return f})()}};function gt(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??gt(t,r)}function Xt(e,t="prod"){return`${gt(e,t)}/rest/search/v2`}function Zu(e,t="prod"){return`${gt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function p0(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",m=f0(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:m}),signal:i}}function f0(e,t){return t==="application/x-www-form-urlencoded"?NA(e)?_A(e):"":JSON.stringify(e)}d();c();l();u();var fc=Pr(Ju(),1),QA=Pr(MA(),1);d();c();l();u();var el=Pr(Ju(),1),jA=Pr(VA(),1);el.default.extend(jA.default);var LA="YYYY/MM/DD@HH:mm:ss",m0="1401-01-01";function ti(e,t){let r=(0,el.default)(e,t);return!r.isValid()&&!t?(0,el.default)(e,LA):r}function tl(e){return e.format(LA)}function UA(e,t){let r=ti(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}`)}xh(r)}function xh(e){if(e.isBefore(m0))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}fc.default.extend(QA.default);var BA=["past","now","next"],GA=["minute","hour","day","week","month","quarter","year"],g0=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new $({required:!t,constrainTo:GA}),period:new $({required:!0,constrainTo:BA})}};function rl(e){if(typeof e=="string"&&!zn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Rh(e):e;new De(g0(t.period)).validate(t);let r=HA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);xh(r)}function $A(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function HA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,fc.default)().subtract(r,n);case"next":return(0,fc.default)().add(r,n);case"now":return(0,fc.default)()}}function mc(e){return tl(HA(Rh(e)))}function zA(e){return e.toLocaleLowerCase().split("-")}function zn(e){let[t,r,n]=zA(e);if(t==="now")return!0;if(!BA.includes(t)||!GA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function WA(e){return!!e&&typeof e=="object"&&"period"in e}function Rh(e){let[t,r,n]=zA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function YA(e){return rl(e),Rh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function XA(_x3,_x4){return _XA.apply(this,arguments)}function _XA(){_XA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _XA.apply(this,arguments)}function ZA(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=y0(t,i);let p=t.length,m=0;for(;r<p;){o&&(t[r]===10&&(m=++r),o=!1);let f=-1;for(;r<p&&f===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-m);break;case 13:o=!0,f=r;break;case 10:f=r;break}if(f===-1)break;e(t.subarray(m,f),n),m=r,n=-1}m===p?t=void 0:m!==0&&(t=t.subarray(m),r-=m)}}function JA(e,t,r){let n=KA(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=KA();else if(p>0){let m=o.decode(i.subarray(0,p)),f=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(f));switch(m){case"data":n.data=n.data?`${n.data}
28
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":h0(g,n,t);break}}}}function h0(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function y0(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function KA(){return{data:"",event:"",id:"",retry:void 0}}var wh="text/event-stream",S0=1e3,eb="last-event-id";function tb(){return typeof window<"u"}function nl(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:m,...f}){return new Promise((g,S)=>{let C={...r};C.accept||(C.accept=wh);let h;function y(){h?.abort(),document.hidden||O()}!p&&tb()&&document.addEventListener("visibilitychange",y);let x=S0,w;function E(){tb()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{E(),g()});let T=m??A,F=n??v0;function O(){return _O2.apply(this,arguments)}function _O2(){_O2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let I=yield T(e,{...f,headers:C,signal:h?.signal});yield F(I),yield XA(I.body,ZA(JA(k=>{k?C[eb]=k:delete C[eb]},k=>{x=k},o))),a?.(),E(),g()}catch(I){if(!h?.signal?.aborted)try{let k=i?.(I)??x;clearTimeout(w),w=setTimeout(O,k)}catch(k){E(),S(k)}}});return _O2.apply(this,arguments)}O()})}function v0(e){let t=e.headers.get("content-type");if(!t?.startsWith(wh))throw new Error(`Expected content-type to be ${wh}, Actual: ${t}`)}d();c();l();u();var Wn=class{constructor(t){de(this,"_basePath");de(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}};var A0=(e,t,r)=>new Wn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,rb=3,b0=5e3,C0="text/event-stream",Fh=1,Ih=class extends Error{},gc=class extends Error{constructor(r){super(r.message);de(this,"payload",r)}},Eh=class{constructor(){de(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},ol=class{constructor(t){de(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:m,close:f,resetAnswer:g}=r,S=new Eh;if(!a){this.logger.error("No stream ID found");return}let C=0,h,y=()=>{h&&!S.isActive(h)&&(w?.abort(),g(),E())},x=()=>{S.remove(h),h=RA(y,h,b0),S.add(h)},w=new s.AbortController,E=()=>nl(A0(n,o,a),{method:"GET",fetch:A,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(T){return _asyncToGenerator(function*(){if(T.ok&&T.headers.get("content-type")===C0)return;throw T.status>=400&&T.status<500&&T.status!==429?new gc({message:"Error opening stream",code:T.status}):new Ih})()},onmessage:T=>{if(w?.signal.aborted)return;let F=JSON.parse(T.data);if(F.finishReason==="ERROR"){S.remove(h),w?.abort(),m({message:F.errorMessage,code:F.statusCode});return}p(F),C=0,F.finishReason==="COMPLETED"?(S.remove(h),f()):x()},onerror:T=>{if(!w?.signal.aborted){if(S.remove(h),T instanceof gc)throw w?.abort(),m(T),T;if(++C>rb){this.logger.info("Maximum retry exceeded.");let F={message:"Failed to complete stream.",code:Fh};throw w?.abort(),m(F),new gc(F)}this.logger.info(`Retrying...(${C}/${rb})`),g()}}});return E(),w}};d();c();l();u();var al=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function hc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var Th=e=>{let{response:t}=e;return t.body?x0(e):R0(t)},x0=e=>I0(e)?E0(e):w0(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},R0=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function w0(e){return e.body.statusCode!==void 0}function I0(e){return e.body.exception!==void 0}var E0=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function nb(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Ph=(e,t,r,n)=>{let o=new Wn(`${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 ob=(e,t)=>{let r=new Wn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},kh=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Qr.call({...Ph(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:hc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=nb(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return F0(i)?{success:i}:{error:Th({response:r,body:i})}});return function kh(_x5,_x6){return _ref3.apply(this,arguments)}}();function F0(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function ri(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function xt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:ri(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:ri(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function T0(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function P0(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ni(e,t){if(t&&e.name==="AbortError")return{error:P0(e)};if(e instanceof Lo)return{error:T0(e)};throw e}var Yn=e=>e.success!==void 0,Xe=e=>e.error!==void 0;function ab(e){return e.results!==void 0}function ib(e){let t=ri();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Oh=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,k0=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,yc=(e,t,r,n)=>{O0(e);let o=Oh(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},sb=(e,t,r)=>{_0(e);let n=k0(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},_h=e=>{let{insightId:t,...r}=hc(e);return r},cb=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},O0=e=>{if(cb(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},_0=e=>{if(cb(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var ub=e=>({...yc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var lb=e=>({...yc(e,"POST","application/json","/search"),requestParams:_h(e)}),db=e=>({...yc(e,"POST","application/json","/querysuggest"),requestParams:_h(e)});d();c();l();u();var pb=e=>({...sb(e,"POST","application/json"),requestParams:{objectId:e.userId}});var il=class{constructor(t){de(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...ub(t),..._this.options});if(r instanceof Error)return ni(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Qr.call({...lb(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return ni(n);let o=yield n.json();return ab(o)&&(o=ib(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...db(t),..._this3.options});if(r instanceof Error)return ni(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...pb(t),..._this4.options});if(r instanceof Error)return ni(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return kh(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),Ze=new $({required:!1,emptyAllowed:!1}),Je=new $({required:!0,emptyAllowed:!0}),aW=new $({required:!1,emptyAllowed:!0}),sl=new ae({each:H,required:!0}),fb=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),mb=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),iW=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),kr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hr=(e,t)=>{if("required"in t)return{payload:new De({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Vo(o);return{payload:e}},q=(e,t)=>{try{return hr(e,t)}catch(r){return{payload:e,error:kr(r)}}},yr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return gb(e,t,r,o,"Controller initialization error")},yt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return gb(e,t,r,o,"Controller initialization error")},gb=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Ft(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 N0=typeof Symbol=="function"&&Symbol.observable||"@@observable",hb=N0,Nh=()=>Math.random().toString(36).substring(7).split("").join("."),D0={INIT:`@@redux/INIT${Nh()}`,REPLACE:`@@redux/REPLACE${Nh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Nh()}`},cl=D0;function Br(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 Dh(e,t,r){if(typeof e!="function")throw new Error(Ft(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ft(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ft(1));return r(Dh)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,m=!1;function f(){i===a&&(i=new Map,a.forEach((w,E)=>{i.set(E,w)}))}function g(){if(m)throw new Error(Ft(3));return o}function S(w){if(typeof w!="function")throw new Error(Ft(4));if(m)throw new Error(Ft(5));let E=!0;f();let T=p++;return i.set(T,w),function(){if(E){if(m)throw new Error(Ft(6));E=!1,f(),i.delete(T),a=null}}}function C(w){if(!Br(w))throw new Error(Ft(7));if(typeof w.type>"u")throw new Error(Ft(8));if(typeof w.type!="string")throw new Error(Ft(17));if(m)throw new Error(Ft(9));try{m=!0,o=n(o,w)}finally{m=!1}return(a=i).forEach(T=>{T()}),w}function h(w){if(typeof w!="function")throw new Error(Ft(10));n=w,C({type:cl.REPLACE})}function y(){let w=S;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ft(11));function T(){let O=E;O.next&&O.next(g())}return T(),{unsubscribe:w(T)}},[hb](){return this}}}return C({type:cl.INIT}),{dispatch:C,subscribe:S,getState:g,replaceReducer:h,[hb]:y}}function q0(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:cl.INIT})>"u")throw new Error(Ft(12));if(typeof r(void 0,{type:cl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ft(13))})}function oi(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{q0(r)}catch(i){a=i}return function(p={},m){if(a)throw a;let f=!1,g={};for(let S=0;S<n.length;S++){let C=n[S],h=r[C],y=p[C],x=h(y,m);if(typeof x>"u"){let w=m&&m.type;throw new Error(Ft(14))}g[C]=x,f=f||x!==y}return f=f||n.length!==Object.keys(p).length,f?g:p}}function Sc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function yb(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Ft(15))},i={getState:o.getState,dispatch:(m,...f)=>a(m,...f)},p=e.map(m=>m(i));return a=Sc(...p)(o.dispatch),{...o,dispatch:a}}}function vc(e){return Br(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Gh=Symbol.for("immer-nothing"),Ac=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state");function Tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var cr=Object,Qo=cr.getPrototypeOf,bc="constructor",Ic="prototype",Vh="configurable",pl="enumerable",ll="writable",Cc="value",zt=e=>!!e&&!!e[vt];function jt(e){return e?wb(e)||Fc(e)||!!e[Ac]||!!e[bc]?.[Ac]||Tc(e)||Pc(e):!1}var M0=cr[Ic][bc].toString(),Sb=new WeakMap;function wb(e){if(!e||!ii(e))return!1;let t=Qo(e);if(t===null||t===cr[Ic])return!0;let r=cr.hasOwnProperty.call(t,bc)&&t[bc];if(r===Object)return!0;if(!Uo(r))return!1;let n=Sb.get(r);return n===void 0&&(n=Function.toString.call(r),Sb.set(r,n)),n===M0}function Ib(e){return zt(e)||Tt(15,e),e[vt].base_}function Ec(e,t,r=!0){Bo(e)===0?(r?Reflect.ownKeys(e):cr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Bo(e){let t=e[vt];return t?t.type_:Fc(e)?1:Tc(e)?2:Pc(e)?3:0}var ai=(e,t,r=Bo(e))=>r===2?e.has(t):cr[Ic].hasOwnProperty.call(e,t),Fn=(e,t,r=Bo(e))=>r===2?e.get(t):e[t],fl=(e,t,r,n=Bo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function V0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Fc=Array.isArray,Tc=e=>e instanceof Map,Pc=e=>e instanceof Set,ii=e=>typeof e=="object",Uo=e=>typeof e=="function",qh=e=>typeof e=="boolean";function j0(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var L0=e=>ii(e)?e?.[vt]:null,Tn=e=>e.copy_||e.base_;var $h=e=>e.modified_?e.copy_:e.base_;function jh(e,t){if(Tc(e))return new Map(e);if(Pc(e))return new Set(e);if(Fc(e))return Array[Ic].slice.call(e);let r=wb(e);if(t===!0||t==="class_only"&&!r){let n=cr.getOwnPropertyDescriptors(e);delete n[vt];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[ll]===!1&&(p[ll]=!0,p[Vh]=!0),(p.get||p.set)&&(n[i]={[Vh]:!0,[ll]:!0,[pl]:p[pl],[Cc]:e[i]})}return cr.create(Qo(e),n)}else{let n=Qo(e);if(n!==null&&r)return{...e};let o=cr.create(n);return cr.assign(o,e)}}function Hh(e,t=!1){return vl(e)||zt(e)||!jt(e)||(Bo(e)>1&&cr.defineProperties(e,{set:ul,add:ul,clear:ul,delete:ul}),cr.freeze(e),t&&Ec(e,(r,n)=>{Hh(n,!0)},!1)),e}function U0(){Tt(2)}var ul={[Cc]:U0};function vl(e){return e===null||!ii(e)?!0:cr.isFrozen(e)}var ml="MapSet",gl="Patches",vb="ArrayMethods",hl={};function Go(e){let t=hl[e];return t||Tt(0,e),t}var Ab=e=>!!hl[e];function Q0(e,t){hl[e]||(hl[e]=t)}var xc,Eb=()=>xc,B0=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ab(ml)?Go(ml):void 0,arrayMethodsPlugin_:Ab(vb)?Go(vb):void 0});function bb(e,t){t&&(e.patchPlugin_=Go(gl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Lh(e){Uh(e),e.drafts_.forEach(G0),e.drafts_=null}function Uh(e){e===xc&&(xc=e.parent_)}var Cb=e=>xc=B0(xc,e);function G0(e){let t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function xb(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[vt].modified_&&(Lh(t),Tt(4)),jt(e)&&(e=Rb(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[vt].base_,e,t)}else e=Rb(t,r);return $0(t,e,!0),Lh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gh?e:void 0}function Rb(e,t){if(vl(t))return t;let r=t[vt];if(!r)return yl(t,e.handledSet_,e);if(!Al(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);Pb(r,e)}return r.copy_}function $0(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hh(t,r)}function Fb(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Al=(e,t)=>e.scope_===t,H0=[];function Tb(e,t,r,n){let o=Tn(e),a=e.type_;if(n!==void 0&&Fn(o,n,a)===t){fl(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Ec(o,(m,f)=>{if(zt(f)){let g=p.get(f)||[];g.push(m),p.set(f,g)}})}let i=e.draftLocations_.get(t)??H0;for(let p of i)fl(o,p,r,a)}function z0(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Al(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=$h(a);Tb(e,a.draft_??a,i,r),Pb(a,o)})}function Pb(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)}Fb(e)}}function W0(e,t,r){let{scope_:n}=e;if(zt(r)){let o=r[vt];Al(o,n)&&o.callbacks_.push(function(){dl(e);let i=$h(o);Tb(e,r,i,t)})}else jt(r)&&e.callbacks_.push(function(){let a=Tn(e);e.type_===3?a.has(r)&&yl(r,n.handledSet_,n):Fn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&yl(Fn(e.copy_,t,e.type_),n.handledSet_,n)})}function yl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||zt(e)||t.has(e)||!jt(e)||vl(e)||(t.add(e),Ec(e,(n,o)=>{if(zt(o)){let a=o[vt];if(Al(a,r)){let i=$h(a);fl(e,n,i,e.type_),Fb(a)}}else jt(o)&&yl(o,t,r)})),e}function Y0(e,t){let r=Fc(e),n={type_:r?1:0,scope_:t?t.scope_:Eb(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=Sl;r&&(o=[n],a=Rc);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var Sl={get(e,t){if(t===vt)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=Tn(e);if(!ai(o,t,e.type_))return X0(e,o,t);let a=o[t];if(e.finalized_||!jt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&j0(t))return a;if(a===Mh(e.base_,t)||K0(e,t,a)){dl(e);let i=e.type_===1?+t:t,p=Bh(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in Tn(e)},ownKeys(e){return Reflect.ownKeys(Tn(e))},set(e,t,r){let n=kb(Tn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Mh(Tn(e),t),a=o?.[vt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(V0(r,o)&&(r!==void 0||ai(e.base_,t,e.type_)))return!0;dl(e),Qh(e)}return e.copy_[t]===r&&(r!==void 0||ai(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),W0(e,t,r)),!0},deleteProperty(e,t){return dl(e),Mh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Qh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Tn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ll]:!0,[Vh]:e.type_!==1||t!=="length",[pl]:n[pl],[Cc]:r[t]}},defineProperty(){Tt(11)},getPrototypeOf(e){return Qo(e.base_)},setPrototypeOf(){Tt(12)}},Rc={};for(let e in Sl){let t=Sl[e];Rc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Rc.deleteProperty=function(e,t){return Rc.set.call(this,e,t,void 0)};Rc.set=function(e,t,r){return Sl.set.call(this,e[0],t,r,e[0])};function Mh(e,t){let r=e[vt];return(r?Tn(r):e)[t]}function K0(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jt(r)||r[vt]?!1:e.baseRefs_.has(r)}function X0(e,t,r){let n=kb(t,r);return n?Cc in n?n[Cc]:n.get?.call(e.draft_):void 0}function kb(e,t){if(!(t in e))return;let r=Qo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Qo(r)}}function Qh(e){e.modified_||(e.modified_=!0,e.parent_&&Qh(e.parent_))}function dl(e){e.copy_||(e.assigned_=new Map,e.copy_=jh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Z0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Uo(t)&&!Uo(r)){let a=r;r=t;let i=this;return function(m=a,...f){return i.produce(m,g=>r.call(this,g,...f))}}Uo(r)||Tt(6),n!==void 0&&!Uo(n)&&Tt(7);let o;if(jt(t)){let a=Cb(this),i=Bh(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?Lh(a):Uh(a)}return bb(a,n),xb(o,a)}else if(!t||!ii(t)){if(o=r(t),o===void 0&&(o=t),o===Gh&&(o=void 0),this.autoFreeze_&&Hh(o,!0),n){let a=[],i=[];Go(gl).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else Tt(1,t)},this.produceWithPatches=(t,r)=>{if(Uo(t))return(i,...p)=>this.produceWithPatches(i,m=>t(m,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},qh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),qh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),qh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jt(e)||Tt(8),zt(e)&&(e=bl(e));let t=Cb(this),r=Bh(t,e,void 0);return r[vt].isManual_=!0,Uh(t),r}finishDraft(e,t){let r=e&&e[vt];(!r||!r.isManual_)&&Tt(9);let{scope_:n}=r;return bb(n,t),xb(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=Go(gl).applyPatches_;return zt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Bh(e,t,r,n){let[o,a]=Tc(t)?Go(ml).proxyMap_(t,r):Pc(t)?Go(ml).proxySet_(t,r):Y0(t,r);return(r?.scope_??Eb()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?z0(r,a,n):a.callbacks_.push(function(m){m.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:f}=m;a.modified_&&f&&f.generatePatches_(a,[],m)}),o}function bl(e){return zt(e)||Tt(10,e),Ob(e)}function Ob(e){if(!jt(e)||vl(e))return e;let t=e[vt],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=jh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=jh(e,!0);return Ec(r,(o,a)=>{fl(r,o,Ob(a))},n),t&&(t.finalized_=!1),r}function _b(){function t(y,x=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,E=L0(Fn(w,y.key_)),T=Fn(w,y.key_);if(T===void 0||T!==y.draft_&&T!==y.base_&&T!==y.copy_||E!=null&&E.base_!==y.base_)return null;let F=y.parent_.type_===3,O;if(F){let I=y.parent_;O=Array.from(I.drafts_.keys()).indexOf(y.key_)}else O=y.key_;if(!(F&&w.size>O||ai(w,O)))return null;x.push(O)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let w=y;for(let E=0;E<x.length-1;E++){let T=x[E];if(w=Fn(w,T),!ii(w)||w===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(y,x,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:T}=w;switch(y.type_){case 0:case 2:return m(y,x,E,T);case 1:return p(y,x,E,T);case 3:return f(y,x,E,T)}}function p(y,x,w,E){let{base_:T,assigned_:F}=y,O=y.copy_;O.length<T.length&&([T,O]=[O,T],[w,E]=[E,w]);let I=y.allIndicesReassigned_===!0;for(let k=0;k<T.length;k++){let P=O[k],_=T[k];if((I||F?.get(k.toString()))&&P!==_){let B=P?.[vt];if(B&&B.modified_)continue;let U=x.concat([k]);w.push({op:n,path:U,value:h(P)}),E.push({op:n,path:U,value:h(_)})}}for(let k=T.length;k<O.length;k++){let P=x.concat([k]);w.push({op:o,path:P,value:h(O[k])})}for(let k=O.length-1;T.length<=k;--k){let P=x.concat([k]);E.push({op:a,path:P})}}function m(y,x,w,E){let{base_:T,copy_:F,type_:O}=y;Ec(y.assigned_,(I,k)=>{let P=Fn(T,I,O),_=Fn(F,I,O),j=k?ai(T,I)?n:o:a;if(P===_&&j===n)return;let B=x.concat(I);w.push(j===a?{op:j,path:B}:{op:j,path:B,value:h(_)}),E.push(j===o?{op:a,path:B}:j===a?{op:o,path:B,value:h(P)}:{op:n,path:B,value:h(P)})})}function f(y,x,w,E){let{base_:T,copy_:F}=y,O=0;T.forEach(I=>{if(!F.has(I)){let k=x.concat([O]);w.push({op:a,path:k,value:I}),E.unshift({op:o,path:k,value:I})}O++}),O=0,F.forEach(I=>{if(!T.has(I)){let k=x.concat([O]);w.push({op:o,path:k,value:I}),E.unshift({op:a,path:k,value:I})}O++})}function g(y,x,w){let{patches_:E,inversePatches_:T}=w;E.push({op:n,path:[],value:x===Gh?void 0:x}),T.push({op:n,path:[],value:y})}function S(y,x){return x.forEach(w=>{let{path:E,op:T}=w,F=y;for(let P=0;P<E.length-1;P++){let _=Bo(F),j=E[P];typeof j!="string"&&typeof j!="number"&&(j=""+j),(_===0||_===1)&&(j==="__proto__"||j===bc)&&Tt(19),Uo(F)&&j===Ic&&Tt(19),F=Fn(F,j),(F===null||!ii(F))&&Tt(18,E.join("/"))}let O=Bo(F),I=C(w.value),k=E[E.length-1];switch(T){case n:switch(O){case 2:return F.set(k,I);case 3:Tt(16);default:return F[k]=I}case o:switch(O){case 1:return k==="-"?F.push(I):F.splice(k,0,I);case 2:return F.set(k,I);case 3:return F.add(I);default:return F[k]=I}case a:switch(O){case 1:return F.splice(k,1);case 2:return F.delete(k);case 3:return F.delete(w.value);default:return delete F[k]}default:Tt(17,T)}}),y}function C(y){if(!jt(y))return y;if(Fc(y))return y.map(C);if(Tc(y))return new Map(Array.from(y.entries()).map(([w,E])=>[w,C(E)]));if(Pc(y))return new Set(Array.from(y).map(C));let x=Object.create(Qo(y));for(let w in y)x[w]=C(y[w]);return ai(y,Ac)&&(x[Ac]=y[Ac]),x}function h(y){return zt(y)?C(y):y}Q0(gl,{applyPatches_:S,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var J0=v.Iterator,yW=typeof J0?.from=="function";var wc=new Z0,$o=wc.produce,zh=wc.produceWithPatches.bind(wc);var Wh=wc.applyPatches.bind(wc);d();c();l();u();var e_=class{constructor(e){this.value=e}deref(){return this.value}},t_=()=>typeof WeakRef>"u"?e_:WeakRef,Db=t_(),r_=0,Cl=1;function kc(){return{s:r_,v:void 0,o:null,p:null}}function n_(e){return e instanceof Db?e.deref():e}function si(e,t={}){let r=kc(),{resultEqualityCheck:n,maxSize:o}=t,a=o!==void 0;if(a&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let i=null,p=0,m,f=0,g=!1;function S(){p>=o&&(i=r,r=kc(),p=0)}function C(){let h=r,{length:y}=arguments;for(let E=0,T=y;E<T;E++){let F=arguments[E];if(typeof F=="function"||typeof F=="object"&&F!==null){let O=h.o;O===null&&(h.o=O=new WeakMap);let I=O.get(F);I===void 0?(h=kc(),O.set(F,h)):h=I}else{let O=h.p;O===null&&(h.p=O=new Map);let I=O.get(F);I===void 0?(h=kc(),O.set(F,h),p++):h=I}}if(h.s===Cl)return h.v;if(i!==null){let E=i;for(let T=0,F=y;T<F;T++){let O=arguments[T],I;if(typeof O=="function"||typeof O=="object"&&O!==null){let k=E.o;I=k!==null?k.get(O):void 0}else{let k=E.p;I=k!==null?k.get(O):void 0}if(I===void 0){E=null;break}E=I}if(E!==null&&E.s===Cl){let T=h;return T.s=Cl,T.v=E.v,S(),E.v}}let x=h,w=e.apply(null,arguments);if(f++,n){let E=n_(m);E!=null&&n(E,w)&&(w=E,f!==0&&f--),m=typeof w=="object"&&w!==null||typeof w=="function"?new Db(w):w}return x.s=Cl,x.v=w,a&&S(),w}return C.clearCache=()=>{r=kc(),i=null,p=0,C.resetResultsCount()},C.resultsCount=()=>f,C.resetResultsCount=()=>{f=0},C}var Yh=Symbol("NOT_FOUND");function o_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function a_(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 Nb=e=>Array.isArray(e)?e:[e];function i_(e){let t=Array.isArray(e[0])?e[0]:e;return a_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function xl(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,m={},f=o.pop();typeof f=="object"&&(m=f,f=o.pop()),o_(f,`createSelector expects an output function after the inputs, but received: [${typeof f}]`);let g={...r,...m},{memoize:S,memoizeOptions:C=[],argsMemoize:h=si,argsMemoizeOptions:y=[]}=g,x=Nb(C),w=Nb(y),E=i_(o),T=S(function(){return a++,f.apply(null,arguments)},...x),F=!0,O=h(function(){i++;let{length:k}=E,P=new Array(k);for(let _=0;_<k;_++)P[_]=E[_].apply(null,arguments);return p=T.apply(null,P),p},...w);return Object.assign(O,{resultFunc:f,memoizedResultFunc:T,dependencies:E,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:S,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var lt=xl(si);function s_(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Yh},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function c_(e,t){let r=[];function n(p){let m=r.findIndex(f=>t(f.key,p));if(m>-1){let f=r[m];return m>0&&(r.splice(m,1),r.unshift(f)),f.value}return Yh}function o(p,m){r.unshift({key:p,value:m}),r.length>e&&r.pop()}function a(p,m){let f=r,{length:g}=f;for(let S=0;S<g;S++){let C=f[S];if(m(C.value,p))return C}}function i(){r=[]}return{get:n,put:o,findMatchingEntry:a,clear:i}}var u_=(e,t)=>e===t;function l_(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let a=0;a<o;a++)if(!e(r[a],n[a]))return!1;return!0}}function Kh(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=u_,maxSize:o=1,resultEqualityCheck:a}=r,i=l_(n),p=0,m=o<=1?s_(i):c_(o,i);function f(){let g=m.get(arguments);if(g===Yh){if(g=e.apply(null,arguments),p++,a){let S=m.findMatchingEntry(g,a);S&&(g=S.value,p!==0&&p--)}m.put(arguments,g)}return g}return f.clearCache=()=>{m.clear(),f.resetResultsCount()},f.resultsCount=()=>p,f.resetResultsCount=()=>{p=0},f}d();c();l();u();function qb(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var Mb=qb(),Vb=qb;var d_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Sc:Sc.apply(null,arguments)},LW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},p_=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Wt(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=>vc(n)&&n.type===e,r}var Hb=class Oc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Oc.prototype)}static get[Symbol.species](){return Oc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Oc(...t[0].concat(this)):new Oc(...t.concat(this))}};function jb(e){return jt(e)?$o(e,()=>{}):e}function Rl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function f_(e){return typeof e=="boolean"}var m_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new Hb;return r&&(f_(r)?i.push(Mb):i.push(Vb(r.extraArgument))),i},_c="RTK_autoBatch",li=()=>e=>({payload:e,meta:{[_c]:!0}}),Lb=e=>t=>{setTimeout(t,e)},g_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},h_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,m=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?g_(window.requestAnimationFrame,100):Lb(10):e.type==="callback"?e.queueNotification:Lb(e.timeout),f=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let S=()=>o&&g(),C=n.subscribe(S);return p.add(g),()=>{C(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[_c],a=!o,a&&(i||(i=!0,m(f))),n.dispatch(g)}finally{o=!0}}})},y_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Hb(e);return n&&o.push(h_(typeof n=="object"?n:void 0)),o};function zb(e){let t=m_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},m;if(typeof r=="function")m=r;else if(Br(r))m=oi(r);else throw new Error(Wt(1));let f;typeof n=="function"?f=n(t):f=t();let g=Sc;o&&(g=d_({trace:!1,...(typeof o=="object"&&o)}));let S=yb(...f),C=y_(S),h=typeof p=="function"?p(C):C(),y=g(...h);return Dh(m,i,y)}function Wb(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Wt(28));if(p in t)throw new Error(Wt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function S_(e){return typeof e=="function"}function fe(e,t){let[r,n,o]=Wb(t),a;if(S_(e))a=()=>jb(e());else{let p=jb(e);a=()=>p}function i(p=a(),m){let f=[r[m.type],...n.filter(({matcher:g})=>g(m)).map(({reducer:g})=>g)];return f.filter(g=>!!g).length===0&&(f=[o]),f.reduce((g,S)=>{if(S)if(zt(g)){let h=S(g,m);return h===void 0?g:h}else{if(jt(g))return $o(g,C=>S(C,m));{let C=S(g,m);if(C===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return g},p)}return i.getInitialState=a,i}var Yb=(e,t)=>p_(e)?e.match(t):e(t);function Gr(...e){return t=>e.some(r=>Yb(r,t))}function ui(...e){return t=>e.every(r=>Yb(r,t))}function Fl(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 Nc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Tl(...e){return e.length===0?t=>Fl(t,["pending"]):Nc(e)?Gr(...e.map(t=>t.pending)):Tl()(e[0])}function zo(...e){return e.length===0?t=>Fl(t,["rejected"]):Nc(e)?Gr(...e.map(t=>t.rejected)):zo()(e[0])}function Dc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ui(zo(...e),t):Nc(e)?ui(zo(...e),t):Dc()(e[0])}function Pn(...e){return e.length===0?t=>Fl(t,["fulfilled"]):Nc(e)?Gr(...e.map(t=>t.fulfilled)):Pn()(e[0])}function Pl(...e){return e.length===0?t=>Fl(t,["pending","fulfilled","rejected"]):Nc(e)?Gr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Pl()(e[0])}var v_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",qc=(e=21)=>{let t="",r=e;for(;r--;)t+=v_[Math.random()*64|0];return t},A_=["name","message","stack","code"],Xh=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},Ub=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},b_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of A_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Qb="External signal was aborted",me=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(m,f,g,S)=>({payload:m,meta:{...(S||{}),arg:g,requestId:f,requestStatus:"fulfilled"}})),a=N(t+"/pending",(m,f,g)=>({payload:void 0,meta:{...(g||{}),arg:f,requestId:m,requestStatus:"pending"}})),i=N(t+"/rejected",(m,f,g,S,C)=>({payload:S,error:(n&&n.serializeError||b_)(m||"Rejected"),meta:{...(C||{}),arg:g,requestId:f,rejectedWithValue:!!S,requestStatus:"rejected",aborted:m?.name==="AbortError",condition:m?.name==="ConditionError"}}));function p(m,{signal:f}={}){return(g,S,C)=>{let h=n?.idGenerator?n.idGenerator(m):qc(),y=new s.AbortController,x,w;function E(F){w=F,y.abort()}f&&(f.aborted?E(Qb):f.addEventListener("abort",()=>E(Qb),{once:!0}));let T=_asyncToGenerator(function*(){let F;try{let I=n?.condition?.(m,{getState:S,extra:C});if(x_(I)&&(I=yield I),I===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let k=new Promise((P,_)=>{x=()=>{_({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});g(a(h,m,n?.getPendingMeta?.({requestId:h,arg:m},{getState:S,extra:C}))),F=yield Promise.race([k,Promise.resolve(r(m,{dispatch:g,getState:S,extra:C,requestId:h,signal:y.signal,abort:E,rejectWithValue:(P,_)=>new Xh(P,_),fulfillWithValue:(P,_)=>new Ub(P,_)})).then(P=>{if(P instanceof Xh)throw P;return P instanceof Ub?o(P.payload,h,m,P.meta):o(P,h,m)})])}catch(I){F=I instanceof Xh?i(null,h,m,I.payload,I.meta):i(I,h,m)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&i.match(F)&&F.meta.condition||g(F),F})();return Object.assign(T,{abort:E,requestId:h,arg:m,unwrap(){return T.then(C_)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Gr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function C_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function x_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Kb=Symbol.for("rtk-slice-createasyncthunk"),QW={[Kb]:me};function R_(e,t){return`${e}/${t}`}function w_({creators:e}={}){let t=e?.asyncThunk?.[Kb];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Wt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(E_()):n.reducers)||{},p=Object.keys(i),m={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(F,O){let I=typeof F=="string"?F:F.type;if(!I)throw new Error(Wt(12));if(I in m.sliceCaseReducersByType)throw new Error(Wt(13));return m.sliceCaseReducersByType[I]=O,f},addMatcher(F,O){return m.sliceMatchers.push({matcher:F,reducer:O}),f},exposeAction(F,O){return m.actionCreators[F]=O,f},exposeCaseReducer(F,O){return m.sliceCaseReducersByName[F]=O,f}};p.forEach(F=>{let O=i[F],I={reducerName:F,type:R_(o,F),createNotation:typeof n.reducers=="function"};T_(O)?k_(I,O,f,t):F_(I,O,f)});function g(){let[F={},O=[],I=void 0]=typeof n.extraReducers=="function"?Wb(n.extraReducers):[n.extraReducers],k={...F,...m.sliceCaseReducersByType};return fe(n.initialState,P=>{for(let _ in k)P.addCase(_,k[_]);for(let _ of m.sliceMatchers)P.addMatcher(_.matcher,_.reducer);for(let _ of O)P.addMatcher(_.matcher,_.reducer);I&&P.addDefaultCase(I)})}let S=F=>F,C=new Map,h=new WeakMap,y;function x(F,O){return y||(y=g()),y(F,O)}function w(){return y||(y=g()),y.getInitialState()}function E(F,O=!1){function I(P){let _=P[F];return typeof _>"u"&&O&&(_=Rl(h,I,w)),_}function k(P=S){let _=Rl(C,O,()=>new WeakMap);return Rl(_,P,()=>{let j={};for(let[B,U]of Object.entries(n.selectors??{}))j[B]=I_(U,P,()=>Rl(h,P,w),O);return j})}return{reducerPath:F,getSelectors:k,get selectors(){return k(I)},selectSlice:I}}let T={name:o,reducer:x,actions:m.actionCreators,caseReducers:m.sliceCaseReducersByName,getInitialState:w,...E(a),injectInto(F,{reducerPath:O,...I}={}){let k=O??a;return F.inject({reducerPath:k,reducer:x},I),{...T,...E(k,!0)}}};return T}}function I_(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var Wo=w_();function E_(){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 F_({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!P_(n))throw new Error(Wt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?N(e,i):N(e))}function T_(e){return e._reducerDefinitionType==="asyncThunk"}function P_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function k_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Wt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:m,settled:f,options:g}=r,S=o(e,a,g);n.exposeAction(t,S),i&&n.addCase(S.fulfilled,i),p&&n.addCase(S.pending,p),m&&n.addCase(S.rejected,m),f&&n.addMatcher(S.settled,f),n.exposeCaseReducer(t,{fulfilled:i||wl,pending:p||wl,rejected:m||wl,settled:f||wl})}function wl(){}var O_="task",Xb="listener",Zb="completed",ey="cancelled",__=`task-${ey}`,N_=`task-${Zb}`,Zh=`${Xb}-${ey}`,D_=`${Xb}-${Zb}`,kl=class{constructor(e){de(this,"code");de(this,"name","TaskAbortError");de(this,"message");this.code=e,this.message=`${O_} ${ey} (reason: ${e})`}},ty=(e,t)=>{if(typeof e!="function")throw new TypeError(Wt(32))},Il=()=>{},Jb=(e,t=Il)=>(e.catch(t),e),eC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ho=e=>{if(e.aborted)throw new kl(e.reason)};function tC(e,t){let r=Il;return new Promise((n,o)=>{let a=()=>o(new kl(e.reason));if(e.aborted){a();return}r=eC(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Il})}var q_=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof kl?"cancelled":"rejected",error:r}}finally{t?.()}});return function q_(_x7,_x8){return _ref5.apply(this,arguments)}}(),El=e=>t=>Jb(tC(e,t).then(r=>(Ho(e),r))),rC=e=>{let t=El(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ci}=Object,Bb={},Ol="listenerMiddleware",M_=(e,t)=>{let r=n=>eC(e,()=>n.abort(e.reason));return(n,o)=>{ty(n,"taskExecutor");let a=new s.AbortController;r(a);let i=q_(/*#__PURE__*/_asyncToGenerator(function*(){Ho(e),Ho(a.signal);let p=yield n({pause:El(a.signal),delay:rC(a.signal),signal:a.signal});return Ho(a.signal),p}),()=>a.abort(N_));return o?.autoJoin&&t.push(i.catch(Il)),{result:El(e)(i),cancel(){a.abort(__)}}}},V_=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Ho(t);let a=()=>{},p=[new Promise((m,f)=>{let g=e({predicate:n,effect:(S,C)=>{C.unsubscribe(),m([S,C.getState(),C.getOriginalState()])}});a=()=>{g(),f()}})];o!=null&&p.push(new Promise(m=>setTimeout(m,o,null)));try{let m=yield tC(t,Promise.race(p));return Ho(t),m}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Jb(r(n,o))},nC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=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(Wt(21));return ty(a,"options.listener"),{predicate:o,type:t,effect:a}},oC=ci(e=>{let{type:t,predicate:r,effect:n}=nC(e);return{id:qc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Wt(22))}}},{withTypes:()=>oC}),Gb=(e,t)=>{let{type:r,effect:n,predicate:o}=nC(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},Jh=e=>{e.pending.forEach(t=>{t.abort(Zh)})},j_=(e,t)=>()=>{for(let r of t.keys())Jh(r);e.clear()},$b=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},aC=ci(N(`${Ol}/add`),{withTypes:()=>aC}),L_=N(`${Ol}/removeAll`),iC=ci(N(`${Ol}/remove`),{withTypes:()=>iC}),U_=(...e)=>{console.error(`${Ol}/error`,...e)},sC=(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:a,onError:i=U_}=e;ty(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Jh(h)}),m=h=>{let y=Gb(t,h)??oC(h);return p(y)};ci(m,{withTypes:()=>m});let f=h=>{let y=Gb(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Jh(y)),!!y};ci(f,{withTypes:()=>f});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,x,w){let E=new s.AbortController,T=V_(m,E.signal),F=[];try{h.pending.add(E),n(h),yield Promise.resolve(h.effect(y,ci({},x,{getOriginalState:w,condition:(O,I)=>T(O,I).then(Boolean),take:T,delay:rC(E.signal),pause:El(E.signal),extra:a,signal:E.signal,fork:M_(E.signal,F),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((O,I,k)=>{O!==E&&(O.abort(Zh),k.delete(O))})},cancel:()=>{E.abort(Zh),h.pending.delete(E)},throwIfCancelled:()=>{Ho(E.signal)}})))}catch(O){O instanceof kl||$b(i,O,{raisedBy:"effect"})}finally{yield Promise.all(F),E.abort(D_),o(h),h.pending.delete(E)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),S=j_(t,r);return{middleware:h=>y=>x=>{if(!vc(x))return y(x);if(aC.match(x))return m(x.payload);if(L_.match(x)){S();return}if(iC.match(x))return f(x.payload);let w=h.getState(),E=()=>{if(w===Bb)throw new Error(Wt(23));return w},T;try{if(T=y(x),t.size>0){let F=h.getState(),O=Array.from(t.values());for(let I of O){let k=!1;try{k=I.predicate(x,F,w)}catch(P){k=!1,$b(i,P,{raisedBy:"predicate"})}k&&g(I,x,h,E)}}}finally{w=Bb}return T},startListening:m,stopListening:f,clearListeners:S}};function Wt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function cC(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var uC=/^(?:[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 Q_(e){return typeof e=="string"&&uC.test(e)}var ry=Q_;d();c();l();u();var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function lC(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var B_=new Uint8Array(16);function ny(){return crypto.getRandomValues(B_)}d();c();l();u();function G_(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():$_(e,t,r)}function $_(e,t,r){e=e||{};let n=e.random??e.rng?.()??ny();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 lC(n)}var oy=G_;function H_(_x13){return _H_.apply(this,arguments)}function _H_(){_H_=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _H_.apply(this,arguments)}var hC="2.1.3",ay=128,yC=192,dC=224,pC=240,z_=248;function W_(e){return(e&z_)===pC?4:(e&pC)===dC?3:(e&dC)===yC?2:1}function Y_(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&ay)!=ay)break;if(r-=3,(n&yC)!=ay){t-r>=W_(n)*3&&(r=t);break}}return e.substring(0,r)}function K_(e){let{trackingId:t}=e;return{trackingId:t}}function X_(e){return(e.source||[]).concat([`relay@${hC}`])}function SC(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=K_(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:X_(t),clientId:p,userAgent:a(),referrer:fC(n()),location:fC(o())})}function fC(e){return e!==null?Y_(e,1024):null}function Z_(e,t,r,n){return{...t,meta:SC(e,r,n)}}var J_="*";function eN(){let e=[];function t({type:m,callback:f}){return e.findIndex(g=>g.type===m&&g.callback===f)}function r(m,f){return m.type==="*"||f===m.type}function n(m){return t(m)<0&&e.push(m),()=>p(m.type,m.callback)}function o(m){e.forEach(f=>{if(r(f,m.meta.type))try{f.callback(m)}catch(g){console.error(g)}})}function a(m){if(m===J_)e.length=0;else for(let f=e.length-1;f>=0;f--)e[f].type===m&&e.splice(f,1)}function i(m){let f=t(m);f>=0&&e.splice(f,1)}function p(m,f){f?i({type:m,callback:f}):a(m)}return{add:n,call:o,remove:p}}function mC({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 tN(e){let t=mC(e);return{get:()=>t,update:r=>{t=mC({...t,...r})}}}var iy=rN();function rN(){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 a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function nN(){return{getItem(e){return iy.getItem(e)||localStorage.getItem(e)},removeItem(e){iy.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),iy.setItem(e,t,31556952e3)}}}var gC="visitorId";function oN(){let e=document.referrer;return e===""?null:e}function sy(){let e=nN();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});cC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let m of p.events)if(!m.accepted)throw new Error(`Received event was rejected for processing: ${m.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>oN(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(gC);if(t&&ry(t))return t;let r=oy();return e.setItem(gC,r),r}}}function aN(){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 iN(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function sN(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=iN();return t&&r?{...r,runtime:"custom"}:t&&cN()&&aN()?sy():n}function cN(){try{return typeof window=="object"}catch{return!1}}function uN(e){return{get:()=>Object.freeze(sN(e))}}function vC(e){let t=tN(e),r=eN(),n=uN(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),m=Z_(o,a,i,p);return H_({config:i,environment:p,event:m,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>SC(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:hC}}d();c();l();u();function AC(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Kn="3.58.0",bC=["@coveo/atomic","@coveo/quantic"];var di=lt(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Kn}`));var lN=50,dN=xl({memoize:Kh,memoizeOptions:{maxSize:lN}}),Mc=dN(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>di(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let m=fN(p);return vC({mode:a?"emit":"disabled",url:o??Zu(e,t),token:r,trackingId:n??null,source:i,environment:m})}),pN={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},fN=e=>{if(!e)return;let t=e();return{...(AC()?sy():pN),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function $r(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function G(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{f(n.next(g))}catch(S){i(S)}}function m(g){try{f(n.throw(g))}catch(S){i(S)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})}var je;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(je||(je={}));function ly(){return typeof window<"u"}function wy(){return typeof navigator<"u"}function pi(){return typeof document<"u"}function dy(){try{return typeof localStorage<"u"}catch{return!1}}function mN(){try{return typeof sessionStorage<"u"}catch{return!1}}function OC(){return wy()&&navigator.cookieEnabled}var gN=[je.click,je.custom,je.search,je.view],hN=(e,t)=>gN.indexOf(e)!==-1?Object.assign({language:pi()?document.documentElement.lang:"unknown",userAgent:wy()?navigator.userAgent:"unknown"},t):t,fi=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),py(t,r,o,yN(window.location.hostname))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function yN(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(SN(n))return n}}function SN(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return py(t,"1",void 0,e),fi.get(t)==="1"}catch{return!1}finally{try{py(t,"",new Date(0),e)}catch{}}}function py(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function vN(){return dy()?localStorage:OC()?new jc:mN()?sessionStorage:new gi}var jc=class e{getItem(t){return fi.get(`${e.prefix}${t}`)}removeItem(t){fi.erase(`${e.prefix}${t}`)}setItem(t,r,n){fi.set(`${e.prefix}${t}`,r,n)}};jc.prefix="coveo_";var fy=class{constructor(){this.cookieStorage=new jc}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)}},gi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},_l="__coveo.analytics.history",AN=20,bN=1e3*60,CN=75,Dl=class{constructor(t){this.store=t||vN()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return G(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return G(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(_l);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return G(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(_l);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(_l,JSON.stringify(t.slice(0,AN)))}catch{}}clear(){try{this.store.removeItem(_l)}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,CN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>bN:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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 xN=(e,t)=>G(void 0,void 0,void 0,function*(){return e===je.view?(yield RN(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),RN=e=>G(void 0,void 0,void 0,function*(){let t=new Dl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),wN=/^(?:[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 ql(e){return typeof e=="string"&&wN.test(e)}function CC(e){if(!ql(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var kt=[];for(let e=0;e<256;++e)kt.push((e+256).toString(16).slice(1));function _C(e,t=0){return(kt[e[t+0]]+kt[e[t+1]]+kt[e[t+2]]+kt[e[t+3]]+"-"+kt[e[t+4]]+kt[e[t+5]]+"-"+kt[e[t+6]]+kt[e[t+7]]+"-"+kt[e[t+8]]+kt[e[t+9]]+"-"+kt[e[t+10]]+kt[e[t+11]]+kt[e[t+12]]+kt[e[t+13]]+kt[e[t+14]]+kt[e[t+15]]).toLowerCase()}var IN=new Uint8Array(16);function EN(){return crypto.getRandomValues(IN)}function FN(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var TN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",PN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function kN(e,t,r,n,o,a){let i=typeof r=="string"?FN(r):r,p=typeof n=="string"?CC(n):n;if(typeof n=="string"&&(n=CC(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+i.length);return m.set(p),m.set(i,p.length),m=t(m),m[6]=m[6]&15|e,m[8]=m[8]&63|128,_C(m)}function Yo(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():ON(e,t,r)}function ON(e,t,r){e=e||{};let n=e.random??e.rng?.()??EN();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 _C(n)}function _N(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 cy(e,t){return e<<t|e>>>32-t}function NN(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let m=new Uint32Array(16);for(let f=0;f<16;++f)m[f]=e[p*64+f*4]<<24|e[p*64+f*4+1]<<16|e[p*64+f*4+2]<<8|e[p*64+f*4+3];i[p]=m}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let m=new Uint32Array(80);for(let y=0;y<16;++y)m[y]=i[p][y];for(let y=16;y<80;++y)m[y]=cy(m[y-3]^m[y-8]^m[y-14]^m[y-16],1);let f=r[0],g=r[1],S=r[2],C=r[3],h=r[4];for(let y=0;y<80;++y){let x=Math.floor(y/20),w=cy(f,5)+_N(x,g,S,C)+h+t[x]+m[y]>>>0;h=C,C=S,S=cy(g,30)>>>0,g=f,f=w}r[0]=r[0]+f>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+S>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Ml(e,t,r,n){return kN(80,NN,e,t)}Ml.DNS=TN;Ml.URL=PN;var NC="2.33.1",xC=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Vc={pageview:"pageview",event:"event"},Vl=class{constructor({client:t,uuidGenerator:r=Yo}){this.client=t,this.uuidGenerator=r}},my=class extends Vl{constructor({client:t,uuidGenerator:r=Yo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=xC(window.location),this.lastReferrer=pi()?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:pi()?document.title:"",encoding:pi()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===Vc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Vc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Vc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Vc.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 xC(window.location)}},Xn=class e{constructor(t,r){if(!ql(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 a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return ql(a)?new e(a,Number.parseInt(o)*1e3):null}};Xn.cvo_cid="cvo_cid";Xn.expirationTime=120;var gy=class extends Vl{constructor({client:t,uuidGenerator:r=Yo}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return G(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Xn.cvo_cid,new Xn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};gy.Id="link";var vr=Object.keys;function Nl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var uy=128,DC=192,RC=224,wC=240;function DN(e){return(e&248)===wC?4:(e&wC)===RC?3:(e&RC)===DC?2:1}function qN(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&uy)!=uy)break;if(r-=3,(n&DC)!=uy){t-r>=DN(n)*3&&(r=t);break}}return e.substring(0,r)}var hy={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"},MN=vr(hy).map(e=>hy[e]),VN=[...MN].join("|"),jN=new RegExp(`^(${VN}$)`),LN={svcAction:"svc_action",svcActionData:"svc_action_data"},UN=e=>vr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=hy[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),QN=e=>jN.test(e),BN=[QN],IC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},EC={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Lt={action:"pa",list:"pal",listSource:"pls"},jl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},GN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],yy={id:"quoteId",affiliation:"quoteAffiliation"},Sy={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},$N={add:Lt,bookmark_add:Lt,bookmark_remove:Lt,click:Lt,checkout:Lt,checkout_option:Lt,detail:Lt,impression:Lt,remove:Lt,refund:Object.assign(Object.assign({},Lt),jl),purchase:Object.assign(Object.assign({},Lt),jl),quickview:Lt,quote:Object.assign(Object.assign({},Lt),yy),review:Object.assign(Object.assign({},Lt),Sy)},HN=vr(IC).map(e=>IC[e]),zN=vr(EC).map(e=>EC[e]),WN=vr(Lt).map(e=>Lt[e]),YN=vr(jl).map(e=>jl[e]),KN=vr(Sy).map(e=>Sy[e]),XN=vr(yy).map(e=>yy[e]),ZN=[...HN,"custom"].join("|"),JN=[...zN,"custom"].join("|"),qC="(pr[0-9]+)",MC="(il[0-9]+pi[0-9]+)",eD=new RegExp(`^${qC}(${ZN})$`),tD=new RegExp(`^(${MC}(${JN}))|(il[0-9]+nm)$`),rD=new RegExp(`^(${WN.join("|")})$`),nD=new RegExp(`^(${YN.join("|")})$`),oD=new RegExp(`^${qC}custom$`),aD=new RegExp(`^${MC}custom$`),iD=new RegExp(`^(${[...GN,...KN,...XN].join("|")})$`),sD=e=>eD.test(e),cD=e=>tD.test(e),uD=e=>rD.test(e),lD=e=>nD.test(e),dD=e=>iD.test(e),pD=[cD,sD,uD,lD,dD],fD=[oD,aD],mD={anonymizeIp:"aip"},gD={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},hD={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},yD=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],SD=Object.assign(Object.assign(Object.assign(Object.assign({},mD),gD),hD),yD.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),vy=Object.assign(Object.assign({},SD),LN),vD=e=>{let t=!!e.action&&$N[e.action]||{};return vr(e).reduce((r,n)=>{let o=t[n]||vy[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},AD=vr(vy).map(e=>vy[e]),bD=e=>AD.indexOf(e)!==-1,CD=e=>e==="custom",xD=e=>[...pD,...BN,bD,CD].some(t=>t(e)),RD=e=>vr(e).reduce((t,r)=>{let n=wD(r);return n?Object.assign(Object.assign({},t),ID(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),wD=e=>{let t;return[...fD].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},ID=(e,t)=>vr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Ay=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),m=this.encodeForEventType(t,p),f=new Blob([m],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,f)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return G(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:m}=i;o=p||t;try{a=JSON.parse(m)}catch(f){console.error("Unable to process the request body as a JSON string",f)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return G(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(a=>!!a).join("&")})}isEventTypeLegacy(t){return[je.click,je.custom,je.search,je.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}},by=class{sendEvent(t,r){return G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},FC=v.fetch,Ll=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},m=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:f}=m,g=$r(m,["url"]),S;try{S=yield FC(f,g)}catch(C){console.error("An error has occurred when sending the event.",C);return}if(S.ok){let C=yield S.json();return C.visitorId&&o.setCurrentVisitorId(C.visitorId),C}else{try{S.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield FC(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[je.click,je.custom,je.search,je.view].indexOf(t)!==-1}getVisitorIdParam(){return G(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Cy=class{constructor(t,r){dy()&&OC()?this.storage=new fy:dy()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new gi),this.client=new Ll(t),this.beaconClient=new Ay(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},xy=class{constructor(t,r){this.storage=r||new gi,this.client=new Ll(t)}getClientDependingOnEventType(t){return this.client}},Ul=class{constructor(){this.storage=new gi,this.client=new by}getClientDependingOnEventType(t){return this.client}},ED="xx",FD=e=>e?.startsWith(ED)||!1,TD=`
27
+ `;return new Mo(r)}var Mo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},De=class{constructor(e){le(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 _O(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}},Ke=class{constructor(e={}){le(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ee(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 Yi(e){return e===void 0}function NO(e){return e===null}function ee(e){return Yi(e)||NO(e)}var de=class{constructor(e={}){le(this,"value");this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t||(DO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function DO(e){return Yi(e)||Uu(e)}function Uu(e){return typeof e=="boolean"}var oe=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t||(qO(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 qO(e){return Yi(e)||RA(e)}function RA(e){return typeof e=="number"&&!Number.isNaN(e)}var MO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,B=class{constructor(e={}){le(this,"value");le(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Ke(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(Yi(e))return null;if(!Ki(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&&!(MO.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 Ki(e){return Object.prototype.toString.call(e)==="[object String]"}var W=class{constructor(e={}){le(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Yi(e))return this.config.options.required?"value is required and is currently undefined":null;if(!wA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ee(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 wA(e){return e!==void 0&&typeof e=="object"}var ie=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new Ke(this.config)}validate(e){if(!ee(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ee(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&&ee(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 Uu(e)||Ki(e)||RA(e)||wA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Xi(e){return Array.isArray(e)}var cc=class{constructor(e){le(this,"config");le(this,"value");this.config=e,this.value=new Ke(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Yi(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}};d();c();l();u();var Qu=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Bu(e){return Array.isArray(e)}function Gu(e){return e.trim()===""}function IA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function VO(e){return btoa(encodeURI(e))}function $u(e,t){let{[e]:r,...n}=t;return n}function Zi(e){return VO(JSON.stringify(e))}var jO=new Set(["1",1,"yes",!0]);function nh(){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=>jO.has(r))}function EA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function FA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function uc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Hu(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 LO(e){if(Gu(e.openingDelimiter)||Gu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ee(e.content)||Gu(e.content))return e.content;if(e.highlights.length===0)return Ji(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,p=a+i.length;if(p>t)break;r+=Ji(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Ji(e.content.slice(a,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Ji(e.content.slice(n))),r}function ih(e,t){return e=Ji(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?oh(n,t.notMatchDelimiters):o?oh(o,t.exactMatchDelimiters):i?oh(i,t.correctionDelimiters):r)}function oh(e,t){return t?t.open+e+t.close:e}function Ji(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}d();c();l();u();var LA=Pr(qA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),ea=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."}},jo=class extends Error{constructor(r,n){super();le(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function MA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function VA(e){return typeof e!="object"||!e?!1:Object.values(e).every(p0)}function p0(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function jA(e){return e===429}var Ur=class e{static call(t){return _asyncToGenerator(function*(){let r=f0(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let m=yield A(i,a);if(jA(m.status))throw m;return m});return function p(){return _ref.apply(this,arguments)}}();try{let m=yield(0,LA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(f){let g=f&&jA(f.status);return g&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(m.status){case 419:case 401:throw n.info("Platform renewing token"),new ea;case 404:throw new jo(i,m.status);default:return n.info({response:m,requestInfo:o},"Platform response"),m}}catch(m){return m.message==="Failed to fetch"?new jo(i):m}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:p,...m}=t,f=uc(m);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 f})()}};function gt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function $n(e,t,r="prod"){return e??gt(t,r)}function Xt(e,t="prod"){return`${gt(e,t)}/rest/search/v2`}function Wu(e,t="prod"){return`${gt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function f0(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,p=e.method==="POST"||e.method==="PUT",m=m0(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(p&&{body:m}),signal:a}}function m0(e,t){return t==="application/x-www-form-urlencoded"?VA(e)?MA(e):"":JSON.stringify(e)}d();c();l();u();var pc=Pr(Yu(),1),HA=Pr(UA(),1);d();c();l();u();var Ku=Pr(Yu(),1),BA=Pr(QA(),1);Ku.default.extend(BA.default);var GA="YYYY/MM/DD@HH:mm:ss",g0="1401-01-01";function ta(e,t){let r=(0,Ku.default)(e,t);return!r.isValid()&&!t?(0,Ku.default)(e,GA):r}function Xu(e){return e.format(GA)}function $A(e,t){let r=ta(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}`)}Ch(r)}function Ch(e){if(e.isBefore(g0))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}pc.default.extend(HA.default);var zA=["past","now","next"],WA=["minute","hour","day","week","month","quarter","year"],h0=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new B({required:!t,constrainTo:WA}),period:new B({required:!0,constrainTo:zA})}};function Zu(e){if(typeof e=="string"&&!Hn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?bh(e):e;new De(h0(t.period)).validate(t);let r=KA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Ch(r)}function YA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function KA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,pc.default)().subtract(r,n);case"next":return(0,pc.default)().add(r,n);case"now":return(0,pc.default)()}}function fc(e){return Xu(KA(bh(e)))}function XA(e){return e.toLocaleLowerCase().split("-")}function Hn(e){let[t,r,n]=XA(e);if(t==="now")return!0;if(!zA.includes(t)||!WA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function ZA(e){return!!e&&typeof e=="object"&&"period"in e}function bh(e){let[t,r,n]=XA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function JA(e){return Zu(e),bh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function tC(_x3,_x4){return _tC.apply(this,arguments)}function _tC(){_tC=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _tC.apply(this,arguments)}function rC(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=S0(t,a);let p=t.length,m=0;for(;r<p;){o&&(t[r]===10&&(m=++r),o=!1);let f=-1;for(;r<p&&f===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-m);break;case 13:o=!0,f=r;break;case 10:f=r;break}if(f===-1)break;e(t.subarray(m,f),n),m=r,n=-1}m===p?t=void 0:m!==0&&(t=t.subarray(m),r-=m)}}function nC(e,t,r){let n=eC(),o=new TextDecoder;return function(a,p){if(a.length===0)r?.(n),n=eC();else if(p>0){let m=o.decode(a.subarray(0,p)),f=p+(a[p+1]===32?2:1),g=o.decode(a.subarray(f));switch(m){case"data":n.data=n.data?`${n.data}
28
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":y0(g,n,t);break}}}}function y0(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function S0(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function eC(){return{data:"",event:"",id:"",retry:void 0}}var xh="text/event-stream",v0=1e3,oC="last-event-id";function iC(){return typeof window<"u"}function Ju(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:p,fetch:m,...f}){return new Promise((g,S)=>{let b={...r};b.accept||(b.accept=xh);let h;function y(){h?.abort(),document.hidden||_()}!p&&iC()&&document.addEventListener("visibilitychange",y);let x=v0,w;function E(){iC()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{E(),g()});let k=m??A,F=n??A0;function _(){return _3.apply(this,arguments)}function _3(){_3=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let I=yield k(e,{...f,headers:b,signal:h?.signal});yield F(I),yield tC(I.body,rC(nC(O=>{O?b[oC]=O:delete b[oC]},O=>{x=O},o))),i?.(),E(),g()}catch(I){if(!h?.signal?.aborted)try{let O=a?.(I)??x;clearTimeout(w),w=setTimeout(_,O)}catch(O){E(),S(O)}}});return _3.apply(this,arguments)}_()})}function A0(e){let t=e.headers.get("content-type");if(!t?.startsWith(xh))throw new Error(`Expected content-type to be ${xh}, Actual: ${t}`)}d();c();l();u();var zn=class{constructor(t){le(this,"_basePath");le(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}};var C0=(e,t,r)=>new zn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,aC=3,b0=5e3,x0="text/event-stream",Ih=1,Rh=class extends Error{},mc=class extends Error{constructor(r){super(r.message);le(this,"payload",r)}},wh=class{constructor(){le(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},el=class{constructor(t){le(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:i,accessToken:a}=t,{write:p,abort:m,close:f,resetAnswer:g}=r,S=new wh;if(!i){this.logger.error("No stream ID found");return}let b=0,h,y=()=>{h&&!S.isActive(h)&&(w?.abort(),g(),E())},x=()=>{S.remove(h),h=FA(y,h,b0),S.add(h)},w=new s.AbortController,E=()=>Ju(C0(n,o,i),{method:"GET",fetch:A,headers:{Authorization:`Bearer ${a}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(k){return _asyncToGenerator(function*(){if(k.ok&&k.headers.get("content-type")===x0)return;throw k.status>=400&&k.status<500&&k.status!==429?new mc({message:"Error opening stream",code:k.status}):new Rh})()},onmessage:k=>{if(w?.signal.aborted)return;let F=JSON.parse(k.data);if(F.finishReason==="ERROR"){S.remove(h),w?.abort(),m({message:F.errorMessage,code:F.statusCode});return}p(F),b=0,F.finishReason==="COMPLETED"?(S.remove(h),f()):x()},onerror:k=>{if(!w?.signal.aborted){if(S.remove(h),k instanceof mc)throw w?.abort(),m(k),k;if(++b>aC){this.logger.info("Maximum retry exceeded.");let F={message:"Failed to complete stream.",code:Ih};throw w?.abort(),m(F),new mc(F)}this.logger.info(`Retrying...(${b}/${aC})`),g()}}});return E(),w}};d();c();l();u();var tl=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function gc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Eh=e=>{let{response:t}=e;return t.body?R0(e):w0(t)},R0=e=>E0(e)?F0(e):I0(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},w0=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function I0(e){return e.body.statusCode!==void 0}function E0(e){return e.body.exception!==void 0}var F0=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function sC(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Fh=(e,t,r,n)=>{let o=new zn(`${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 cC=(e,t)=>{let r=new zn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},Th=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Ur.call({...Fh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:gc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=sC(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return T0(a)?{success:a}:{error:Eh({response:r,body:a})}});return function Th(_x5,_x6){return _ref3.apply(this,arguments)}}();function T0(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function ra(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function xt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:ra(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:ra(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function P0(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function k0(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function na(e,t){if(t&&e.name==="AbortError")return{error:k0(e)};if(e instanceof jo)return{error:P0(e)};throw e}var Wn=e=>e.success!==void 0,Xe=e=>e.error!==void 0;function uC(e){return e.results!==void 0}function lC(e){let t=ra();return ee(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var Ph=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,O0=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,hc=(e,t,r,n)=>{_0(e);let o=Ph(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},dC=(e,t,r)=>{N0(e);let n=O0(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},kh=e=>{let{insightId:t,...r}=gc(e);return r},pC=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},_0=e=>{if(pC(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},N0=e=>{if(pC(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var fC=e=>({...hc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var mC=e=>({...hc(e,"POST","application/json","/search"),requestParams:kh(e)}),gC=e=>({...hc(e,"POST","application/json","/querysuggest"),requestParams:kh(e)});d();c();l();u();var hC=e=>({...dC(e,"POST","application/json"),requestParams:{objectId:e.userId}});var rl=class{constructor(t){le(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield Ur.call({...fC(t),..._this.options});if(r instanceof Error)return na(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield Ur.call({...mC(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return na(n);let o=yield n.json();return uC(o)&&(o=lC(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Ur.call({...gC(t),..._this3.options});if(r instanceof Error)return na(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield Ur.call({...hC(t),..._this4.options});if(r instanceof Error)return na(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return Th(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new B({required:!0,emptyAllowed:!1}),Ze=new B({required:!1,emptyAllowed:!1}),Je=new B({required:!0,emptyAllowed:!0}),aW=new B({required:!1,emptyAllowed:!0}),nl=new ie({each:H,required:!0}),yC=new B({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),SC=new B({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),sW=new B({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),kr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),yr=(e,t)=>{if("required"in t)return{payload:new De({value:t}).validate({value:e}).value};let o=new W({options:{required:!0},values:t}).validate(e);if(o)throw new Mo(o);return{payload:e}},q=(e,t)=>{try{return yr(e,t)}catch(r){return{payload:e,error:kr(r)}}},Sr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return vC(e,t,r,o,"Controller initialization error")},yt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return vC(e,t,r,o,"Controller initialization error")},vC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};d();c();l();u();d();c();l();u();d();c();l();u();function Ft(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 D0=typeof Symbol=="function"&&Symbol.observable||"@@observable",AC=D0,Oh=()=>Math.random().toString(36).substring(7).split("").join("."),q0={INIT:`@@redux/INIT${Oh()}`,REPLACE:`@@redux/REPLACE${Oh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Oh()}`},ol=q0;function Qr(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 _h(e,t,r){if(typeof e!="function")throw new Error(Ft(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ft(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ft(1));return r(_h)(e,t)}let n=e,o=t,i=new Map,a=i,p=0,m=!1;function f(){a===i&&(a=new Map,i.forEach((w,E)=>{a.set(E,w)}))}function g(){if(m)throw new Error(Ft(3));return o}function S(w){if(typeof w!="function")throw new Error(Ft(4));if(m)throw new Error(Ft(5));let E=!0;f();let k=p++;return a.set(k,w),function(){if(E){if(m)throw new Error(Ft(6));E=!1,f(),a.delete(k),i=null}}}function b(w){if(!Qr(w))throw new Error(Ft(7));if(typeof w.type>"u")throw new Error(Ft(8));if(typeof w.type!="string")throw new Error(Ft(17));if(m)throw new Error(Ft(9));try{m=!0,o=n(o,w)}finally{m=!1}return(i=a).forEach(k=>{k()}),w}function h(w){if(typeof w!="function")throw new Error(Ft(10));n=w,b({type:ol.REPLACE})}function y(){let w=S;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ft(11));function k(){let _=E;_.next&&_.next(g())}return k(),{unsubscribe:w(k)}},[AC](){return this}}}return b({type:ol.INIT}),{dispatch:b,subscribe:S,getState:g,replaceReducer:h,[AC]:y}}function M0(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ol.INIT})>"u")throw new Error(Ft(12));if(typeof r(void 0,{type:ol.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ft(13))})}function Lo(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let p=t[a];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,i;try{M0(r)}catch(a){i=a}return function(p={},m){if(i)throw i;let f=!1,g={};for(let S=0;S<n.length;S++){let b=n[S],h=r[b],y=p[b],x=h(y,m);if(typeof x>"u"){let w=m&&m.type;throw new Error(Ft(14))}g[b]=x,f=f||x!==y}return f=f||n.length!==Object.keys(p).length,f?g:p}}function yc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function CC(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ft(15))},a={getState:o.getState,dispatch:(m,...f)=>i(m,...f)},p=e.map(m=>m(a));return i=yc(...p)(o.dispatch),{...o,dispatch:i}}}function Sc(e){return Qr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Qh=Symbol.for("immer-nothing"),vc=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state");function Tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var cr=Object,Qo=cr.getPrototypeOf,Ac="constructor",wc="prototype",qh="configurable",cl="enumerable",al="writable",Cc="value",Wt=e=>!!e&&!!e[vt];function jt(e){return e?TC(e)||Ec(e)||!!e[vc]||!!e[Ac]?.[vc]||Fc(e)||aa(e):!1}var V0=cr[wc][Ac].toString(),bC=new WeakMap;function TC(e){if(!e||!ia(e))return!1;let t=Qo(e);if(t===null||t===cr[wc])return!0;let r=cr.hasOwnProperty.call(t,Ac)&&t[Ac];if(r===Object)return!0;if(!Uo(r))return!1;let n=bC.get(r);return n===void 0&&(n=Function.toString.call(r),bC.set(r,n)),n===V0}function Bh(e){return Wt(e)||Tt(15,e),e[vt].base_}function Ic(e,t,r=!0){Bo(e)===0?(r?Reflect.ownKeys(e):cr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Bo(e){let t=e[vt];return t?t.type_:Ec(e)?1:Fc(e)?2:aa(e)?3:0}var oa=(e,t,r=Bo(e))=>r===2?e.has(t):cr[wc].hasOwnProperty.call(e,t),Fn=(e,t,r=Bo(e))=>r===2?e.get(t):e[t],ul=(e,t,r,n=Bo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function j0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ec=Array.isArray,Fc=e=>e instanceof Map,aa=e=>e instanceof Set,ia=e=>typeof e=="object",Uo=e=>typeof e=="function",Nh=e=>typeof e=="boolean";function L0(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var U0=e=>ia(e)?e?.[vt]:null,Tn=e=>e.copy_||e.base_;var Gh=e=>e.modified_?e.copy_:e.base_;function Mh(e,t){if(Fc(e))return new Map(e);if(aa(e))return new Set(e);if(Ec(e))return Array[wc].slice.call(e);let r=TC(e);if(t===!0||t==="class_only"&&!r){let n=cr.getOwnPropertyDescriptors(e);delete n[vt];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],p=n[a];p[al]===!1&&(p[al]=!0,p[qh]=!0),(p.get||p.set)&&(n[a]={[qh]:!0,[al]:!0,[cl]:p[cl],[Cc]:e[a]})}return cr.create(Qo(e),n)}else{let n=Qo(e);if(n!==null&&r)return{...e};let o=cr.create(n);return cr.assign(o,e)}}function gl(e,t=!1){return hl(e)||Wt(e)||!jt(e)||(Bo(e)>1&&cr.defineProperties(e,{set:il,add:il,clear:il,delete:il}),cr.freeze(e),t&&Ic(e,(r,n)=>{gl(n,!0)},!1)),e}function Q0(){Tt(2)}var il={[Cc]:Q0};function hl(e){return e===null||!ia(e)?!0:cr.isFrozen(e)}var ll="MapSet",dl="Patches",xC="ArrayMethods",pl={};function Go(e){let t=pl[e];return t||Tt(0,e),t}var RC=e=>!!pl[e];function B0(e,t){pl[e]||(pl[e]=t)}var bc,PC=()=>bc,G0=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:RC(ll)?Go(ll):void 0,arrayMethodsPlugin_:RC(xC)?Go(xC):void 0});function wC(e,t){t&&(e.patchPlugin_=Go(dl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Vh(e){jh(e),e.drafts_.forEach($0),e.drafts_=null}function jh(e){e===bc&&(bc=e.parent_)}var IC=e=>bc=G0(bc,e);function $0(e){let t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function EC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[vt].modified_&&(Vh(t),Tt(4)),jt(e)&&(e=FC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[vt].base_,e,t)}else e=FC(t,r);return H0(t,e,!0),Vh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Qh?e:void 0}function FC(e,t){if(hl(t))return t;let r=t[vt];if(!r)return fl(t,e.handledSet_,e);if(!yl(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);_C(r,e)}return r.copy_}function H0(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&gl(t,r)}function kC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var yl=(e,t)=>e.scope_===t,z0=[];function OC(e,t,r,n){let o=Tn(e),i=e.type_;if(n!==void 0&&Fn(o,n,i)===t){ul(o,n,r,i);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Ic(o,(m,f)=>{if(Wt(f)){let g=p.get(f)||[];g.push(m),p.set(f,g)}})}let a=e.draftLocations_.get(t)??z0;for(let p of a)ul(o,p,r,i)}function W0(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!yl(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Gh(i);OC(e,i.draft_??i,a,r),_C(i,o)})}function _C(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)}kC(e)}}function Y0(e,t,r){let{scope_:n}=e;if(Wt(r)){let o=r[vt];yl(o,n)&&o.callbacks_.push(function(){sl(e);let a=Gh(o);OC(e,r,a,t)})}else jt(r)&&e.callbacks_.push(function(){let i=Tn(e);e.type_===3?i.has(r)&&fl(r,n.handledSet_,n):Fn(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&fl(Fn(e.copy_,t,e.type_),n.handledSet_,n)})}function fl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Wt(e)||t.has(e)||!jt(e)||hl(e)||(t.add(e),Ic(e,(n,o)=>{if(Wt(o)){let i=o[vt];if(yl(i,r)){let a=Gh(i);ul(e,n,a,e.type_),kC(i)}}else jt(o)&&fl(o,t,r)})),e}function K0(e,t){let r=Ec(e),n={type_:r?1:0,scope_:t?t.scope_:PC(),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=ml;r&&(o=[n],i=xc);let{revoke:a,proxy:p}=Proxy.revocable(o,i);return n.draft_=p,n.revoke_=a,[p,n]}var ml={get(e,t){if(t===vt)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=Tn(e);if(!oa(o,t,e.type_))return Z0(e,o,t);let i=o[t];if(e.finalized_||!jt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&L0(t))return i;if(i===Dh(e.base_,t)||X0(e,t,i)){sl(e);let a=e.type_===1?+t:t,p=Uh(e.scope_,i,e,a);return e.copy_[a]=p}return i},has(e,t){return t in Tn(e)},ownKeys(e){return Reflect.ownKeys(Tn(e))},set(e,t,r){let n=NC(Tn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Dh(Tn(e),t),i=o?.[vt];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if(j0(r,o)&&(r!==void 0||oa(e.base_,t,e.type_)))return!0;sl(e),Lh(e)}return e.copy_[t]===r&&(r!==void 0||oa(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Y0(e,t,r)),!0},deleteProperty(e,t){return sl(e),Dh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Lh(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Tn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[al]:!0,[qh]:e.type_!==1||t!=="length",[cl]:n[cl],[Cc]:r[t]}},defineProperty(){Tt(11)},getPrototypeOf(e){return Qo(e.base_)},setPrototypeOf(){Tt(12)}},xc={};for(let e in ml){let t=ml[e];xc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}xc.deleteProperty=function(e,t){return xc.set.call(this,e,t,void 0)};xc.set=function(e,t,r){return ml.set.call(this,e[0],t,r,e[0])};function Dh(e,t){let r=e[vt];return(r?Tn(r):e)[t]}function X0(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jt(r)||r[vt]?!1:e.baseRefs_.has(r)}function Z0(e,t,r){let n=NC(t,r);return n?Cc in n?n[Cc]:n.get?.call(e.draft_):void 0}function NC(e,t){if(!(t in e))return;let r=Qo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Qo(r)}}function Lh(e){e.modified_||(e.modified_=!0,e.parent_&&Lh(e.parent_))}function sl(e){e.copy_||(e.assigned_=new Map,e.copy_=Mh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var J0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Uo(t)&&!Uo(r)){let i=r;r=t;let a=this;return function(m=i,...f){return a.produce(m,g=>r.call(this,g,...f))}}Uo(r)||Tt(6),n!==void 0&&!Uo(n)&&Tt(7);let o;if(jt(t)){let i=IC(this),a=Uh(i,t,void 0),p=!0;try{o=r(a),p=!1}finally{p?Vh(i):jh(i)}return wC(i,n),EC(o,i)}else if(!t||!ia(t)){if(o=r(t),o===void 0&&(o=t),o===Qh&&(o=void 0),this.autoFreeze_&&gl(o,!0),n){let i=[],a=[];Go(dl).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else Tt(1,t)},this.produceWithPatches=(t,r)=>{if(Uo(t))return(a,...p)=>this.produceWithPatches(a,m=>t(m,...p));let n,o;return[this.produce(t,r,(a,p)=>{n=a,o=p}),n,o]},Nh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Nh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Nh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jt(e)||Tt(8),Wt(e)&&(e=Sl(e));let t=IC(this),r=Uh(t,e,void 0);return r[vt].isManual_=!0,jh(t),r}finishDraft(e,t){let r=e&&e[vt];(!r||!r.isManual_)&&Tt(9);let{scope_:n}=r;return wC(n,t),EC(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=Go(dl).applyPatches_;return Wt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Uh(e,t,r,n){let[o,i]=Fc(t)?Go(ll).proxyMap_(t,r):aa(t)?Go(ll).proxySet_(t,r):K0(t,r);return(r?.scope_??PC()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?W0(r,i,n):i.callbacks_.push(function(m){m.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:f}=m;i.modified_&&f&&f.generatePatches_(i,[],m)}),o}function Sl(e){return Wt(e)||Tt(10,e),DC(e)}function DC(e){if(!jt(e)||hl(e))return e;let t=e[vt],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Mh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Mh(e,!0);let o=r;return aa(r)&&(r=new Set),Ic(o,(i,a)=>{ul(r,i,DC(a))},n),t&&(t.finalized_=!1),r}function qC(){function t(y,x=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,E=U0(Fn(w,y.key_)),k=Fn(w,y.key_);if(k===void 0||k!==y.draft_&&k!==y.base_&&k!==y.copy_||E!=null&&E.base_!==y.base_)return null;let F=y.parent_.type_===3,_;if(F){let I=y.parent_;_=Array.from(I.drafts_.keys()).indexOf(y.key_)}else _=y.key_;if(!(F&&w.size>_||oa(w,_))||y.parent_.type_===1&&y.parent_.allIndicesReassigned_)return null;x.push(_)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let w=y;for(let E=0;E<x.length-1;E++){let k=x[E];if(w=Fn(w,k),!ia(w)||w===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return w}let n="replace",o="add",i="remove";function a(y,x,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:k}=w;switch(y.type_){case 0:case 2:return m(y,x,E,k);case 1:return p(y,x,E,k);case 3:return f(y,x,E,k)}}function p(y,x,w,E){let{base_:k,assigned_:F}=y,_=y.copy_;_.length<k.length&&([k,_]=[_,k],[w,E]=[E,w]);let I=y.allIndicesReassigned_===!0;for(let O=0;O<k.length;O++){let P=_[O],T=k[O];if((I||F?.get(O.toString()))&&P!==T){let G=P?.[vt];if(G&&G.modified_)continue;let j=x.concat([O]);w.push({op:n,path:j,value:h(P)}),E.push({op:n,path:j,value:h(T)})}}for(let O=k.length;O<_.length;O++){let P=x.concat([O]);w.push({op:o,path:P,value:h(_[O])})}for(let O=_.length-1;k.length<=O;--O){let P=x.concat([O]);E.push({op:i,path:P})}}function m(y,x,w,E){let{base_:k,copy_:F,type_:_}=y;Ic(y.assigned_,(I,O)=>{let P=Fn(k,I,_),T=Fn(F,I,_),V=O?oa(k,I)?n:o:i;if(P===T&&V===n)return;let G=x.concat(I);w.push(V===i?{op:V,path:G}:{op:V,path:G,value:h(T)}),E.push(V===o?{op:i,path:G}:V===i?{op:o,path:G,value:h(P)}:{op:n,path:G,value:h(P)})})}function f(y,x,w,E){let{base_:k,copy_:F}=y,_=0;k.forEach(I=>{if(!F.has(I)){let O=x.concat([_]);w.push({op:i,path:O,value:I}),E.unshift({op:o,path:O,value:I})}_++}),_=0,F.forEach(I=>{if(!k.has(I)){let O=x.concat([_]);w.push({op:o,path:O,value:I}),E.unshift({op:i,path:O,value:I})}_++})}function g(y,x,w){let{patches_:E,inversePatches_:k}=w;E.push({op:n,path:[],value:x===Qh?void 0:x}),k.push({op:n,path:[],value:y})}function S(y,x){return x.forEach(w=>{let{path:E,op:k}=w,F=y;for(let P=0;P<E.length-1;P++){let T=Bo(F),V=E[P];typeof V!="string"&&typeof V!="number"&&(V=""+V),(T===0||T===1)&&(V==="__proto__"||V===Ac)&&Tt(19),Uo(F)&&V===wc&&Tt(19),F=Fn(F,V),(F===null||!ia(F))&&Tt(18,E.join("/"))}let _=Bo(F),I=b(w.value),O=E[E.length-1];switch(k){case n:switch(_){case 2:return F.set(O,I);case 3:Tt(16);default:return F[O]=I}case o:switch(_){case 1:return O==="-"?F.push(I):F.splice(O,0,I);case 2:return F.set(O,I);case 3:return F.add(I);default:return F[O]=I}case i:switch(_){case 1:return F.splice(O,1);case 2:return F.delete(O);case 3:return F.delete(w.value);default:return delete F[O]}default:Tt(17,k)}}),y}function b(y){if(!jt(y))return y;if(Ec(y))return y.map(b);if(Fc(y))return new Map(Array.from(y.entries()).map(([w,E])=>[w,b(E)]));if(aa(y))return new Set(Array.from(y).map(b));let x=Object.create(Qo(y));for(let w in y)x[w]=b(y[w]);return oa(y,vc)&&(x[vc]=y[vc]),x}function h(y){return Wt(y)?b(y):y}B0(dl,{applyPatches_:S,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var e_=v.Iterator,SW=typeof e_?.from=="function";var Rc=new J0,$o=Rc.produce,$h=Rc.produceWithPatches.bind(Rc);var Hh=Rc.applyPatches.bind(Rc);d();c();l();u();var t_=class{constructor(e){this.value=e}deref(){return this.value}},r_=()=>typeof WeakRef>"u"?t_:WeakRef,VC=r_(),n_=0,vl=1;function Tc(){return{s:n_,v:void 0,o:null,p:null}}function o_(e){return e instanceof VC?e.deref():e}function sa(e,t={}){let r=Tc(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,p=0,m,f=0,g=!1;function S(){p>=o&&(a=r,r=Tc(),p=0)}function b(){let h=r,{length:y}=arguments;for(let E=0,k=y;E<k;E++){let F=arguments[E];if(typeof F=="function"||typeof F=="object"&&F!==null){let _=h.o;_===null&&(h.o=_=new WeakMap);let I=_.get(F);I===void 0?(h=Tc(),_.set(F,h)):h=I}else{let _=h.p;_===null&&(h.p=_=new Map);let I=_.get(F);I===void 0?(h=Tc(),_.set(F,h),p++):h=I}}if(h.s===vl)return h.v;if(a!==null){let E=a;for(let k=0,F=y;k<F;k++){let _=arguments[k],I;if(typeof _=="function"||typeof _=="object"&&_!==null){let O=E.o;I=O!==null?O.get(_):void 0}else{let O=E.p;I=O!==null?O.get(_):void 0}if(I===void 0){E=null;break}E=I}if(E!==null&&E.s===vl){let k=h;return k.s=vl,k.v=E.v,S(),E.v}}let x=h,w=e.apply(null,arguments);if(f++,n){let E=o_(m);E!=null&&n(E,w)&&(w=E,f!==0&&f--),m=typeof w=="object"&&w!==null||typeof w=="function"?new VC(w):w}return x.s=vl,x.v=w,i&&S(),w}return b.clearCache=()=>{r=Tc(),a=null,p=0,b.resetResultsCount()},b.resultsCount=()=>f,b.resetResultsCount=()=>{f=0},b}var zh=Symbol("NOT_FOUND");function i_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function a_(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 MC=e=>Array.isArray(e)?e:[e];function s_(e){let t=Array.isArray(e[0])?e[0]:e;return a_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Al(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,p,m={},f=o.pop();typeof f=="object"&&(m=f,f=o.pop()),i_(f,`createSelector expects an output function after the inputs, but received: [${typeof f}]`);let g={...r,...m},{memoize:S,memoizeOptions:b=[],argsMemoize:h=sa,argsMemoizeOptions:y=[]}=g,x=MC(b),w=MC(y),E=s_(o),k=S(function(){return i++,f.apply(null,arguments)},...x),F=!0,_=h(function(){a++;let{length:O}=E,P=new Array(O);for(let T=0;T<O;T++)P[T]=E[T].apply(null,arguments);return p=k.apply(null,P),p},...w);return Object.assign(_,{resultFunc:f,memoizedResultFunc:k,dependencies:E,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>p,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:S,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var lt=Al(sa);function c_(e){let t;return{get(r){return t&&e(t.key,r)?t.value:zh},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function u_(e,t){let r=[];function n(p){let m=r.findIndex(f=>t(f.key,p));if(m>-1){let f=r[m];return m>0&&(r.splice(m,1),r.unshift(f)),f.value}return zh}function o(p,m){r.unshift({key:p,value:m}),r.length>e&&r.pop()}function i(p,m){let f=r,{length:g}=f;for(let S=0;S<g;S++){let b=f[S];if(m(b.value,p))return b}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var l_=(e,t)=>e===t;function d_(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let i=0;i<o;i++)if(!e(r[i],n[i]))return!1;return!0}}function Wh(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=l_,maxSize:o=1,resultEqualityCheck:i}=r,a=d_(n),p=0,m=o<=1?c_(a):u_(o,a);function f(){let g=m.get(arguments);if(g===zh){if(g=e.apply(null,arguments),p++,i){let S=m.findMatchingEntry(g,i);S&&(g=S.value,p!==0&&p--)}m.put(arguments,g)}return g}return f.clearCache=()=>{m.clear(),f.resetResultsCount()},f.resultsCount=()=>p,f.resetResultsCount=()=>{p=0},f}d();c();l();u();function jC(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var LC=jC(),UC=jC;var p_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?yc:yc.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var f_=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(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=>Sc(n)&&n.type===e,r}var YC=class Pc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Pc.prototype)}static get[Symbol.species](){return Pc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Pc(...t[0].concat(this)):new Pc(...t.concat(this))}};function QC(e){return jt(e)?$o(e,()=>{}):e}function Cl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function m_(e){return typeof e=="boolean"}var g_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new YC;return r&&(m_(r)?a.push(LC):a.push(UC(r.extraArgument))),a},kc="RTK_autoBatch",la=()=>e=>({payload:e,meta:{[kc]:!0}}),BC=e=>t=>{setTimeout(t,e)},h_=(e,t)=>r=>{let n=!1,o,i,a=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(i),r())};o=e(a),i=setTimeout(a,t)},y_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,p=new Set,m=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?h_(window.requestAnimationFrame,100):BC(10):e.type==="callback"?e.queueNotification:BC(e.timeout),f=()=>{a=!1,i&&(i=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let S=()=>o&&g(),b=n.subscribe(S);return p.add(g),()=>{b(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[kc],i=!o,i&&(a||(a=!0,m(f))),n.dispatch(g)}finally{o=!0}}})},S_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new YC(e);return n&&o.push(y_(typeof n=="object"?n:void 0)),o};function KC(e){let t=g_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:p=void 0}=e||{},m;if(typeof r=="function")m=r;else if(Qr(r))m=Lo(r);else throw new Error(Lt(1));let f;typeof n=="function"?f=n(t):f=t();let g=yc;o&&(g=p_({trace:!1,...(typeof o=="object"&&o)}));let S=CC(...f),b=S_(S),h=typeof p=="function"?p(b):b(),y=g(...h);return _h(m,a,y)}function XC(e){let t={},r=[],n,o={addCase(i,a){let p=typeof i=="string"?i:i.type;if(!p)throw new Error(Lt(28));if(p in t)throw new Error(Lt(29));return t[p]=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 v_(e){return typeof e=="function"}function pe(e,t){let[r,n,o]=XC(t),i;if(v_(e))i=()=>QC(e());else{let p=QC(e);i=()=>p}function a(p=i(),m){let f=[r[m.type],...n.filter(({matcher:g})=>g(m)).map(({reducer:g})=>g)];return f.filter(g=>!!g).length===0&&(f=[o]),f.reduce((g,S)=>{if(S)if(Wt(g)){let b=S(g,m);return b===void 0?g:b}else{if(jt(g))return $o(g,b=>S(b,m));{let b=S(g,m);if(b===void 0){if(g===null)return g;throw new Error(Lt(9))}return b}}return g},p)}return a.getInitialState=i,a}var ZC=(e,t)=>f_(e)?e.match(t):e(t);function Br(...e){return t=>e.some(r=>ZC(r,t))}function ua(...e){return t=>e.every(r=>ZC(r,t))}function wl(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 Oc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Il(...e){return e.length===0?t=>wl(t,["pending"]):Oc(e)?Br(...e.map(t=>t.pending)):Il()(e[0])}function zo(...e){return e.length===0?t=>wl(t,["rejected"]):Oc(e)?Br(...e.map(t=>t.rejected)):zo()(e[0])}function _c(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ua(zo(...e),t):Oc(e)?ua(zo(...e),t):_c()(e[0])}function Pn(...e){return e.length===0?t=>wl(t,["fulfilled"]):Oc(e)?Br(...e.map(t=>t.fulfilled)):Pn()(e[0])}function El(...e){return e.length===0?t=>wl(t,["pending","fulfilled","rejected"]):Oc(e)?Br(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):El()(e[0])}var A_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Nc=(e=21)=>{let t="",r=e;for(;r--;)t+=A_[Math.random()*64|0];return t},C_=["name","message","stack","code"],Yh=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},GC=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},b_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of C_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},$C="External signal was aborted",fe=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(m,f,g,S)=>({payload:m,meta:{...(S||{}),arg:g,requestId:f,requestStatus:"fulfilled"}})),i=N(t+"/pending",(m,f,g)=>({payload:void 0,meta:{...(g||{}),arg:f,requestId:m,requestStatus:"pending"}})),a=N(t+"/rejected",(m,f,g,S,b)=>({payload:S,error:(n&&n.serializeError||b_)(m||"Rejected"),meta:{...(b||{}),arg:g,requestId:f,rejectedWithValue:S!==void 0,requestStatus:"rejected",aborted:m?.name==="AbortError",condition:m?.name==="ConditionError"}}));function p(m,{signal:f}={}){return(g,S,b)=>{let h=n?.idGenerator?n.idGenerator(m):Nc(),y=new s.AbortController,x,w;function E(F){w=F,y.abort()}f&&(f.aborted?E($C):f.addEventListener("abort",()=>E($C),{once:!0}));let k=_asyncToGenerator(function*(){let F;try{let _=n?.condition?.(m,{getState:S,extra:b});if(R_(_)&&(_=yield _),_===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(y.signal.aborted)throw{name:"AbortError",message:w||"Aborted"};let I=new Promise((O,P)=>{x=()=>{P({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});g(i(h,m,n?.getPendingMeta?.({requestId:h,arg:m},{getState:S,extra:b}))),F=yield Promise.race([I,Promise.resolve(r(m,{dispatch:g,getState:S,extra:b,requestId:h,signal:y.signal,abort:E,rejectWithValue:(O,P)=>new Yh(O,P),fulfillWithValue:(O,P)=>new GC(O,P)})).then(O=>{if(O instanceof Yh)throw O;return O instanceof GC?o(O.payload,h,m,O.meta):o(O,h,m)})])}catch(_){F=_ instanceof Yh?a(null,h,m,_.payload,_.meta):a(_,h,m)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(F)&&F.meta.condition||g(F),F})();return Object.assign(k,{abort:E,requestId:h,arg:m,unwrap(){return k.then(x_)}})}}return Object.assign(p,{pending:i,rejected:a,fulfilled:o,settled:Br(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function x_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function R_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var JC=Symbol.for("rtk-slice-createasyncthunk"),LW={[JC]:fe};function w_(e,t){return`${e}/${t}`}function I_({creators:e}={}){let t=e?.asyncThunk?.[JC];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(F_()):n.reducers)||{},p=Object.keys(a),m={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(F,_){let I=typeof F=="string"?F:F.type;if(!I)throw new Error(Lt(12));if(I in m.sliceCaseReducersByType)throw new Error(Lt(13));return m.sliceCaseReducersByType[I]=_,f},addMatcher(F,_){return m.sliceMatchers.push({matcher:F,reducer:_}),f},exposeAction(F,_){return m.actionCreators[F]=_,f},exposeCaseReducer(F,_){return m.sliceCaseReducersByName[F]=_,f}};p.forEach(F=>{let _=a[F],I={reducerName:F,type:w_(o,F),createNotation:typeof n.reducers=="function"};P_(_)?O_(I,_,f,t):T_(I,_,f)});function g(){let[F={},_=[],I=void 0]=typeof n.extraReducers=="function"?XC(n.extraReducers):[n.extraReducers],O={...F,...m.sliceCaseReducersByType};return pe(n.initialState,P=>{for(let T in O)P.addCase(T,O[T]);for(let T of m.sliceMatchers)P.addMatcher(T.matcher,T.reducer);for(let T of _)P.addMatcher(T.matcher,T.reducer);I&&P.addDefaultCase(I)})}let S=F=>F,b=new Map,h=new WeakMap,y;function x(F,_){return y||(y=g()),y(F,_)}function w(){return y||(y=g()),y.getInitialState()}function E(F,_=!1){function I(P){let T=P[F];return typeof T>"u"&&_&&(T=Cl(h,I,w)),T}function O(P=S){return Cl(Cl(b,_,()=>new WeakMap),P,()=>{let T={};for(let[V,G]of Object.entries(n.selectors??{}))T[V]=E_(G,P,()=>Cl(h,P,w),_);return T})}return{reducerPath:F,getSelectors:O,get selectors(){return O(I)},selectSlice:I}}let k={name:o,reducer:x,actions:m.actionCreators,caseReducers:m.sliceCaseReducersByName,getInitialState:w,...E(i),injectInto(F,{reducerPath:_,...I}={}){let O=_??i;return F.inject({reducerPath:O,reducer:x},I),{...k,...E(O,!0)}}};return k}}function E_(e,t,r,n){function o(i,...a){let p=t(i);return typeof p>"u"&&n&&(p=r()),e(p,...a)}return o.unwrapped=e,o}var Wo=I_();function F_(){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 T_({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!k_(n))throw new Error(Lt(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 P_(e){return e._reducerDefinitionType==="asyncThunk"}function k_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function O_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:i,fulfilled:a,pending:p,rejected:m,settled:f,options:g}=r,S=o(e,i,g);n.exposeAction(t,S),a&&n.addCase(S.fulfilled,a),p&&n.addCase(S.pending,p),m&&n.addCase(S.rejected,m),f&&n.addMatcher(S.settled,f),n.exposeCaseReducer(t,{fulfilled:a||bl,pending:p||bl,rejected:m||bl,settled:f||bl})}function bl(){}var __="task",eb="listener",tb="completed",Zh="cancelled",N_=`task-${Zh}`,D_=`task-${tb}`,Kh=`${eb}-${Zh}`,q_=`${eb}-${tb}`,Fl=class{constructor(e){le(this,"code");le(this,"name","TaskAbortError");le(this,"message");this.code=e,this.message=`${__} ${Zh} (reason: ${e})`}},Jh=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},xl=()=>{},rb=(e,t=xl)=>(e.catch(t),e),nb=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ho=e=>{if(e.aborted)throw new Fl(e.reason)};function ob(e,t){let r=xl;return new Promise((n,o)=>{let i=()=>o(new Fl(e.reason));if(e.aborted){i();return}r=nb(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=xl})}var M_=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Fl?"cancelled":"rejected",error:r}}finally{t?.()}});return function M_(_x7,_x8){return _ref5.apply(this,arguments)}}(),Rl=e=>t=>rb(ob(e,t).then(r=>(Ho(e),r))),ib=e=>{let t=Rl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ca}=Object,HC={},Tl="listenerMiddleware",V_=(e,t)=>{let r=n=>nb(e,()=>n.abort(e.reason));return(n,o)=>{Jh(n,"taskExecutor");let i=new s.AbortController;r(i);let a=M_(/*#__PURE__*/_asyncToGenerator(function*(){Ho(e),Ho(i.signal);let p=yield n({pause:Rl(i.signal),delay:ib(i.signal),signal:i.signal});return Ho(i.signal),p}),()=>i.abort(D_));return o?.autoJoin&&t.push(a.catch(xl)),{result:Rl(e)(a),cancel(){i.abort(N_)}}}},j_=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Ho(t);let i=()=>{},a=[new Promise((p,m)=>{let f=e({predicate:n,effect:(g,S)=>{S.unsubscribe(),p([g,S.getState(),S.getOriginalState()])}});i=()=>{f(),m()}})];o!=null&&a.push(new Promise(p=>setTimeout(p,o,null)));try{let p=yield ob(t,Promise.race(a));return Ho(t),p}finally{i()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>rb(r(n,o))},ab=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(Lt(21));return Jh(i,"options.listener"),{predicate:o,type:t,effect:i}},sb=ca(e=>{let{type:t,predicate:r,effect:n}=ab(e);return{id:Nc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>sb}),zC=(e,t)=>{let{type:r,effect:n,predicate:o}=ab(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Xh=e=>{e.pending.forEach(t=>{t.abort(Kh)})},L_=(e,t)=>()=>{for(let r of t.keys())Xh(r);e.clear()},WC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},cb=ca(N(`${Tl}/add`),{withTypes:()=>cb}),U_=N(`${Tl}/removeAll`),ub=ca(N(`${Tl}/remove`),{withTypes:()=>ub}),Q_=(...e)=>{console.error(`${Tl}/error`,...e)},lb=(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=Q_}=e;Jh(a,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Xh(h)}),m=h=>{let y=zC(t,h)??sb(h);return p(y)};ca(m,{withTypes:()=>m});let f=h=>{let y=zC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Xh(y)),!!y};ca(f,{withTypes:()=>f});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,x,w){let E=new s.AbortController,k=j_(m,E.signal),F=[];try{h.pending.add(E),n(h),yield Promise.resolve(h.effect(y,ca({},x,{getOriginalState:w,condition:(_,I)=>k(_,I).then(Boolean),take:k,delay:ib(E.signal),pause:Rl(E.signal),extra:i,signal:E.signal,fork:V_(E.signal,F),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((_,I,O)=>{_!==E&&(_.abort(Kh),O.delete(_))})},cancel:()=>{E.abort(Kh),h.pending.delete(E)},throwIfCancelled:()=>{Ho(E.signal)}})))}catch(_){_ instanceof Fl||WC(a,_,{raisedBy:"effect"})}finally{yield Promise.all(F),E.abort(q_),o(h),h.pending.delete(E)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),S=L_(t,r);return{middleware:h=>y=>x=>{if(!Sc(x))return y(x);if(cb.match(x))return m(x.payload);if(U_.match(x)){S();return}if(ub.match(x))return f(x.payload);let w=h.getState(),E=()=>{if(w===HC)throw new Error(Lt(23));return w},k;try{if(k=y(x),t.size>0){let F=h.getState(),_=Array.from(t.values());for(let I of _){let O=!1;try{O=I.predicate(x,F,w)}catch(P){O=!1,WC(a,P,{raisedBy:"predicate"})}O&&g(I,x,h,E)}}}finally{w=HC}return k},startListening:m,stopListening:f,clearListeners:S}};function Lt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function db(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var pb=/^(?:[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 B_(e){return typeof e=="string"&&pb.test(e)}var ey=B_;d();c();l();u();var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function fb(e,t=0){return(Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]).toLowerCase()}d();c();l();u();var G_=new Uint8Array(16);function ty(){return crypto.getRandomValues(G_)}d();c();l();u();function $_(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():H_(e,t,r)}function H_(e,t,r){e=e||{};let n=e.random??e.rng?.()??ty();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 fb(n)}var ry=$_;function z_(_x13){return _z_.apply(this,arguments)}function _z_(){_z_=_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 _z_.apply(this,arguments)}var vb="2.1.3",ny=128,Ab=192,mb=224,gb=240,W_=248;function Y_(e){return(e&W_)===gb?4:(e&gb)===mb?3:(e&mb)===Ab?2:1}function K_(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&ny)!=ny)break;if(r-=3,(n&Ab)!=ny){t-r>=Y_(n)*3&&(r=t);break}}return e.substring(0,r)}function X_(e){let{trackingId:t}=e;return{trackingId:t}}function Z_(e){return(e.source||[]).concat([`relay@${vb}`])}function Cb(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=X_(t),p=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:Z_(t),clientId:p,userAgent:i(),referrer:hb(n()),location:hb(o())})}function hb(e){return e!==null?K_(e,1024):null}function J_(e,t,r,n){return{...t,meta:Cb(e,r,n)}}var eN="*";function tN(){let e=[];function t({type:m,callback:f}){return e.findIndex(g=>g.type===m&&g.callback===f)}function r(m,f){return m.type==="*"||f===m.type}function n(m){return t(m)<0&&e.push(m),()=>p(m.type,m.callback)}function o(m){e.forEach(f=>{if(r(f,m.meta.type))try{f.callback(m)}catch(g){console.error(g)}})}function i(m){if(m===eN)e.length=0;else for(let f=e.length-1;f>=0;f--)e[f].type===m&&e.splice(f,1)}function a(m){let f=t(m);f>=0&&e.splice(f,1)}function p(m,f){f?a({type:m,callback:f}):i(m)}return{add:n,call:o,remove:p}}function yb({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 rN(e){let t=yb(e);return{get:()=>t,update:r=>{t=yb({...t,...r})}}}var oy=nN();function nN(){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()}`,p=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function oN(){return{getItem(e){return oy.getItem(e)||localStorage.getItem(e)},removeItem(e){oy.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),oy.setItem(e,t,31556952e3)}}}var Sb="visitorId";function iN(){let e=document.referrer;return e===""?null:e}function iy(){let e=oN();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});db().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let p;try{p=yield a.json()}catch{return}for(let m of p.events)if(!m.accepted)throw new Error(`Received event was rejected for processing: ${m.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>iN(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Sb);if(t&&ey(t))return t;let r=ry();return e.setItem(Sb,r),r}}}function aN(){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 sN(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function cN(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=sN();return t&&r?{...r,runtime:"custom"}:t&&uN()&&aN()?iy():n}function uN(){try{return typeof window=="object"}catch{return!1}}function lN(e){return{get:()=>Object.freeze(cN(e))}}function bb(e){let t=rN(e),r=tN(),n=lN(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,i){let a=t.get(),p=n.get(),m=J_(o,i,a,p);return z_({config:a,environment:p,event:m,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>Cb(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:vb}}d();c();l();u();function xb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Yn="3.58.1",Rb=["@coveo/atomic","@coveo/quantic"];var da=lt(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Yn}`));var dN=50,pN=Al({memoize:Wh,memoizeOptions:{maxSize:dN}}),Dc=pN(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>da(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,p)=>{let m=mN(p);return bb({mode:i?"emit":"disabled",url:o??Wu(e,t),token:r,trackingId:n??null,source:a,environment:m})}),fN={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},mN=e=>{if(!e)return;let t=e();return{...(xb()?iy():fN),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Gr(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 p(g){try{f(n.next(g))}catch(S){a(S)}}function m(g){try{f(n.throw(g))}catch(S){a(S)}}function f(g){g.done?i(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})}var je;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(je||(je={}));function cy(){return typeof window<"u"}function xy(){return typeof navigator<"u"}function pa(){return typeof document<"u"}function uy(){try{return typeof localStorage<"u"}catch{return!1}}function gN(){try{return typeof sessionStorage<"u"}catch{return!1}}function Db(){return xy()&&navigator.cookieEnabled}var hN=[je.click,je.custom,je.search,je.view],yN=(e,t)=>hN.indexOf(e)!==-1?Object.assign({language:pa()?document.documentElement.lang:"unknown",userAgent:xy()?navigator.userAgent:"unknown"},t):t,fa=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),ly(t,r,o,SN(window.location.hostname))}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 SN(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(vN(n))return n}}function vN(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return ly(t,"1",void 0,e),fa.get(t)==="1"}catch{return!1}finally{try{ly(t,"",new Date(0),e)}catch{}}}function ly(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function AN(){return uy()?localStorage:Db()?new Mc:gN()?sessionStorage:new ga}var Mc=class e{getItem(t){return fa.get(`${e.prefix}${t}`)}removeItem(t){fa.erase(`${e.prefix}${t}`)}setItem(t,r,n){fa.set(`${e.prefix}${t}`,r,n)}};Mc.prefix="coveo_";var dy=class{constructor(){this.cookieStorage=new Mc}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)}},ga=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Pl="__coveo.analytics.history",CN=20,bN=1e3*60,xN=75,Ol=class{constructor(t){this.store=t||AN()}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(Pl);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(Pl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Pl,JSON.stringify(t.slice(0,CN)))}catch{}}clear(){try{this.store.removeItem(Pl)}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,xN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>bN:!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 RN=(e,t)=>U(void 0,void 0,void 0,function*(){return e===je.view?(yield wN(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),wN=e=>U(void 0,void 0,void 0,function*(){let t=new Ol,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),IN=/^(?:[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 _l(e){return typeof e=="string"&&IN.test(e)}function wb(e){if(!_l(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var kt=[];for(let e=0;e<256;++e)kt.push((e+256).toString(16).slice(1));function qb(e,t=0){return(kt[e[t+0]]+kt[e[t+1]]+kt[e[t+2]]+kt[e[t+3]]+"-"+kt[e[t+4]]+kt[e[t+5]]+"-"+kt[e[t+6]]+kt[e[t+7]]+"-"+kt[e[t+8]]+kt[e[t+9]]+"-"+kt[e[t+10]]+kt[e[t+11]]+kt[e[t+12]]+kt[e[t+13]]+kt[e[t+14]]+kt[e[t+15]]).toLowerCase()}var EN=new Uint8Array(16);function FN(){return crypto.getRandomValues(EN)}function TN(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var PN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",kN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function ON(e,t,r,n,o,i){let a=typeof r=="string"?TN(r):r,p=typeof n=="string"?wb(n):n;if(typeof n=="string"&&(n=wb(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+a.length);return m.set(p),m.set(a,p.length),m=t(m),m[6]=m[6]&15|e,m[8]=m[8]&63|128,qb(m)}function Yo(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():_N(e,t,r)}function _N(e,t,r){e=e||{};let n=e.random??e.rng?.()??FN();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 qb(n)}function NN(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 ay(e,t){return e<<t|e>>>32-t}function DN(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let p=0;p<i;++p){let m=new Uint32Array(16);for(let f=0;f<16;++f)m[f]=e[p*64+f*4]<<24|e[p*64+f*4+1]<<16|e[p*64+f*4+2]<<8|e[p*64+f*4+3];a[p]=m}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<i;++p){let m=new Uint32Array(80);for(let y=0;y<16;++y)m[y]=a[p][y];for(let y=16;y<80;++y)m[y]=ay(m[y-3]^m[y-8]^m[y-14]^m[y-16],1);let f=r[0],g=r[1],S=r[2],b=r[3],h=r[4];for(let y=0;y<80;++y){let x=Math.floor(y/20),w=ay(f,5)+NN(x,g,S,b)+h+t[x]+m[y]>>>0;h=b,b=S,S=ay(g,30)>>>0,g=f,f=w}r[0]=r[0]+f>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+S>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Nl(e,t,r,n){return ON(80,DN,e,t)}Nl.DNS=PN;Nl.URL=kN;var Mb="2.33.1",Ib=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,qc={pageview:"pageview",event:"event"},Dl=class{constructor({client:t,uuidGenerator:r=Yo}){this.client=t,this.uuidGenerator=r}},py=class extends Dl{constructor({client:t,uuidGenerator:r=Yo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Ib(window.location),this.lastReferrer=pa()?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:pa()?document.title:"",encoding:pa()?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===qc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===qc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===qc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===qc.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 Ib(window.location)}},Kn=class e{constructor(t,r){if(!_l(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 _l(i)?new e(i,Number.parseInt(o)*1e3):null}};Kn.cvo_cid="cvo_cid";Kn.expirationTime=120;var fy=class extends Dl{constructor({client:t,uuidGenerator:r=Yo}){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(Kn.cvo_cid,new Kn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};fy.Id="link";var Ar=Object.keys;function kl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var sy=128,Vb=192,Eb=224,Fb=240;function qN(e){return(e&248)===Fb?4:(e&Fb)===Eb?3:(e&Eb)===Vb?2:1}function MN(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&sy)!=sy)break;if(r-=3,(n&Vb)!=sy){t-r>=qN(n)*3&&(r=t);break}}return e.substring(0,r)}var my={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"},VN=Ar(my).map(e=>my[e]),jN=[...VN].join("|"),LN=new RegExp(`^(${jN}$)`),UN={svcAction:"svc_action",svcActionData:"svc_action_data"},QN=e=>Ar(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=my[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),BN=e=>LN.test(e),GN=[BN],Tb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Pb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Ut={action:"pa",list:"pal",listSource:"pls"},ql={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},$N=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],gy={id:"quoteId",affiliation:"quoteAffiliation"},hy={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},HN={add:Ut,bookmark_add:Ut,bookmark_remove:Ut,click:Ut,checkout:Ut,checkout_option:Ut,detail:Ut,impression:Ut,remove:Ut,refund:Object.assign(Object.assign({},Ut),ql),purchase:Object.assign(Object.assign({},Ut),ql),quickview:Ut,quote:Object.assign(Object.assign({},Ut),gy),review:Object.assign(Object.assign({},Ut),hy)},zN=Ar(Tb).map(e=>Tb[e]),WN=Ar(Pb).map(e=>Pb[e]),YN=Ar(Ut).map(e=>Ut[e]),KN=Ar(ql).map(e=>ql[e]),XN=Ar(hy).map(e=>hy[e]),ZN=Ar(gy).map(e=>gy[e]),JN=[...zN,"custom"].join("|"),eD=[...WN,"custom"].join("|"),jb="(pr[0-9]+)",Lb="(il[0-9]+pi[0-9]+)",tD=new RegExp(`^${jb}(${JN})$`),rD=new RegExp(`^(${Lb}(${eD}))|(il[0-9]+nm)$`),nD=new RegExp(`^(${YN.join("|")})$`),oD=new RegExp(`^(${KN.join("|")})$`),iD=new RegExp(`^${jb}custom$`),aD=new RegExp(`^${Lb}custom$`),sD=new RegExp(`^(${[...$N,...XN,...ZN].join("|")})$`),cD=e=>tD.test(e),uD=e=>rD.test(e),lD=e=>nD.test(e),dD=e=>oD.test(e),pD=e=>sD.test(e),fD=[uD,cD,lD,dD,pD],mD=[iD,aD],gD={anonymizeIp:"aip"},hD={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},yD={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},SD=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],vD=Object.assign(Object.assign(Object.assign(Object.assign({},gD),hD),yD),SD.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),yy=Object.assign(Object.assign({},vD),UN),AD=e=>{let t=!!e.action&&HN[e.action]||{};return Ar(e).reduce((r,n)=>{let o=t[n]||yy[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},CD=Ar(yy).map(e=>yy[e]),bD=e=>CD.indexOf(e)!==-1,xD=e=>e==="custom",RD=e=>[...fD,...GN,bD,xD].some(t=>t(e)),wD=e=>Ar(e).reduce((t,r)=>{let n=ID(r);return n?Object.assign(Object.assign({},t),ED(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),ID=e=>{let t;return[...mD].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},ED=(e,t)=>Ar(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Sy=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:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),m=this.encodeForEventType(t,p),f=new Blob([m],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,f)})}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:p,body:m}=a;o=p||t;try{i=JSON.parse(m)}catch(f){console.error("Unable to process the request body as a JSON string",f)}}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[je.click,je.custom,je.search,je.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}},vy=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()})}},kb=v.fetch,Ml=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():"",p={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},m=Object.assign(Object.assign({},p),i?yield i(p,"analyticsFetch"):{}),{url:f}=m,g=Gr(m,["url"]),S;try{S=yield kb(f,g)}catch(b){console.error("An error has occurred when sending the event.",b);return}if(S.ok){let b=yield S.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}else{try{S.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,S,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 kb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[je.click,je.custom,je.search,je.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"})}},Ay=class{constructor(t,r){uy()&&Db()?this.storage=new dy:uy()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ga),this.client=new Ml(t),this.beaconClient=new Sy(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}},Cy=class{constructor(t,r){this.storage=r||new ga,this.client=new Ml(t)}getClientDependingOnEventType(t){return this.client}},Vl=class{constructor(){this.storage=new ga,this.client=new vy}getClientDependingOnEventType(t){return this.client}},FD="xx",TD=e=>e?.startsWith(FD)||!1,PD=`
29
29
  We've detected you're using React Native but have not provided the corresponding runtime,
30
30
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
31
31
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
32
- `;function PD(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var kD=["1",1,"yes",!0];function OD(){let e=[];return ly()&&e.push(window.doNotTrack),wy()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>kD.indexOf(t)!==-1)}function Lc(e){return e===!0?!1:OD()}var VC="v15",jC={default:"https://analytics.cloud.coveo.com/rest/ua"};function _D(e=jC.default,t=VC,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 ND="38824e1f-37f5-42d3-8372-a4b8fa9df946",ur=class{get defaultOptions(){return{endpoint:jC.default,isCustomEndpoint:!1,token:"",version:VC,beforeSendHooks:[],afterSendHooks:[]}}get version(){return NC}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=[xN,hN].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};Lc(this.options.disableBrowserPrivacySignals)?this.runtime=new Ul:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(je.view,{newEventType:je.view,addClientIdParameter:!0}),this.addEventTypeMapping(je.click,{newEventType:je.click,addClientIdParameter:!0}),this.addEventTypeMapping(je.custom,{newEventType:je.custom,addClientIdParameter:!0}),this.addEventTypeMapping(je.search,{newEventType:je.search,addClientIdParameter:!0})}initRuntime(t){return ly()&&pi()?new Cy(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(PD()&&console.warn(TD),new xy(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return ly()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Yo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Yo()}})}getCurrentVisitorId(){return G(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return G(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return G(this,void 0,void 0,function*(){if(ql(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Ml(t,Ml(r,ND)))}})}getParameters(t,...r){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return G(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Yo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Lc(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Xn.cvo_cid);if(r==null)return null;let n=Xn.fromString(r);return!n||!pi()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:a=!1,addClientIdParameter:i=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,x)=>G(this,void 0,void 0,function*(){let w=yield y;return yield x(t,w)}),h)].reduce((h,y)=>G(this,void 0,void 0,function*(){let x=yield h;return yield y(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[S=>this.setTrackingIdIfTrackingIdNotPresent(S),S=>this.removeEmptyPayloadValues(S,t),S=>this.validateParams(S,t),S=>n?vD(S):S,S=>n?this.removeUnknownParameters(S):S,S=>n?this.processCustomParameters(S):this.mapCustomParametersToCustomData(S)].reduce((S,C)=>G(this,void 0,void 0,function*(){let h=yield S;return yield C(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),a=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:a,log:i=>G(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},a),i)}),yield Promise.all(this.afterSendHooks.map(p=>p(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Dl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(je.search,t)})}sendSearchEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=$r(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(je.click,t)})}sendClickEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=$r(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(je.custom,t)})}sendCustomEvent(t){return G(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=$r(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(je.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(this,void 0,void 0,function*(){return yield(yield A(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,a=r.length;o<a;o++){let i=r[o];if(typeof i=="string")n[t[o]]=i;else if(typeof i=="object")return Object.assign(Object.assign({},n),i)}return n}isKeyAllowedEmpty(t,r){return({[je.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,a)=>Object.assign(Object.assign({},o),{[a]:t[a]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(xD(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=$r(t,["custom"]),o={};r&&Nl(r)&&(o=this.lowercaseKeys(r));let a=RD(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=$r(t,["custom"]);if(r&&Nl(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=$r(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==je.view||r==je.click||r==je.search||r==je.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==je.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=$r(t,["userId"]);return FD(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=$r(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Nl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Nl(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"?qN(t,r):t}get baseUrl(){return _D(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Ot;(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"})(Ot||(Ot={}));var D;(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"})(D||(D={}));var Ry={[D.triggerNotify]:"queryPipelineTriggers",[D.triggerExecute]:"queryPipelineTriggers",[D.triggerQuery]:"queryPipelineTriggers",[D.triggerRedirect]:"queryPipelineTriggers",[D.queryErrorBack]:"errors",[D.queryErrorClear]:"errors",[D.queryErrorRetry]:"errors",[D.pagerNext]:"getMoreResults",[D.pagerPrevious]:"getMoreResults",[D.pagerNumber]:"getMoreResults",[D.pagerResize]:"getMoreResults",[D.pagerScrolling]:"getMoreResults",[D.facetSearch]:"facet",[D.facetShowLess]:"facet",[D.facetShowMore]:"facet",[D.recommendation]:"recommendation",[D.likeSmartSnippet]:"smartSnippet",[D.dislikeSmartSnippet]:"smartSnippet",[D.expandSmartSnippet]:"smartSnippet",[D.collapseSmartSnippet]:"smartSnippet",[D.openSmartSnippetFeedbackModal]:"smartSnippet",[D.closeSmartSnippetFeedbackModal]:"smartSnippet",[D.sendSmartSnippetReason]:"smartSnippet",[D.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.clearRecentQueries]:"recentQueries",[D.recentResultClick]:"recentlyClickedDocuments",[D.clearRecentResults]:"recentlyClickedDocuments",[D.showLessFoldedResults]:"folding",[D.caseDetach]:"case",[D.likeGeneratedAnswer]:"generatedAnswer",[D.dislikeGeneratedAnswer]:"generatedAnswer",[D.openGeneratedAnswerSource]:"generatedAnswer",[D.generatedAnswerOpenInlineLink]:"generatedAnswer",[D.generatedAnswerFollowupOpenSource]:"generatedAnswer",[D.generatedAnswerStreamEnd]:"generatedAnswer",[D.generatedAnswerSourceHover]:"generatedAnswer",[D.generatedAnswerCopyToClipboard]:"generatedAnswer",[D.generatedAnswerHideAnswers]:"generatedAnswer",[D.generatedAnswerShowAnswers]:"generatedAnswer",[D.generatedAnswerExpand]:"generatedAnswer",[D.generatedAnswerCollapse]:"generatedAnswer",[D.generatedAnswerFeedbackSubmit]:"generatedAnswer",[D.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Ot.expandToFullUI]:"interface",[Ot.openUserActions]:"User Actions",[Ot.showPrecedingSessions]:"User Actions",[Ot.showFollowingSessions]:"User Actions",[Ot.clickViewedDocument]:"User Actions",[Ot.clickPageView]:"User Actions",[Ot.createArticle]:"createArticle"},Zn=class{constructor(){this.runtime=new Ul,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(je.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(je.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(je.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(je.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return NC}};function DD(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function qD(e){return e.map(t=>t.replace(/;/g,""))}function LC(e){let r=e.join(";");return r.length<=256?r:LC(e.slice(1))}var TC=e=>{let t=qD(e),r=DD(t);return LC(r)};function PC(e){let t=typeof e.partialQueries=="string"?e.partialQueries:TC(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:TC(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ql=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Lc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Zn:new ur(t)}disable(){this.coveoAnalyticsClient=new Zn}enable(){this.coveoAnalyticsClient=new ur(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(D.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(D.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(D.recommendation)}logRecommendation(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(D.recommendationOpen,t,r)}logRecommendationOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(D.staticFilterClearAll,t)}logStaticFilterClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(D.staticFilterSelect,t)}logStaticFilterSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(D.staticFilterDeselect,t)}logStaticFilterDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(D.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return G(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(D.interfaceChange,t)}logInterfaceChange(t){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(D.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(D.didyoumeanClick)}logDidYouMeanClick(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(D.resultsSort,t)}logResultsSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(D.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(D.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(D.searchboxAsYouType)}logSearchboxAsYouType(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(D.breadcrumbFacet,t)}logBreadcrumbFacet(t){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(D.breadcrumbResetAll)}logBreadcrumbResetAll(){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(D.documentQuickview,t,r)}logDocumentQuickview(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(D.documentOpen,t,r)}logDocumentOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(D.omniboxAnalytics,PC(t))}logOmniboxAnalytics(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(D.omniboxFromLink,PC(t))}logOmniboxFromLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(D.searchFromLink)}logSearchFromLink(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(D.triggerNotify,t)}logTriggerNotify(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(D.triggerExecute,t)}logTriggerExecute(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(D.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(D.undoTriggerQuery,t)}logUndoTriggerQuery(t){return G(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(D.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(D.pagerResize,t)}logPagerResize(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(D.pagerNumber,t)}logPagerNumber(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(D.pagerNext,t)}logPagerNext(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(D.pagerPrevious,t)}logPagerPrevious(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(D.pagerScrolling)}logPagerScrolling(){return G(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(D.facetClearAll,t)}logFacetClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(D.facetSearch,t)}logFacetSearch(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(D.facetSelect,t)}logFacetSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(D.facetDeselect,t)}logFacetDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(D.facetExclude,t)}logFacetExclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(D.facetUnexclude,t)}logFacetUnexclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(D.facetSelectAll,t)}logFacetSelectAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(D.facetUpdateSort,t)}logFacetUpdateSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(D.facetShowMore,t)}logFacetShowMore(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(D.facetShowLess,t)}logFacetShowLess(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(D.queryError,t)}logQueryError(t){return G(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(D.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.queryErrorBack)})}})}logQueryErrorBack(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(D.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.queryErrorRetry)})}})}logQueryErrorRetry(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(D.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(D.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(D.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(D.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(D.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(D.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(D.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(D.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(D.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(D.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(D.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(D.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(D.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(D.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(D.copyToClipboard,t,r)}logCopyToClipboard(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(D.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(D.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(D.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(D.clearRecentQueries)}logClearRecentQueries(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(D.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(D.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(D.noResultsBack)}logNoResultsBack(){return G(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(D.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(D.showLessFoldedResults)}logShowLessFoldedResults(){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,a=Ry[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),m=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(m,n),log:({searchUID:f})=>m.log({lastSearchQueryUid:f})}})}logCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,a=Ry[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),i=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({lastSearchQueryUid:p})}})}logCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:a})=>o.log({searchQueryUid:a})}})}makeClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),i=yield this.coveoAnalyticsClient.makeClickEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({searchQueryUid:p})}})}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof ur?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(D.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(D.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(D.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(D.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(D.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(D.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(D.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(D.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(D.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(D.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(D.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(D.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(D.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(D.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(D.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(D.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(D.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Bl=Object.assign({},Vc),kC=Object.keys(Bl).map(e=>Bl[e]),mi=class extends my{constructor({client:t,uuidGenerator:r=Yo}){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])=>kC.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(kC.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Bl.pageview,{newEventType:je.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Bl.event,{newEventType:je.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}:{}),a=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},a),o),r)}getTicketPayload(){return UN(this.ticket)}};mi.Id="svc";var Gl;(function(e){e.click="click",e.flowStart="flowStart"})(Gl||(Gl={}));var Sr;(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"})(Sr||(Sr={}));var $l;(function(e){e.quit="Quit",e.solved="Solved"})($l||($l={}));var Hl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Lc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new ur(t):new Zn,this.svc=new mi({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Zn,this.svc=new mi({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new ur(this.options),this.svc=new mi({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Sr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Sr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Sr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Sr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Sr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Sr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Sr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Sr.caseCancelled,{reason:$l.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Sr.caseSolved,{reason:$l.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Sr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Gl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Gl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof ur?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,a;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:(a=this.provider)===null||a===void 0?void 0:a.getOriginLevel3()}}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){var a,i;let p=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(i=(a=this.provider)===null||a===void 0?void 0:a.getSearchUID())!==null&&i!==void 0?i:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(p)})}},MD=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let a=`context_${r}`;t[a]=o}}),t},le=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,a=$r(e,["caseContext","caseId","caseNumber"]),i=MD(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},a),!!i.context_Case_Subject&&{CaseSubject:i.context_Case_Subject}),t&&i)},zl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Lc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Zn:new ur(t)}disable(){this.coveoAnalyticsClient=new Zn}enable(){this.coveoAnalyticsClient=new ur(this.opts)}logInterfaceLoad(t){if(t){let r=le(t);return this.logSearchEvent(D.interfaceLoad,r)}return this.logSearchEvent(D.interfaceLoad)}logRecentQueryClick(t){if(t){let r=le(t);return this.logSearchEvent(D.recentQueryClick,r)}return this.logSearchEvent(D.recentQueryClick)}logClearRecentQueries(t){if(t){let r=le(t);return this.logCustomEvent(D.clearRecentQueries,r)}return this.logCustomEvent(D.clearRecentQueries)}logInterfaceChange(t){let r=le(t);return this.logSearchEvent(D.interfaceChange,r)}logStaticFilterDeselect(t){let r=le(t);return this.logSearchEvent(D.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=le(t);return this.logCustomEvent(D.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(D.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=le(t);return this.logSearchEvent(D.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=le(t);return this.logSearchEvent(D.breadcrumbResetAll,r)}return this.logSearchEvent(D.breadcrumbResetAll)}logFacetSelect(t){let r=le(t);return this.logSearchEvent(D.facetSelect,r)}logFacetExclude(t){let r=le(t);return this.logSearchEvent(D.facetExclude,r)}logFacetDeselect(t){let r=le(t);return this.logSearchEvent(D.facetDeselect,r)}logFacetUpdateSort(t){let r=le(t);return this.logSearchEvent(D.facetUpdateSort,r)}logFacetClearAll(t){let r=le(t);return this.logSearchEvent(D.facetClearAll,r)}logFacetShowMore(t){let r=le(t,!1);return this.logCustomEvent(D.facetShowMore,r)}logFacetShowLess(t){let r=le(t,!1);return this.logCustomEvent(D.facetShowLess,r)}logQueryError(t){let r=le(t,!1);return this.logCustomEvent(D.queryError,r)}logPagerNumber(t){let r=le(t,!1);return this.logCustomEvent(D.pagerNumber,r)}logPagerNext(t){let r=le(t,!1);return this.logCustomEvent(D.pagerNext,r)}logPagerPrevious(t){let r=le(t,!1);return this.logCustomEvent(D.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=le(t);return this.logSearchEvent(D.didyoumeanAutomatic,r)}return this.logSearchEvent(D.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=le(t);return this.logSearchEvent(D.didyoumeanClick,r)}return this.logSearchEvent(D.didyoumeanClick)}logResultsSort(t){let r=le(t);return this.logSearchEvent(D.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=le(t);return this.logSearchEvent(D.searchboxSubmit,r)}return this.logSearchEvent(D.searchboxSubmit)}logContextChanged(t){let r=le(t);return this.logSearchEvent(Ot.contextChanged,r)}logExpandToFullUI(t){let r=le(t);return this.logCustomEvent(Ot.expandToFullUI,r)}logOpenUserActions(t){let r=le(t,!1);return this.logCustomEvent(Ot.openUserActions,r)}logShowPrecedingSessions(t){let r=le(t,!1);return this.logCustomEvent(Ot.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=le(t,!1);return this.logCustomEvent(Ot.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(Ot.clickViewedDocument,Object.assign(Object.assign({},le(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(Ot.clickPageView,Object.assign(Object.assign({},le(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(Ot.createArticle,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(D.documentOpen,t,r,n?le(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(D.copyToClipboard,t,r,n?le(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(D.caseSendEmail,t,r,n?le(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(D.feedItemTextPost,t,r,n?le(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(D.documentQuickview,t,r,n?Object.assign(Object.assign({},le(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(D.caseAttach,t,r,n?Object.assign(Object.assign({},le(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&le(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(D.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(D.likeSmartSnippet,t?le(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(D.dislikeSmartSnippet,t?le(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(D.expandSmartSnippet,t?le(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(D.collapseSmartSnippet,t?le(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(D.openSmartSnippetFeedbackModal,t?le(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(D.closeSmartSnippetFeedbackModal,t?le(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(D.sendSmartSnippetReason,n?Object.assign(Object.assign({},le(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(D.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},le(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(D.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},le(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(D.openSmartSnippetSource,t,r,n?le(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(D.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(D.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(D.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(D.likeGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(D.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(D.openGeneratedAnswerSource,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(D.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(D.generatedAnswerSourceHover,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(D.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(D.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(D.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(D.generatedAnswerExpand,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(D.generatedAnswerCollapse,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(D.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(D.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(D.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(D.retryGeneratedAnswer,t?Object.assign({},le(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(D.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},le(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(D.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},le(n,!1)),r):r)}logCustomEvent(t,r){return G(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:Ry[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}logShowMoreFoldedResults(t,r,n){return G(this,void 0,void 0,function*(){return this.logClickEvent(D.showMoreFoldedResults,t,r,n?le(n,!1):void 0)})}logShowLessFoldedResults(t){return G(this,void 0,void 0,function*(){return this.logCustomEvent(D.showLessFoldedResults,t?le(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(D.triggerNotify,r?Object.assign(Object.assign({},le(r,!1)),t):t)}getBaseCustomEventRequest(t){return G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign({},this.getOrigins()),{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 ur?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var hi=()=>"default";var VD=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Jn=class{constructor(t){de(this,"getState",t);de(this,"state");this.state=t()}getLanguage(){return VD(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let p=`context_${a}`;o[p]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Kn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||hi()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var UC=e=>new ur(e).getCurrentVisitorId(),yi=(e,t)=>typeof t=="function"?(...r)=>{let n=lc(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Si=(e,t)=>(...r)=>{let n=lc(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Uc=class extends Jn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},QC=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new Uc(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,m=i.configuration.analytics.apiBaseUrl??gt(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,S=new Hl({enableAnalytics:g,token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:a,preprocessRequest:yi(e,n),beforeSendHooks:[Si(e,r),(C,h)=>(e.info({...h,type:C,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Wl(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function jD(e,t){return!!t&&t.facetId in e.facetSet}var kn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),BC=(e,t)=>e.facetSet[t]?.request,Fy=(e,t)=>{let r=kn(e,t);return jD(e,r)?r:void 0};var GC=(e,t)=>Fy(e,t)?.values.filter(r=>r.state!=="idle")||[],Hr=e=>e.search.isLoading;d();c();l();u();function $C(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function zr(e){let{activeValue:t,ancestryMap:r}=LD(e);return t?UD(t,r):[]}function LD(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 UD(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function QD(e,t){return!!t&&t.facetId in e.categoryFacetSet}var Ty=(e,t)=>{let r=kn(e,t);if(QD(e,r))return r},Py=(e,t)=>e.categoryFacetSet[t]?.request,HC=(e,t)=>{let r=Ty(e,t);return zr(r?.values??[])},ky=(e,t)=>{let r=Py(e,t);return zr(r?.currentValues??[])};d();c();l();u();function vi(){return{}}d();c();l();u();function zC(e,t){return{request:e,tabs:t}}function Ai(){return{}}d();c();l();u();function WC(e,t){return{request:e,tabs:t}}function bi(){return{}}d();c();l();u();function YC(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function Ci(){return{}}var Ko=(e,t)=>{let r=JC(t,e),n=r?r.field:"",o=Oy(n,e);return{facetId:e,facetField:n,facetTitle:o}};function xi(e,t){let{facetId:r,facetValue:n}=e,o=Ko(r,t),a=ex(t,r);return{...o,facetValue:a==="hierarchical"?ZC(t,r):n}}function Zt(e){return{facetSet:e.facetSet??Ci(),categoryFacetSet:e.categoryFacetSet??vi(),dateFacetSet:e.dateFacetSet??Ai(),numericFacetSet:e.numericFacetSet??bi(),automaticFacetSet:e.automaticFacetSet??Wl()}}var Yl=e=>{let t=[];return $D(e).forEach((r,n)=>{let o=ex(e,r.facetId),a=KD(r,n+1);if(GD(r)){if(!!!ky(e,r.facetId).length)return;t.push({...a,...WD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let m=KC(i,p+1,o),f=BD(r)?XC(i):zD(i);t.push({...a,...m,...f})})}),HD(e).forEach((r,n)=>{let o=YD(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=KC(a,i+1,"specific"),m=XC(a);t.push({...o,...p,...m})})}),t},BD=e=>e.type==="specific",GD=e=>e.type==="hierarchical",$D=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),HD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),KC=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),zD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),XC=e=>({displayValue:e.value,value:e.value}),ZC=(e,t)=>ky(e,t).map(n=>n.value).join(";"),WD=(e,t)=>{let n=ZC(e,t);return{value:n,valuePosition:1,displayValue:n}},YD=(e,t)=>({title:Oy(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),KD=(e,t)=>({title:Oy(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Oy=(e,t)=>`${e}_${t}`,JC=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,ex=(e,t)=>{let r=JC(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var _y=e=>e.configuration.search.locale,tx=e=>e.configuration.search.timezone,rx=e=>e.configuration.accessToken,nx=e=>e.configuration.organizationId,ox=e=>e.configuration.environment,Kl=e=>e.configuration?.knowledge?.agentId,ax=e=>e.configuration.knowledge.debugAgentSession;var Ce=e=>{if(XD(e)||Ny(e))return e.generatedAnswer?.answerId;if(ZD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},XD=e=>"answer"in e&&"generatedAnswer"in e&&!J(e.generatedAnswer?.answerConfigurationId),Ny=e=>{let t=Kl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},ZD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Dy=e=>e.generatedAnswer?.fieldsToIncludeInCitations,eo=e=>e.followUpAnswers?.conversationId,JD=e=>e.generatedAnswer?.citations,eq=e=>e.followUpAnswers?.followUpAnswers,tq=lt(eq,e=>e?.flatMap(t=>t.citations)),rq=(e,t)=>t,Or=lt(JD,tq,rq,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ut=()=>({q:"",enableQuerySyntax:!1});var Qc=class extends Jn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||xt().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Yl(Zt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ce(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||xt().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||xt().response.results.length}},ix=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new Qc(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,m=i.configuration.analytics.apiBaseUrl??gt(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,S=new zl({enableAnalytics:g,token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:a,preprocessRequest:yi(e,n),beforeSendHooks:[Si(e,r),(C,h)=>(e.info({...h,type:C,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S};d();c();l();u();d();c();l();u();d();c();l();u();var Xl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Xl||{}),Zl=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Zl||{}),Wr=e=>{if(Xa(e))return e.map(t=>Wr(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""}},Jl=()=>({by:"relevancy"}),sx=e=>({by:"date",order:e});var cx=new Y({values:{by:new uc({enum:Zl,required:!0}),order:new uc({enum:Xl}),field:new $}});function lr(){return Wr(Jl())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function nq(){return typeof navigator<"u"}function ux(){try{return typeof localStorage<"u"}catch{return!1}}function lx(){try{return typeof sessionStorage<"u"}catch{return!1}}function dx(){return nq()&&navigator.cookieEnabled}d();c();l();u();var Xo=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),qy(t,r,o,oq(window.location.hostname))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function oq(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(aq(n))return n}}function aq(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return qy(t,"1",void 0,e),Xo.get(t)==="1"}catch{return!1}finally{try{qy(t,"",new Date(0),e)}catch{}}}function qy(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function px(){return ux()?localStorage:dx()?new ed:lx()?sessionStorage:new My}var ed=class e{getItem(t){return Xo.get(`${e.prefix}${t}`)}removeItem(t){Xo.erase(`${e.prefix}${t}`)}setItem(t,r,n){Xo.set(`${e.prefix}${t}`,r,n)}};ed.prefix="coveo_";var My=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var td="__coveo.analytics.history",iq=20,sq=1e3*60,cq=75,rd=class{constructor(t){this.store=t||px()}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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!=null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(td);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(td);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(td,JSON.stringify(t.slice(0,iq)))}catch{}}clear(){try{this.store.removeItem(td)}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,cq)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>sq:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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 Zo=class Zo extends rd{static getInstance(t){return Zo.instance||(Zo.instance=new Zo(t)),Zo.instance}constructor(t){super(t)}};de(Zo,"instance",null);var At=Zo;var Bc=class Bc extends Jn{constructor(){super(...arguments);de(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 Yl(Zt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Bc.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||xt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Bc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ce(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetValue:n,facetTitle:`${a}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,criteria:n,facetTitle:`${a}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${a}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??lr()}}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 a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:a,categoryFacetPath:n,categoryFacetTitle:`${a}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],a=o.completions.map(f=>f.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",m=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:a.length>0?a:"",querySuggestResponseId:m}}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||ut().q}get responseTime(){return this.state.search?.duration||xt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||xt().response.totalCountFiltered}};de(Bc,"fallbackPipelineName","default");var to=Bc,fx=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,m=i.configuration.analytics.apiBaseUrl??gt(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,S=new Ql({token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:a,preprocessRequest:yi(e,n),beforeSendHooks:[Si(e,r),(C,h)=>(e.info({...h,type:C,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S},Vy=()=>{let t=At.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function nd(e){let t=mx(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return CA([e,...t,...r],o=>o.uniqueId)}function mx(e){return e.childResults?e.childResults.flatMap(t=>[t,...mx(t)]):[]}d();c();l();u();var Ri=()=>"";function hx(e,t){return{...new to(t).getBaseMetadata(),actionCause:e,type:e}}function uq(e){return Object.assign(e,{instantlyCallable:!0})}function lq(e,t){let r=a=>{let i=me(e,a);return uq(Object.assign(i,{type:i.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(a,{getState:i,extra:p}){let{analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S}=p;return yield(yield t({getState:i,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S})).log({state:i(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:m,disableBrowserPrivacySignals:f}){let{description:g,log:S}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:m,disableBrowserPrivacySignals:f});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:h,extra:y}){return yield S({state:h(),extra:y})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var jy=(e,t,r)=>{function n(...o){let a=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 fq(a)}return n},dq=e=>e.configuration.analytics.analyticsMode==="legacy",pq=e=>e.configuration.analytics.analyticsMode==="next",fq=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),lq(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S}){let C=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:T}){for(let F of C)yield F(T)});return function log(_x25){return _ref14.apply(this,arguments)}}()},y=p(),x=a({getState:p,logger:g,analyticsClientMiddleware:m,preprocessRequest:f,disableBrowserPrivacySignals:S,provider:r(p)}),w=yield t(x,p());h.description=w?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(T){dq(T)&&(yield mq(w,r,T,g,x.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:E}=Mc(y);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(T){if(pq(T)&&o&&n){let F=n(T);yield bq(E,o,F)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function mq(_x28,_x29,_x30,_x31,_x32){return _mq.apply(this,arguments)}function _mq(){_mq=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let a=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")});return _mq.apply(this,arguments)}var yx=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(a){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),ke=jy(e=>fx({...e,provider:e.provider||new to(e.getState)}),e=>e,to),a9=jy(QC,yx("caseAssist"),Uc),re=e=>jy(ix,yx(e),Qc),et=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=bx(e,o),n<0&&(n=Aq(e,o)),n<0&&(n=0),gq(e,r(n),t)};var Gc=(e,t)=>({sourceName:vx(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ri()}),Sx=(e,t)=>({sourceName:vx(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ri()});function vx(e){let t=e.source;return J(t)?"unknown":t}var $c=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function gq(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:Sq(e),...(gx(e)?{documentCategory:gx(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:vq(e),queryPipeline:r.pipeline||Ri()}}function gx(e){return e.raw?.objecttype||void 0}var tt=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||""}),Ax={urihash:new $,sourcetype:new $,permanentid:new $},od={uniqueId:H,raw:new Y({values:Ax}),title:H,uri:H,clickUri:H,rankingModifier:new $({required:!1,emptyAllowed:!0})};function hq(e){return Object.assign({},...Object.keys(Ax).map(t=>({[t]:e[t]})))}function yq(e){return Object.assign({},...Object.keys(od).map(t=>({[t]:e[t]})),{raw:hq(e.raw)})}function Sq(e){let t=e.raw.author;return J(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function vq(e){let t=e.raw.source;return J(t)?"unknown":t}var _t=e=>new De(od).validate(yq(e));function Aq(e,t){for(let[r,n]of t.entries()){let o=nd(n);if(bx(e,o)!==-1)return r}return-1}function bx(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function bq(_x34,_x35,_x36){return _bq.apply(this,arguments)}function _bq(){_bq=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _bq.apply(this,arguments)}var _r=(e,t)=>{let r=tt(e),n=et(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Ly=e=>q(e,{evt:H,type:Ze}),Cx=e=>ke("analytics/generic/search",t=>{Ly(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),xx=e=>ke("analytics/generic/click",(t,r)=>(_t(e.result),Ly(e),t.makeClickEvent(e.evt,et(e.result,r),tt(e.result),e.meta))),Rx=e=>ke("analytics/generic/custom",t=>(Ly(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var wx=()=>({actionCause:"interfaceLoad"}),wi=()=>({actionCause:"interfaceChange"});d();c();l();u();var Uy=()=>Ze,Ix=()=>H,Ii=N("configuration/updateBasicConfiguration",e=>q(e,{accessToken:Ze,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Ze})),Ei=N("configuration/updateSearchConfiguration",e=>q(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:Ze,timezone:Ze,locale:Ze,authenticationProviders:new ae({required:!1,each:H})})),Cq={enabled:new pe({default:!0}),originContext:Uy(),originLevel2:Uy(),originLevel3:Uy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new Ke,anonymous:new pe({default:!1}),deviceId:Ze,userDisplayName:Ze,documentLocation:Ze,trackingId:mb,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:bC.reduce((e,t)=>(e[t]=fb,e),{})})},ad=N("configuration/updateAnalyticsConfiguration",e=>q(e,Cq)),id=N("configuration/analytics/disable"),sd=N("configuration/analytics/enable"),Ex=N("configuration/analytics/originlevel2",e=>q(e,{originLevel2:Ix()})),Fx=N("configuration/analytics/originlevel3",e=>q(e,{originLevel3:Ix()})),Tx=N("knowledge/setAgentId",e=>q(e,new $({required:!0})));d();c();l();u();var cd=N("insightConfiguration/set",e=>q(e,{insightId:H}));d();c();l();u();d();c();l();u();var Px=()=>({insightId:""});var ud=fe(Px(),e=>{e.addCase(cd,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var kx=()=>({caseContext:{},caseId:"",caseNumber:""}),ee=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});d();c();l();u();var On=e=>{if(e==="yes")return!0;if(e==="no")return!1},xq=()=>ke("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function Rq(e,t){return ke({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ce(n),a=Or(n,e);if(!o||!a)return null;let i=eo(n);return r.makeGeneratedAnswerCitationClick(Gc(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:$c(a),...(i&&{conversationId:i})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Or(r,e);return{answerId:t??Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function wq(e,t,r){return ke({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??Ce(o),i=Or(o,e);if(!a||!i)return null;let p=eo(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Or(n,e);return{answerId:r??Ce(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function Iq(e,t){return ke({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function Eq(e){return ke({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=eo(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"like"})})}function Fq(e){return ke({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=eo(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"dislike"})})}var Tq=e=>ke({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:m,details:f}=e;return{answerId:r??"",helpful:n,details:{readable:On(o),documented:On(a),correctTopic:On(p),hallucinationFree:On(i)},additionalNotes:f,correctAnswerUrl:m}}}),Qy=(e,t,r)=>ke({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ce(o);if(!a)return null;let i=eo(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e??!1})}),Fi=e=>ke({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),Pq=()=>ke({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),kq=()=>ke({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),Oq=()=>ke({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),_q=()=>ke({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})});function Nq(e){return ke({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=eo(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"copyToClipboard"})})}function Dq(e,t){return ke({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Or(n,e);if(!o)return null;let a=eo(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...Sx(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var Ox=()=>({actionCause:"retryGeneratedAnswer"}),ld={logCopyGeneratedAnswer:Nq,logGeneratedAnswerHideAnswers:kq,logGeneratedAnswerShowAnswers:Pq,logGeneratedAnswerStreamEnd:Qy,logGeneratedAnswerFeedback:Tq,logDislikeGeneratedAnswer:Fq,logLikeGeneratedAnswer:Eq,logGeneratedAnswerOpenInlineLink:Iq,logHoverCitation:wq,logOpenGeneratedAnswerSource:Rq,logOpenGeneratedAnswerFollowUpSource:Dq,logRetryGeneratedAnswer:xq,logGeneratedAnswerExpand:Oq,logGeneratedAnswerCollapse:_q};var qq=()=>re("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(ee(t.insightCaseContext))),By=e=>re("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ce(r),o=Or(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Gc(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:$c(o)},ee(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=Or(t,e);return{answerId:Ce(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),Mq=(e,t)=>re("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ce(n),a=Or(n,e);return!o||!a?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t},ee(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=Or(r,e);return{answerId:Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),Vq=()=>re("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"like"})}),jq=()=>re("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"dislike"})}),Lq=e=>re("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},ee(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:m,details:f}=e;return{answerId:r??"",helpful:n,details:{readable:On(o),documented:On(a),correctTopic:On(p),hallucinationFree:On(i)},additionalNotes:f,correctAnswerUrl:m}}}),Uq=(e,t,r)=>re("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ce(o);return a?n.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r},ee(o.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e})});var Qq=()=>re("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),Bq=()=>re("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),Gq=()=>re("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),$q=()=>re("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})}),Hq=()=>re("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"copyToClipboard"})}),Ti={logCopyGeneratedAnswer:Hq,logGeneratedAnswerHideAnswers:Bq,logGeneratedAnswerShowAnswers:Qq,logGeneratedAnswerStreamEnd:Uq,logGeneratedAnswerFeedback:Lq,logDislikeGeneratedAnswer:jq,logLikeGeneratedAnswer:Vq,logHoverCitation:Mq,logOpenGeneratedAnswerSource:By,logRetryGeneratedAnswer:qq,logGeneratedAnswerExpand:Gq,logGeneratedAnswerCollapse:$q};d();c();l();u();d();c();l();u();var dd=N("searchHub/set",e=>q(e,new $({required:!0,emptyAllowed:!0})));var Yr=me("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let a=t(),i=yield o.getInterface(zq(a));return Xe(i)?n(i.error):(r(dd(i.success.searchHub)),{response:i.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),zq=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:gt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var _x=()=>({loading:!1,config:void 0});var ro=fe(_x(),e=>{e.addCase(Yr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Yr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Yr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function Nx(e){return e.type==="dateRange"}function Dx(e){return`start${e}`}function qx(e){return`end${e}`}var Gy=()=>({dateFacetValueMap:{}});function Wq(e,t,r){let n=e.start,o=e.end;return zn(n)&&(n=mc(n),r.dateFacetValueMap[t][Dx(n)]=e.start),zn(o)&&(o=mc(o),r.dateFacetValueMap[t][qx(o)]=e.end),{...e,start:n,end:o}}function $y(e,t){if(Nx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>Wq(o,r,t))}}return e}function Kr(e){let t=Gy();return{request:{...e,facets:e.facets?.map(n=>$y(n,t))},mappings:t}}function Yq(e,t,r){return{...e,start:r.dateFacetValueMap[t][Dx(e.start)]||e.start,end:r.dateFacetValueMap[t][qx(e.end)]||e.end}}function Kq(e,t){return e.facetId in t.dateFacetValueMap}function Xq(e,t){return Kq(e,t)?{...e,values:e.values.map(r=>Yq(r,e.facetId,t))}:e}function Nr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>Xq(n,t))}}:e}d();c();l();u();d();c();l();u();var no=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield UC(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}),...(Vy()&&{pageId:Vy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:di(e)})}}});return function no(_x39,_x40){return _ref19.apply(this,arguments)}}();var Mx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:gt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?At.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield no(t.configuration.analytics)))})}});return function Mx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var pd=N("didYouMean/enable"),Vx=N("didYouMean/disable"),fd=N("didYouMean/automaticCorrections/disable"),jx=N("didYouMean/automaticCorrections/enable"),Jt=N("didYouMean/correction",e=>q(e,H)),Hc=N("didYouMean/automaticCorrections/mode",e=>q(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var Zq=N("history/undo"),Jq=N("history/redo"),Rt=N("history/snapshot"),DX=me("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(Zq()),yield t(ot())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),qX=me("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(Jq()),yield t(ot())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),ot=me("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var _n=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function md(){return{contextValues:{}}}d();c();l();u();var gd=()=>!1;d();c();l();u();function Lx(){return{contextValues:{}}}d();c();l();u();function Hy(){return{enabled:!0,tabs:{}}}function hd(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Ux(){return[]}d();c();l();u();function Xr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function yd(){return{}}d();c();l();u();function Qx(){return{}}d();c();l();u();function Sd(){return{}}function wt(e){return{context:e.context||md(),dictionaryFieldContext:e.dictionaryFieldContext||Lx(),facetSet:e.facetSet||Ci(),numericFacetSet:e.numericFacetSet||bi(),dateFacetSet:e.dateFacetSet||Ai(),categoryFacetSet:e.categoryFacetSet||vi(),automaticFacetSet:e.automaticFacetSet??Wl(),pagination:e.pagination||Xr(),query:e.query||ut(),tabSet:e.tabSet||Sd(),advancedSearchQueries:e.advancedSearchQueries||_n(),staticFilterSet:e.staticFilterSet||Qx(),querySet:e.querySet||yd(),sortCriteria:e.sortCriteria||lr(),pipeline:e.pipeline||Ri(),searchHub:e.searchHub||hi(),facetOptions:e.facetOptions||hd(),facetOrder:e.facetOrder??Ux(),debug:e.debug??gd()}}d();c();l();u();var Yt=N("query/updateQuery",e=>q(e,{q:new $,enableQuerySyntax:new pe}));d();c();l();u();var zy=()=>re("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(ee(t.insightCaseContext))),Pi=e=>re("query")("search/queryError",(t,r)=>t.logQueryError({...ee(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Bx=(e,t)=>re("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),vd=()=>re("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(ee(t.insightCaseContext))),oo=()=>re("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...ee(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Zr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var Gx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=tM(e),n=eM(e);return Kr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Hn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield no(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{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.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Gx(_x49,_x50){return _ref24.apply(this,arguments)}}(),Ar=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield Gx(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Ar(_x51,_x52){return _ref25.apply(this,arguments)}}(),$x=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield Gx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function $x(_x53,_x54){return _ref26.apply(this,arguments)}}(),Ad=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Ar(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function Ad(_x55,_x56){return _ref27.apply(this,arguments)}}(),bd=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Ar(e,t);return r.request={...r.request,numberOfResults:0},r});return function bd(_x57,_x58){return _ref28.apply(this,arguments)}}();function eM(e){return Zr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function tM(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Jo=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=Nr(yield _this9.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this9.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(Pi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:m}=n;if(!o)return null;if(!a)return!J(m)&&!J(m.correctedQuery)?_this1.processNextDidYouMeanAutoCorrection(t):null;let f=i.length===0&&p&&p.length!==0,g=!J(m)&&!J(m.correctedQuery);if(!f&&!g)return null;let C=f?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(Rt(wt(_this1.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this10.automaticallyRetryQueryWithCorrection(o);return Xe(a.response)?(_this10.dispatch(Pi(a.response.error)),_this10.rejectWithValue(a.response.error)):(_this10.dispatch(Rt(wt(_this10.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(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}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Ar(r));return _this11.dispatch(Jt(t)),n})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Yn(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var Hx=()=>re("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(ee(t.insightCaseContext))),Wy=()=>re("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(ee(t.insightCaseContext)));var ea=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=Nr(yield _this12.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this12.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(Pi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:a,automaticallyCorrectQuery:i}=n.didYouMean,{results:p,queryCorrections:m,queryCorrection:f}=o;if(!a||!i)return null;let g=p.length===0&&m&&m.length!==0,S=!J(f)&&!J(f.correctedQuery);if(!g&&!S)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(Rt(wt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this15.automaticallyRetryQueryWithCorrection(o);return Xe(a.response)?(_this15.dispatch(Pi(a.response.error)),_this15.rejectWithValue(a.response.error)):(_this15.dispatch(Rt(wt(_this15.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Wy()})})()}processNextDidYouMeanAutoCorrection(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:Wy()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Yt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Ar(r));return _this16.dispatch(Jt(t)),n})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Yn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...xt(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Nr(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function Yy(_x63,_x64,_x65){return _Yy.apply(this,arguments)}function _Yy(){_Yy=_asyncToGenerator(function*(e,t,r){zc(e);let n=new ea({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),m=yield Ar(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _Yy.apply(this,arguments)}function Ky(_x66,_x67,_x68){return _Ky.apply(this,arguments)}function _Ky(){_Ky=_asyncToGenerator(function*(e,t,r){zc(e);let n=new ea({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),m=yield Ar(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _Ky.apply(this,arguments)}function Xy(_x69,_x70){return _Xy.apply(this,arguments)}function _Xy(){_Xy=_asyncToGenerator(function*(e,t){let r=new ea({...t,analyticsAction:zy()}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield zy().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield Ad(e,i),m=yield r.fetchFromAPI(p);return yield r.process(m,p)});return _Xy.apply(this,arguments)}function Zy(_x71,_x72,_x73){return _Zy.apply(this,arguments)}function _Zy(){_Zy=_asyncToGenerator(function*(e,t,r){let n=new ea({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),m=yield bd(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _Zy.apply(this,arguments)}var zx=me("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Yy(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Wx=me("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ky(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),Yx=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Xy(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Kx=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Zy(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var Xx=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let a=Date.now(),i=Nr(yield e.query(r,o),n),p=Date.now()-a,m=t.query?.q||"";return{response:i,duration:p,queryExecuted:m,requestExecuted:r}});return function Xx(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),Re=me("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Yy(r,t,e.legacy);zc(r);let n=new Jo({...t}),o=e.next?Jy(e.next):void 0,a=yield Ar(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),Cd=me("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ky(r,t,e.legacy);zc(r);let n=new Jo({...t}),o=e.next?Jy(e.next):void 0,a=yield Ar(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),xd=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Xy(r,t);let n=new Jo({...t}),o=Jy({actionCause:"browseResults"}),a=yield Ad(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),ki=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Zy(r,t,e.legacy);let n=new Jo({...t}),o=yield bd(r),a=yield n.fetchFromAPI(o);return yield n.process(a)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),Rd=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:H});let a=e.id,i=yield Mx(a,t()),p=yield n.querySuggest(i);return Xe(p)?r(p.error):{id:a,q:i.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),zc=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Jy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var er=N("breadcrumb/deselectAll"),wd=N("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Oi=N("facet/updateFacetAutoSelection",e=>q(e,{allow:new pe({required:!0})}));d();c();l();u();d();c();l();u();var Id=class extends to{constructor(r){super(r);de(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??ut().q}get responseTime(){return this.activeInstantResultCache?.duration??xt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??xt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Zx=()=>ke("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Id(e)),Jx=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var eS={id:H},rM={...eS,q:Je},qte=N("instantResults/register",e=>q(e,eS)),Ed=N("instantResults/updateQuery",e=>q(e,rM)),Mte=N("instantResults/clearExpired",e=>q(e,eS));d();c();l();u();var Fd=new oe({required:!0,min:0}),Td=N("pagination/registerNumberOfResults",e=>q(e,Fd)),Pd=N("pagination/updateNumberOfResults",e=>q(e,Fd)),kd=N("pagination/registerPage",e=>q(e,Fd)),ao=N("pagination/updatePage",e=>q(e,Fd)),Od=N("pagination/nextPage"),_d=N("pagination/previousPage");d();c();l();u();d();c();l();u();var ta=(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:di(e)}});var _i=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Xt(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&&ta(e.configuration.analytics,t,r)),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var io=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Xt(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:At.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 no(e.configuration.analytics,t))),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function io(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var tS=()=>ke("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),so=e=>ke("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||_n().aq,cq:r.advancedSearchQueries?.cq||_n().cq,dq:r.advancedSearchQueries?.dq||_n().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var rS=()=>ke("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),eR=()=>({actionCause:"didYouMeanClick"}),tR=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var Vre=new Y({values:{undoneQuery:Je},options:{required:!0}}),rR=()=>ke("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var Ni=N("trigger/query/ignore",e=>q(e,new $({emptyAllowed:!0,required:!0}))),Di=N("trigger/query/modification",e=>q(e,new Y({values:{originalQuery:Ze,modification:Ze}})));d();c();l();u();d();c();l();u();function Wc(e,t){let r={};e.forEach(a=>{r[a.facetId]=a});let n=[];t.forEach(a=>{a in r&&(n.push(r[a]),delete r[a])});let o=Object.values(r);return[...n,...o]}function nR(e){return Zr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var nS={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function nM(e){return Zr(e).map(t=>{let r=nS[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function oM(e){return[...nM(e.facetSet??{}),...nR(e.numericFacetSet??{}),...nR(e.dateFacetSet??{}),...Zr(e.categoryFacetSet??{})]}function aM(e){return oM(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Nd(e){return Wc(aM(e),e.facetOrder??[])}var co=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=cM(e),n=Nd(e),o=iM(e),a=yield io(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;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"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:i(),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 co(_x98,_x99){return _ref40.apply(this,arguments)}}();function iM(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(sM).filter(r=>r.currentValues.length>0):void 0}function sM(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function cM(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=uM(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function uM(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o})}var uo=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Nr(yield _this17.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this17.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(so(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:m}=n;if(!o||!a)return null;let f=i.length===0&&p&&p.length!==0,g=!J(m)&&!J(m.correctedQuery);if(!f&&!g)return null;let C=f?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(Rt(wt(_this19.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this20.automaticallyRetryQueryWithCorrection(o);return Xe(a.response)?(_this20.dispatch(so(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(Rt(wt(_this20.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:rS()})})()}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:rS()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(Ni("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return Xe(i.response)?(_this21.dispatch(so(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(Rt(wt(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:rR()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...xt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Yn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield co(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Jt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Di({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield co(_this23.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 Gne=me("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),$ne=me("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield aS(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),Hne=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield iS(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),zne=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield fM(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),Wne=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return oS(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),lM=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield co(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function lM(_x112,_x113){return _ref46.apply(this,arguments)}}(),dM=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield io(e);return Kr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function dM(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),pM=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield co(e,t);return r.request.numberOfResults=0,r});return function pM(_x117,_x118){return _ref48.apply(this,arguments)}}(),oR=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function oS(_x119,_x120){return _oS.apply(this,arguments)}function _oS(){_oS=_asyncToGenerator(function*(e,t){q(e,{id:H,q:H,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new uo({...t,analyticsAction:Zx()},f=>{t.dispatch(Ed({q:f,id:e.id}))}),i=yield dM(o,r,n),p=yield a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=yield a.process(p);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,analyticsAction:m.analyticsAction,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return _oS.apply(this,arguments)}function aS(_x121,_x122,_x123){return _aS.apply(this,arguments)}function _aS(){_aS=_asyncToGenerator(function*(e,t,r){oR(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new uo({...t,analyticsAction:r}),m=yield co(e,i),f=yield p.fetchFromAPI(m,{origin:"mainSearch"});return yield p.process(f)});return _aS.apply(this,arguments)}function iS(_x124,_x125){return _iS.apply(this,arguments)}function _iS(){_iS=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield tS().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new uo({...e,analyticsAction:tS()}),p=yield lM(t,a),m=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(m)});return _iS.apply(this,arguments)}function fM(_x126,_x127,_x128){return _fM.apply(this,arguments)}function _fM(){_fM=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new uo({...e,analyticsAction:t}),m=yield pM(r,i),f=yield p.fetchFromAPI(m,{origin:"facetValues"});return yield p.process(f)});return _fM.apply(this,arguments)}function Dd(_x129,_x130,_x131){return _Dd.apply(this,arguments)}function _Dd(){_Dd=_asyncToGenerator(function*(e,t,r){oR(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield co(e,i),m=new uo({...t,analyticsAction:r}),f=yield m.fetchFromAPI(p,{origin:"mainSearch"});return yield m.process(f)});return _Dd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var aR=lt(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o}));var br=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=cS(e),o=mM(e),a=gM(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield io(e,r):_i(e,t,r);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"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:sS(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:a}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function br(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function sS(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function mM(e){return Wc(yM(e),e.facetOrder??[])}function gM(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(hM).filter(r=>r.currentValues.length>0):void 0}function hM(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function yM(e){return SM(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function SM(e){return[...vM(e.facetSet??{}),...iR(e.numericFacetSet??{}),...iR(e.dateFacetSet??{}),...Zr(e.categoryFacetSet??{})]}function vM(e){return Zr(e).map(t=>{let r=nS[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function iR(e){return Zr(e).map(t=>{let r=t.currentValues,n=r.some(({state:a})=>a!=="idle"),o=r.some(a=>a.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function cS(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=aR(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var lo=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Nr(yield _this24.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this24.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(so(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:m}=n;if(!o)return null;if(!a)return!J(m)&&!J(m.correctedQuery)?_this26.processModernDidYouMeanAutoCorrection(t):null;let f=i.length===0&&p&&p.length!==0,g=!J(m)&&!J(m.correctedQuery);if(!f&&!g)return null;let C=f?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(Rt(wt(_this26.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this27.automaticallyRetryQueryWithCorrection(o);return Xe(a.response)?(_this27.dispatch(so(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Rt(wt(_this27.getState()))),{...a,response:{...a.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 _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(Ni("")),null;let a=_this28.getCurrentQuery(),i=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return Xe(i.response)?(_this28.dispatch(so(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Rt(wt(_this28.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Yn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=tR(),o=yield _this29.fetchFromAPI(yield br(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Jt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(Di({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield br(_this30.getState(),_this30.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 qi=me("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{q:new $,enableQuerySyntax:new pe,clearFilters:new pe}),e.clearFilters&&(r(er()),r(wd())),r(Oi({allow:!0})),r(Yt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ao(1))}),sR=N("search/updateSearchAction"),qe=me("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dd(r,t,e.legacy);cR(r);let n=e.next?uR(e.next):void 0,o=yield br(r,t.extra.navigatorContext,n),a=new lo({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),en=me("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(cR(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return aS(r,t,e.legacy);let n=new lo({...t,analyticsAction:e.next}),o=yield br(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),po=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return iS(t,r);let n=hx("browseResults",t.getState),o=new lo({...t,analyticsAction:n}),a=yield AM(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),Mi=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dd(r,t,e.legacy);let n=new lo({...t,analyticsAction:{}}),o=yield CM(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),Zoe=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return oS(e,t);q(e,{id:H,q:H,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,a=uR(Jx()),i=yield bM(r,t.extra.navigatorContext,n,o,a),p=new lo({...t,analyticsAction:a},g=>{t.dispatch(Ed({q:g,id:e.id}))}),m=yield p.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=yield p.process(m);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),AM=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function AM(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),bM=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let a=_i(e,t,o);return Kr({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function bM(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),CM=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request.numberOfResults=0,n});return function CM(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),cR=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},uR=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function lR(_x158,_x159){return _lR.apply(this,arguments)}function _lR(){_lR=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??Xt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _lR.apply(this,arguments)}var Yc=me("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield lR(o,e),i=yield t.apiClient.html(a);return Xe(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),qd=N("resultPreview/next"),Md=N("resultPreview/previous"),pR=N("resultPreview/prepare",e=>q(e,{results:new ae({required:!0})})),dR=2048,Vd=me("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=ob(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>dR&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${dR} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function uS(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var lS=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=uS();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},dS=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Vi=fe(uS(),e=>{e.addCase(Yc.pending,t=>{t.isLoading=!0}).addCase(Yc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(qe.fulfilled,(t,r)=>{lS(t),t.resultsWithPreview=dS(r.payload.response.results)}).addCase(po.fulfilled,(t,r)=>{lS(t),t.resultsWithPreview=t.resultsWithPreview.concat(dS(r.payload.response.results))}).addCase(en.fulfilled,lS).addCase(pR,(t,r)=>{t.resultsWithPreview=dS(r.payload.results)}).addCase(qd,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Md,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Vd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var fo=(e,t)=>{let r=e;return J(r[t])?J(e.raw[t])?null:e.raw[t]:r[t]},xM=e=>t=>e.every(r=>!J(fo(t,r))),RM=e=>t=>e.every(r=>J(fo(t,r))),wM=(e,t)=>r=>{let n=fR(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},IM=(e,t)=>r=>{let n=fR(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},fR=(e,t)=>{let r=fo(t,e);return zu(r)?r:[r]},mR={getResultProperty:fo,fieldsMustBeDefined:xM,fieldsMustNotBeDefined:RM,fieldMustMatch:wM,fieldMustNotMatch:IM};function jd(e){return e.search.response.searchUid!==""}function gR(e,t,r){return e.search.results.find(n=>fo(n,t)===r)}var pS=lt(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var ji=N("app/setError");function fS(e,t){let r=t.payload??null;r&&(e.response=xt().response,e.results=[],e.questionAnswer=ri()),e.error=r,e.isLoading=!1}function mS(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function EM(e,t){mS(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function hR(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function FM(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Pe=fe(xt(),e=>{e.addCase(qe.rejected,(t,r)=>fS(t,r)),e.addCase(po.rejected,(t,r)=>fS(t,r)),e.addCase(en.rejected,(t,r)=>fS(t,r)),e.addCase(qe.fulfilled,(t,r)=>{EM(t,r)}),e.addCase(po.fulfilled,(t,r)=>{mS(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(en.fulfilled,(t,r)=>{mS(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Mi.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(qe.pending,hR),e.addCase(po.pending,FM),e.addCase(en.pending,hR),e.addCase(sR,(t,r)=>{t.searchAction=r.payload}),e.addCase(ji,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Ld=fe(hi(),e=>{e.addCase(dd,(t,r)=>r.payload).addCase(ot.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ei,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var yR=class extends Error{constructor(t){super(t[0].message);de(this,"issues");this.name="SchemaError",this.issues=t}};var Dn="uninitialized",hS="pending",Xc="fulfilled",Zc="rejected";function SR(e){return{status:e,isUninitialized:e===Dn,isLoading:e===hS,isSuccess:e===Xc,isError:e===Zc}}var vR=Br;function _R(e,t){if(e===t||!(vR(e)&&vR(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,a=Array.isArray(t)?[]:{};for(let i of r)a[i]=_R(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function yS(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function TM(e){return new RegExp("(^|:)//").test(e)}function PM(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function bS(e){return e!=null}function AR(e){return[...(e?.values()??[])].filter(bS)}function kM(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var OM=e=>e.replace(/\/$/,""),_M=e=>e.replace(/^\//,"");function NM(e,t){if(!e)return t;if(!t)return e;if(TM(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=OM(e),t=_M(t),`${e}${r}${t}`}function Bd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var SS=()=>new Map,DM=e=>{let t=new s.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},qM=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},bR=(...e)=>A(...e),MM=e=>e.status>=200&&e.status<=299,VM=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function CR(e){if(!Br(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var jM=e=>typeof e=="object"&&(Br(e)||Array.isArray(e)||typeof e.toJSON=="function");function NR({baseUrl:e,prepareHeaders:t=S=>S,fetchFn:r=bR,paramsSerializer:n,isJsonContentType:o=VM,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:m,validateStatus:f,...g}={}){return typeof A>"u"&&r===bR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(C,h,y){let{getState:x,extra:w,endpoint:E,forced:T,type:F}=h,O,{url:I,headers:k=new b(g.headers),params:P=void 0,responseHandler:_=m??"json",validateStatus:j=f??MM,timeout:B=p,...U}=typeof C=="string"?{url:C}:C,V={...g,signal:B?qM(h.signal,DM(B)):h.signal,...U};k=new b(CR(k)),V.headers=(yield t(k,{getState:x,arg:C,extra:w,endpoint:E,forced:T,type:F,extraOptions:y}))||k;let L=jM(V.body);if(V.body!=null&&!L&&typeof V.body!="string"&&V.headers.delete("content-type"),!V.headers.has("content-type")&&L&&V.headers.set("content-type",a),L&&o(V.headers)&&(V.body=JSON.stringify(V.body,i)),V.headers.has("accept")||(_==="json"?V.headers.set("accept","application/json"):_==="text"&&V.headers.set("accept","text/plain, text/html, */*")),P){let ce=~I.indexOf("?")?"&":"?",Ae=n?n(P):new URLSearchParams(CR(P));I+=ce+Ae}I=NM(e,I);let Q=new Request(I,V);O={request:new Request(I,V)};let z;try{z=yield r(Q)}catch(ce){return{error:{status:(ce instanceof Error||typeof DOMException<"u"&&ce instanceof DOMException)&&ce.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:O}}let ne=z.clone();O.response=ne;let Z,K="";try{let ce;if(yield Promise.all([S(z,_).then(Ae=>Z=Ae,Ae=>ce=Ae),ne.text().then(Ae=>K=Ae,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:z.status,data:K,error:String(ce)},meta:O}}return j(z,Z)?{data:Z,meta:O}:{error:{status:z.status,data:Z},meta:O}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function S(_x167,_x168){return _S2.apply(this,arguments)}function _S2(){_S2=_asyncToGenerator(function*(C,h){if(typeof h=="function")return h(C);if(h==="content-type"&&(h=o(C.headers)?"json":"text"),h==="json"){let y=yield C.text();return y.length?JSON.parse(y):null}return C.text()});return _S2.apply(this,arguments)}}var Li=class{constructor(e,t=void 0){de(this,"value");de(this,"meta");this.value=e,this.meta=t}};function LM(){return _LM.apply(this,arguments)}function _LM(){_LM=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((a,i)=>{let p=setTimeout(()=>a(),o);if(r){let m=()=>{clearTimeout(p),i(new Error("Aborted"))};r.aborted?(clearTimeout(p),i(new Error("Aborted"))):r.addEventListener("abort",m,{once:!0})}})});return _LM.apply(this,arguments)}function DR(e,t){throw Object.assign(new Li({error:e,meta:t}),{throwImmediately:!0})}function gS(e){e.aborted&&DR({status:"CUSTOM_ERROR",error:"Aborted"})}var xR={},UM=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let a=[5,(t||xR).maxRetries,(o||xR).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),m={maxRetries:i,backoff:LM,retryCondition:(g,S,{attempt:C})=>C<=i,...t,...o},f=0;for(;;){gS(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Li(g);return g}catch(g){if(f++,g.throwImmediately){if(g instanceof Li)return g.value;throw g}if(g instanceof Li){if(!m.retryCondition(g.value.error,r,{attempt:f,baseQueryApi:n,extraOptions:o}))return g.value}else if(f>m.maxRetries)return{error:g};gS(n.signal);try{yield m.backoff(f,m.maxRetries,n.signal)}catch(S){throw gS(n.signal),S}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),qR=Object.assign(UM,{fail:DR}),$d="__rtkq/",QM="online",BM="offline";var MR="focused";var CS=N(`${$d}${MR}`),VR=N(`${$d}un${MR}`),xS=N(`${$d}${QM}`),jR=N(`${$d}${BM}`);var tu="query",LR="mutation",UR="infinitequery";function Hd(e){return e.type===tu}function GM(e){return e.type===LR}function zd(e){return e.type===UR}function Gd(e){return Hd(e)||zd(e)}function RS(e,t,r,n,o,a){let i=$M(e)?e(t,r,n,o):e;return i?yS(i,bS,p=>a(QR(p))):[]}function $M(e){return typeof e=="function"}function QR(e){return typeof e=="string"?{type:e}:e}function HM(e,t){return e.catch(t)}var Ui=(e,t)=>e.endpointDefinitions[t],Jc=Symbol("forceQueryFn"),vS=e=>typeof e[Jc]=="function";function zM({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=I=>i(I)?.runningQueries,m=I=>i(I)?.runningMutations,{unsubscribeQueryResult:f,removeMutationResult:g,updateSubscriptionOptions:S}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:F,buildInitiateMutation:O,getRunningQueryThunk:C,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:x};function C(I,k){return P=>{let _=Ui(a,I),j=e({queryArgs:k,endpointDefinition:_,endpointName:I});return p(P)?.get(j)}}function h(I,k){return P=>m(P)?.get(k)}function y(){return I=>AR(p(I))}function x(){return I=>AR(m(I))}function w(I){}function E(I,k){let P=(_,{subscribe:j=!0,forceRefetch:B,subscriptionOptions:U,[Jc]:V,...L}={})=>(Q,W)=>{let z=e({queryArgs:_,endpointDefinition:k,endpointName:I}),ne,Z={...L,type:tu,subscribe:j,forceRefetch:B,subscriptionOptions:U,endpointName:I,originalArgs:_,queryCacheKey:z,[Jc]:V};if(Hd(k))ne=t(Z);else{let{direction:Ee,initialPageParam:Me,refetchCachedPages:_e}=L;ne=r({...Z,direction:Ee,initialPageParam:Me,refetchCachedPages:_e})}let K=o.endpoints[I].select(_),ce=Q(ne),Ae=K(W());let{requestId:Ge,abort:it}=ce,Ye=Ae.requestId!==Ge,rt=p(Q)?.get(z),nt=()=>K(W()),Oe=Object.assign(V?ce.then(nt):Ye&&!rt?Promise.resolve(Ae):Promise.all([rt,ce]).then(nt),{arg:_,requestId:Ge,subscriptionOptions:U,queryCacheKey:z,abort:it,unwrap(){return _asyncToGenerator(function*(){let Ee=yield Oe;if(Ee.isError)throw Ee.error;return Ee.data})()},refetch:Ee=>Q(P(_,{subscribe:!1,forceRefetch:!0,...Ee})),unsubscribe(){j&&Q(f({queryCacheKey:z,requestId:Ge}))},updateSubscriptionOptions(Ee){Oe.subscriptionOptions=Ee,Q(S({endpointName:I,requestId:Ge,queryCacheKey:z,options:Ee}))}});if(!rt&&!Ye&&!V){let Ee=p(Q);Ee.set(z,Oe),Oe.then(()=>{Ee.delete(z)})}return Oe};return P}function T(I,k){return E(I,k)}function F(I,k){return E(I,k)}function O(I){return(k,{track:P=!0,fixedCacheKey:_}={})=>(j,B)=>{let U=n({type:"mutation",endpointName:I,originalArgs:k,track:P,fixedCacheKey:_}),V=j(U);let{requestId:L,abort:Q,unwrap:W}=V,z=HM(V.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),ne=()=>{j(g({requestId:L,fixedCacheKey:_}))},Z=Object.assign(z,{arg:V.arg,requestId:L,abort:Q,unwrap:W,reset:ne}),K=m(j);return K.set(L,Z),Z.then(()=>{K.delete(L)}),_&&(K.set(_,Z),Z.then(()=>{K.get(_)===Z&&K.delete(_)})),Z}}}var BR=class extends yR{constructor(t,r,n,o){super(t);de(this,"value");de(this,"schemaName");de(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},ra=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function na(_x172,_x173,_x174,_x175){return _na.apply(this,arguments)}function _na(){_na=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new BR(o.issues,t,r,n);return o.value});return _na.apply(this,arguments)}function RR(e){return e}var Kc=(e={})=>({...e,[_c]:!0});function WM({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:m,skipSchemaValidation:f}){let g=(U,V,L,Q)=>(W,z)=>{let ne=r[U],Z=n({queryArgs:V,endpointDefinition:ne,endpointName:U});if(W(o.internalActions.queryResultPatched({queryCacheKey:Z,patches:L})),!Q)return;let K=o.endpoints[U].select(V)(z()),ce=RS(ne.providesTags,K.data,void 0,V,{},a);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function S(U,V,L=0){let Q=[V,...U];return L&&Q.length>L?Q.slice(0,-1):Q}function C(U,V,L=0){let Q=[...U,V];return L&&Q.length>L?Q.slice(1):Q}let h=(U,V,L,Q=!0)=>(W,z)=>{let Z=o.endpoints[U].select(V)(z()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(U,V,K.inversePatches,Q))};if(Z.status===Dn)return K;let ce;if("data"in Z)if(jt(Z.data)){let[Ae,Ge,it]=zh(Z.data,L);K.patches.push(...Ge),K.inversePatches.push(...it),ce=Ae}else ce=L(Z.data),K.patches.push({op:"replace",path:[],value:ce}),K.inversePatches.push({op:"replace",path:[],value:Z.data});return K.patches.length===0||W(o.util.patchQueryData(U,V,K.patches,Q)),K},y=(U,V,L)=>Q=>Q(o.endpoints[U].initiate(V,{subscribe:!1,forceRefetch:!0,[Jc]:()=>({data:L})})),x=(U,V)=>U.query&&U[V]?U[V]:RR,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(U,{signal:V,abort:L,rejectWithValue:Q,fulfillWithValue:W,dispatch:z,getState:ne,extra:Z}){let K=r[U.endpointName],{metaSchema:ce,skipSchemaValidation:Ae=f}=K,Ge=U.type===tu;try{let it=RR,Ye={signal:V,abort:L,dispatch:z,getState:ne,extra:Z,endpoint:U.endpointName,type:U.type,forced:Ge?E(U,ne()):void 0,queryCacheKey:Ge?U.queryCacheKey:void 0},rt=Ge?U[Jc]:void 0,nt,Oe=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(Me,_e,ht,Ct){if(_e==null&&Me.pages.length)return Promise.resolve({data:Me});let Fr={queryArg:U.originalArgs,pageParam:_e},sr=yield Ee(Fr),Ur=Ct?S:C;return{data:{pages:Ur(Me.pages,sr.data,ht),pageParams:Ur(Me.pageParams,_e,ht)},meta:sr.meta}});return function Oe(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Ee(_x182){return _Ee.apply(this,arguments)}function _Ee(){_Ee=_asyncToGenerator(function*(Me){let _e,{extraOptions:ht,argSchema:Ct,rawResponseSchema:Fr,responseSchema:sr}=K;if(Ct&&!ra(Ae,"arg")&&(Me=yield na(Ct,Me,"argSchema",{})),rt?_e=rt():K.query?(it=x(K,"transformResponse"),_e=yield t(K.query(Me),Ye,ht)):_e=yield K.queryFn(Me,Ye,ht,Tr=>t(Tr,Ye,ht)),typeof process<"u",_e.error)throw new Li(_e.error,_e.meta);let{data:Ur}=_e;Fr&&!ra(Ae,"rawResponse")&&(Ur=yield na(Fr,_e.data,"rawResponseSchema",_e.meta));let gr=yield it(Ur,_e.meta,Me);return sr&&!ra(Ae,"response")&&(gr=yield na(sr,gr,"responseSchema",_e.meta)),{..._e,data:gr}});return _Ee.apply(this,arguments)}if(Ge&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:Me}=K,{maxPages:_e=1/0}=Me,ht=U.refetchCachedPages??Me.refetchCachedPages??!0,Ct,Fr={pages:[],pageParams:[]},sr=i.selectQueryEntry(ne(),U.queryCacheKey)?.data,gr=E(U,ne())&&!U.direction||!sr?Fr:sr;if("direction"in U&&U.direction&&gr.pages.length){let Tr=U.direction==="backward",Lu=(Tr?GR:AS)(Me,gr,U.originalArgs);Ct=yield Oe(gr,Lu,_e,Tr)}else{let{initialPageParam:Tr=Me.initialPageParam}=U,nc=sr?.pageParams??[],Lu=nc[0]??Tr,rO=nc.length;if(Ct=yield Oe(gr,Lu,_e),rt&&(Ct={data:Ct.data.pages[0]}),ht)for(let oA=1;oA<rO;oA++){let nO=AS(Me,Ct.data,U.originalArgs);Ct=yield Oe(Ct.data,nO,_e)}}nt=Ct}else nt=yield Ee(U.originalArgs);return ce&&!ra(Ae,"meta")&&nt.meta&&(nt.meta=yield na(ce,nt.meta,"metaSchema",nt.meta)),W(nt.data,Kc({fulfilledTimeStamp:Date.now(),baseQueryMeta:nt.meta}))}catch(it){let Ye=it;if(Ye instanceof Li){let rt=x(K,"transformErrorResponse"),{rawErrorResponseSchema:nt,errorResponseSchema:Oe}=K,{value:Ee,meta:Me}=Ye;try{nt&&!ra(Ae,"rawErrorResponse")&&(Ee=yield na(nt,Ee,"rawErrorResponseSchema",Me)),ce&&!ra(Ae,"meta")&&(Me=yield na(ce,Me,"metaSchema",Me));let _e=yield rt(Ee,Me,U.originalArgs);return Oe&&!ra(Ae,"errorResponse")&&(_e=yield na(Oe,_e,"errorResponseSchema",Me)),Q(_e,Kc({baseQueryMeta:Me}))}catch(_e){Ye=_e}}try{if(Ye instanceof BR){let rt={endpoint:U.endpointName,arg:U.originalArgs,type:U.type,queryCacheKey:Ge?U.queryCacheKey:void 0};K.onSchemaFailure?.(Ye,rt),p?.(Ye,rt);let{catchSchemaFailure:nt=m}=K;if(nt)return Q(nt(Ye,rt),Kc({baseQueryMeta:Ye._bqMeta}))}}catch(rt){Ye=rt}throw typeof process<"u",console.error(Ye),Ye}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function E(U,V){let L=i.selectQueryEntry(V,U.queryCacheKey),Q=i.selectConfig(V).refetchOnMountOrArgChange,W=L?.fulfilledTimeStamp,z=U.forceRefetch??(U.subscribe&&Q);return z?z===!0||(Number(new Date)-Number(W))/1e3>=z:!1}let T=()=>me(`${e}/executeQuery`,w,{getPendingMeta({arg:V}){let L=r[V.endpointName];return Kc({startedTimeStamp:Date.now(),...(zd(L)?{direction:V.direction}:{})})},condition(V,{getState:L}){let Q=L(),W=i.selectQueryEntry(Q,V.queryCacheKey),z=W?.fulfilledTimeStamp,ne=V.originalArgs,Z=W?.originalArgs,K=r[V.endpointName],ce=V.direction;return vS(V)?!0:W?.status==="pending"?!1:E(V,Q)||Hd(K)&&K?.forceRefetch?.({currentArg:ne,previousArg:Z,endpointState:W,state:Q})?!0:!(z&&!ce)},dispatchConditionRejection:!0}),F=T(),O=T(),I=me(`${e}/executeMutation`,w,{getPendingMeta(){return Kc({startedTimeStamp:Date.now()})}}),k=U=>"force"in U,P=U=>"ifOlderThan"in U,_=(U,V,L={})=>(Q,W)=>{let z=k(L)&&L.force,ne=P(L)&&L.ifOlderThan,Z=(ce=!0)=>{let Ae={forceRefetch:ce,subscribe:!1};return o.endpoints[U].initiate(V,Ae)},K=o.endpoints[U].select(V)(W());if(z)Q(Z());else if(ne){let ce=K?.fulfilledTimeStamp;if(!ce){Q(Z());return}(Number(new Date)-Number(new Date(ce)))/1e3>=ne&&Q(Z())}else Q(Z(!1))};function j(U){return V=>V?.meta?.arg?.endpointName===U}function B(U,V){return{matchPending:ui(Tl(U),j(V)),matchFulfilled:ui(Pn(U),j(V)),matchRejected:ui(zo(U),j(V))}}return{queryThunk:F,mutationThunk:I,infiniteQueryThunk:O,prefetch:_,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:B}}function AS(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function GR(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function $R(e,t,r,n){return RS(r[e.meta.arg.endpointName][t],Pn(e)?e.payload:void 0,Dc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function wR(e){return zt(e)?bl(e):e}function Ud(e,t,r){let n=e[t];n&&r(n)}function eu(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function IR(e,t,r){let n=e[eu(t)];n&&r(n)}var Qd={};function YM({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:m,config:f}){let g=N(`${e}/resetApiState`);function S(j,B,U,V){var L;j[L=B.queryCacheKey]??(j[L]={status:Dn,endpointName:B.endpointName}),Ud(j,B.queryCacheKey,Q=>{Q.status=hS,Q.requestId=U&&Q.requestId?Q.requestId:V.requestId,B.originalArgs!==void 0&&(Q.originalArgs=B.originalArgs),Q.startedTimeStamp=V.startedTimeStamp;let W=o[V.arg.endpointName];zd(W)&&"direction"in B&&(Q.direction=B.direction)})}function C(j,B,U,V){Ud(j,B.arg.queryCacheKey,L=>{if(L.requestId!==B.requestId&&!V)return;let{merge:Q}=o[B.arg.endpointName];if(L.status=Xc,Q){if(L.data!==void 0){let{fulfilledTimeStamp:W,arg:z,baseQueryMeta:ne,requestId:Z}=B,K=$o(L.data,ce=>Q(ce,U,{arg:z.originalArgs,baseQueryMeta:ne,fulfilledTimeStamp:W,requestId:Z}));L.data=K}else L.data=U;}else L.data=o[B.arg.endpointName].structuralSharing??!0?_R(zt(L.data)?Ib(L.data):L.data,U):U;delete L.error,L.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Wo({name:`${e}/queries`,initialState:Qd,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:B}}){delete j[B]},prepare:li()},cacheEntriesUpserted:{reducer(j,B){for(let U of B.payload){let{queryDescription:V,value:L}=U;S(j,V,!0,{arg:V,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),C(j,{arg:V,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},L,!0)}},prepare:j=>({payload:j.map(V=>{let{endpointName:L,arg:Q,value:W}=V,z=o[L];return{queryDescription:{type:tu,endpointName:L,originalArgs:V.arg,queryCacheKey:n({queryArgs:Q,endpointDefinition:z,endpointName:L})},value:W}}),meta:{[_c]:!0,requestId:qc(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:B,patches:U}}){Ud(j,B,V=>{V.data=Wh(V.data,U.concat())})},prepare:li()}},extraReducers(j){j.addCase(t.pending,(B,{meta:U,meta:{arg:V}})=>{let L=vS(V);S(B,V,L,U)}).addCase(t.fulfilled,(B,{meta:U,payload:V})=>{let L=vS(U.arg);C(B,U,V,L)}).addCase(t.rejected,(B,{meta:{condition:U,arg:V,requestId:L},error:Q,payload:W})=>{Ud(B,V.queryCacheKey,z=>{if(!U){if(z.requestId!==L)return;z.status=Zc,z.error=W??Q}})}).addMatcher(p,(B,U)=>{let{queries:V}=i(U);for(let[L,Q]of Object.entries(V))(Q?.status===Xc||Q?.status===Zc)&&(B[L]=Q)})}}),y=Wo({name:`${e}/mutations`,initialState:Qd,reducers:{removeMutationResult:{reducer(j,{payload:B}){let U=eu(B);U in j&&delete j[U]},prepare:li()}},extraReducers(j){j.addCase(r.pending,(B,{meta:U,meta:{requestId:V,arg:L,startedTimeStamp:Q}})=>{L.track&&(B[eu(U)]={requestId:V,status:hS,endpointName:L.endpointName,startedTimeStamp:Q})}).addCase(r.fulfilled,(B,{payload:U,meta:V})=>{V.arg.track&&IR(B,V,L=>{L.requestId===V.requestId&&(L.status=Xc,L.data=U,L.fulfilledTimeStamp=V.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:U,error:V,meta:L})=>{L.arg.track&&IR(B,L,Q=>{Q.requestId===L.requestId&&(Q.status=Zc,Q.error=U??V)})}).addMatcher(p,(B,U)=>{let{mutations:V}=i(U);for(let[L,Q]of Object.entries(V))(Q?.status===Xc||Q?.status===Zc)&&L!==Q?.requestId&&(B[L]=Q)})}}),x={tags:{},keys:{}},w=Wo({name:`${e}/invalidation`,initialState:x,reducers:{updateProvidedBy:{reducer(j,B){var U,V,L;for(let{queryCacheKey:Q,providedTags:W}of B.payload){E(j,Q);for(let{type:z,id:ne}of W){let Z=(V=(U=j.tags)[z]??(U[z]={}))[L=ne||"__internal_without_id"]??(V[L]=[]);Z.includes(Q)||Z.push(Q)}j.keys[Q]=W}},prepare:li()}},extraReducers(j){j.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:U}})=>{E(B,U)}).addMatcher(p,(B,U)=>{var L,Q,W;let{provided:V}=i(U);for(let[z,ne]of Object.entries(V.tags??{}))for(let[Z,K]of Object.entries(ne)){let ce=(Q=(L=B.tags)[z]??(L[z]={}))[W=Z||"__internal_without_id"]??(Q[W]=[]);for(let Ae of K)ce.includes(Ae)||ce.push(Ae),B.keys[Ae]=V.keys[Ae]}}).addMatcher(Gr(Pn(t),Dc(t)),(B,U)=>{T(B,[U])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,U)=>{let V=U.payload.map(({queryDescription:L,value:Q})=>({type:"UNKNOWN",payload:Q,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:L}}));T(B,V)})}});function E(j,B){let U=wR(j.keys[B]??[]);for(let V of U){let L=V.type,Q=V.id??"__internal_without_id",W=j.tags[L]?.[Q];W&&(j.tags[L][Q]=wR(W).filter(z=>z!==B))}delete j.keys[B]}function T(j,B){let U=B.map(V=>{let L=$R(V,"providesTags",o,m),{queryCacheKey:Q}=V.meta.arg;return{queryCacheKey:Q,providedTags:L}});w.caseReducers.updateProvidedBy(j,w.actions.updateProvidedBy(U))}let F=Wo({name:`${e}/subscriptions`,initialState:Qd,reducers:{updateSubscriptionOptions(j,B){},unsubscribeQueryResult(j,B){},internal_getRTKQSubscriptions(){}}}),O=Wo({name:`${e}/internalSubscriptions`,initialState:Qd,reducers:{subscriptionsUpdated:{reducer(j,B){return Wh(j,B.payload)},prepare:li()}}}),I=Wo({name:`${e}/config`,initialState:{online:kM(),focused:PM(),middlewareRegistered:!1,...f},reducers:{middlewareRegistered(j,{payload:B}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:j=>{j.addCase(xS,B=>{B.online=!0}).addCase(jR,B=>{B.online=!1}).addCase(CS,B=>{B.focused=!0}).addCase(VR,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),k=oi({queries:h.reducer,mutations:y.reducer,provided:w.reducer,subscriptions:O.reducer,config:I.reducer}),P=(j,B)=>k(g.match(B)?void 0:j,B),_={...I.actions,...h.actions,...F.actions,...O.actions,...y.actions,...w.actions,resetApiState:g};return{reducer:P,actions:_}}var oa=Symbol.for("RTKQ/skipToken"),HR={status:Dn},ER=$o(HR,()=>{}),FR=$o(HR,()=>{});function KM({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=F=>ER,o=F=>FR;return{buildQuerySelector:C,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:x,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:f,selectQueryEntry:m,selectConfig:g};function a(F){return{...F,...SR(F.status)}}function i(F){return F[t]}function p(F){return i(F)?.queries}function m(F,O){return p(F)?.[O]}function f(F){return i(F)?.mutations}function g(F){return i(F)?.config}function S(F,O,I){return k=>{if(k===oa)return r(n,I);let P=e({queryArgs:k,endpointDefinition:O,endpointName:F});return r(j=>m(j,P)??ER,I)}}function C(F,O){return S(F,O,a)}function h(F,O){let{infiniteQueryOptions:I}=O;function k(P){let _={...P,...SR(P.status)},{isLoading:j,isError:B,direction:U}=_,V=U==="forward",L=U==="backward";return{..._,hasNextPage:E(I,_.data,_.originalArgs),hasPreviousPage:T(I,_.data,_.originalArgs),isFetchingNextPage:j&&V,isFetchingPreviousPage:j&&L,isFetchNextPageError:B&&V,isFetchPreviousPageError:B&&L}}return S(F,O,k)}function y(){return F=>{let O;return typeof F=="object"?O=eu(F)??oa:O=F,r(O===oa?o:P=>i(P)?.mutations?.[O]??FR,a)}}function x(F,O){let I=F[t],k=new Set,P=yS(O,bS,QR);for(let _ of P){let j=I.provided.tags[_.type];if(!j)continue;let B=(_.id!==void 0?j[_.id]:Object.values(j).flat())??[];for(let U of B)k.add(U)}return Array.from(k.values()).flatMap(_=>{let j=I.queries[_];return j?{queryCacheKey:_,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function w(F,O){return yS(Object.values(p(F)),I=>I?.endpointName===O&&I.status!==Dn,I=>I.originalArgs)}function E(F,O,I){return O?AS(F,O,I)!=null:!1}function T(F,O,I){return!O||!F.getPreviousPageParam?!1:GR(F,O,I)!=null}}var TR=WeakMap?new WeakMap:void 0,PR=({endpointName:e,queryArgs:t})=>{let r="",n=TR?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(a,i)=>(i=typeof i=="bigint"?{$bigint:i.toString()}:i,i=Br(i)?Object.keys(i).sort().reduce((p,m)=>(p[m]=i[m],p),{}):i,i));Br(t)&&TR?.set(t,o),r=o}return`${e}(${r})`};function XM(...e){return function(r){let n=si(f=>r.extractRehydrationInfo?.(f,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(f){let g=PR;if("serializeQueryArgs"in f.endpointDefinition){let S=f.endpointDefinition.serializeQueryArgs;g=C=>{let h=S(C);return typeof h=="string"?h:PR({...C,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(f)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(f){f()},apiUid:qc(),extractRehydrationInfo:n,hasRehydrationInfo:si(f=>n(f)!=null)},i={injectEndpoints:m,enhanceEndpoints({addTagTypes:f,endpoints:g}){if(f)for(let S of f)o.tagTypes.includes(S)||o.tagTypes.push(S);if(g)for(let[S,C]of Object.entries(g))typeof C=="function"?C(Ui(a,S)):Object.assign(Ui(a,S)||{},C);return i}},p=e.map(f=>f.init(i,o,a));function m(f){let g=f.endpoints({query:S=>({...S,type:tu}),mutation:S=>({...S,type:LR}),infiniteQuery:S=>({...S,type:UR})});for(let[S,C]of Object.entries(g)){if(f.overrideExisting!==!0&&S in a.endpointDefinitions){if(f.overrideExisting==="throw")throw new Error(Wt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[S]=C;for(let h of p)h.injectEndpoint(S,C)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Nn(e,...t){return Object.assign(e,...t)}var ZM=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:m}=e.internalActions,f=(x,w)=>{if(p.match(w)){let{queryCacheKey:T,requestId:F,options:O}=w.payload,I=x.get(T);return I?.has(F)&&I.set(F,O),!0}if(m.match(w)){let{queryCacheKey:T,requestId:F}=w.payload,O=x.get(T);return O&&O.delete(F),!0}if(e.internalActions.removeQueryResult.match(w))return x.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:T,requestId:F}}=w,O=Bd(x,T.queryCacheKey,SS);return T.subscribe&&O.set(F,T.subscriptionOptions??O.get(F)??{}),!0}let E=!1;if(t.rejected.match(w)){let{meta:{condition:T,arg:F,requestId:O}}=w;if(T&&F.subscribe){let I=Bd(x,F.queryCacheKey,SS);I.set(O,F.subscriptionOptions??I.get(O)??{}),E=!0}}return E},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:x=>g().get(x)?.size??0,isRequestSubscribed:(x,w)=>!!g()?.get(x)?.get(w)};function y(x){return JSON.parse(JSON.stringify(Object.fromEntries([...x].map(([w,E])=>[w,Object.fromEntries(E)]))))}return(x,w)=>{if(a||(a=y(r.currentSubscriptions)),e.util.resetApiState.match(x))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(x))return[!1,h];let E=f(r.currentSubscriptions,x),T=!0;if(E){i||(i=setTimeout(()=>{let I=y(r.currentSubscriptions),[,k]=zh(a,()=>I);w.next(e.internalActions.subscriptionsUpdated(k)),a=I,i=null},500));let F=typeof x.type=="string"&&!!x.type.startsWith(o),O=t.rejected.match(x)&&x.meta.condition&&!!x.meta.arg.subscribe;T=!F&&!O}return[T,!1]}},JM=2147483647/1e3-1,eV=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:p,mwApi:m})=>{let{removeQueryResult:f,unsubscribeQueryResult:g,cacheEntriesUpserted:S}=t.internalActions,C=Gr(g.match,r.fulfilled,r.rejected,S.match);function h(F){let O=o.currentSubscriptions.get(F);return O?O.size>0:!1}let y={};function x(F){for(let O of F.values())O?.abort?.()}let w=(F,O)=>{let I=O.getState(),k=i(I);if(C(F)){let P;if(S.match(F))P=F.payload.map(_=>_.queryDescription.queryCacheKey);else{let{queryCacheKey:_}=g.match(F)?F.payload:F.meta.arg;P=[_]}E(P,O,k)}if(t.util.resetApiState.match(F)){for(let[P,_]of Object.entries(y))_&&clearTimeout(_),delete y[P];x(o.runningQueries),x(o.runningMutations)}if(n.hasRehydrationInfo(F)){let{queries:P}=n.extractRehydrationInfo(F);E(Object.keys(P),O,k)}};function E(F,O,I){let k=O.getState();for(let P of F){let _=a(k,P);_?.endpointName&&T(P,_.endpointName,O,I)}}function T(F,O,I,k){let _=Ui(n,O)?.keepUnusedDataFor??k.keepUnusedDataFor;if(_===1/0)return;let j=Math.max(0,Math.min(_,JM));if(!h(F)){let B=y[F];B&&clearTimeout(B),y[F]=setTimeout(()=>{if(!h(F)){let U=a(I.getState(),F);U?.endpointName&&I.dispatch(p(U.endpointName,U.originalArgs))?.abort(),I.dispatch(f({queryCacheKey:F}))}delete y[F]},j*1e3)}}return w},kR=new Error("Promise never resolved before cacheEntryRemoved."),tV=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let m=Pl(n),f=Pl(o),g=Pn(n,o),S={},{removeQueryResult:C,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function x(I,k,P){let _=S[I];_?.valueResolved&&(_.valueResolved({data:k,meta:P}),delete _.valueResolved)}function w(I){let k=S[I];k&&(delete S[I],k.cacheEntryRemoved())}function E(I){let{arg:k,requestId:P}=I.meta,{endpointName:_,originalArgs:j}=k;return[_,j,P]}let T=(I,k,P)=>{let _=F(I);function j(B,U,V,L){let Q=i(P,U),W=i(k.getState(),U);!Q&&W&&O(B,L,U,k,V)}if(n.pending.match(I)){let[B,U,V]=E(I);j(B,_,V,U)}else if(y.match(I))for(let{queryDescription:B,value:U}of I.payload){let{endpointName:V,originalArgs:L,queryCacheKey:Q}=B;j(V,Q,I.meta.requestId,L),x(Q,U,{})}else if(o.pending.match(I)){if(k.getState()[t].mutations[_]){let[U,V,L]=E(I);O(U,V,_,k,L)}}else if(g(I))x(_,I.payload,I.meta.baseQueryMeta);else if(C.match(I)||h.match(I))w(_);else if(e.util.resetApiState.match(I))for(let B of Object.keys(S))w(B)};function F(I){return m(I)?I.meta.arg.queryCacheKey:f(I)?I.meta.arg.fixedCacheKey??I.meta.requestId:C.match(I)?I.payload.queryCacheKey:h.match(I)?eu(I.payload):""}function O(I,k,P,_,j){let B=Ui(r,I),U=B?.onCacheEntryAdded;if(!U)return;let V={},L=new Promise(K=>{V.cacheEntryRemoved=K}),Q=Promise.race([new Promise(K=>{V.valueResolved=K}),L.then(()=>{throw kR})]);Q.catch(()=>{}),S[P]=V;let W=e.endpoints[I].select(Gd(B)?k:P),z=_.dispatch((K,ce,Ae)=>Ae),ne={..._,getCacheEntry:()=>W(_.getState()),requestId:j,extra:z,updateCachedData:Gd(B)?K=>_.dispatch(e.util.updateQueryData(I,k,K)):void 0,cacheDataLoaded:Q,cacheEntryRemoved:L},Z=U(k,ne);Promise.resolve(Z).catch(K=>{if(K!==kR)throw K})}return T},rV=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},nV=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:p,internalState:m})=>{let{removeQueryResult:f}=a.internalActions,g=Gr(Pn(n),Dc(n)),S=Gr(Pn(o,n),zo(o,n)),C=[],h=0,y=(E,T)=>{(o.pending.match(E)||n.pending.match(E))&&h++,S(E)&&(h=Math.max(0,h-1)),g(E)?w($R(E,"invalidatesTags",r,i),T):S(E)?w([],T):a.util.invalidateTags.match(E)&&w(RS(E.payload,void 0,void 0,void 0,void 0,i),T)};function x(){return h>0}function w(E,T){let F=T.getState(),O=F[e];if(C.push(...E),O.config.invalidationBehavior==="delayed"&&x())return;let I=C;if(C=[],I.length===0)return;let k=a.util.selectInvalidatedBy(F,I);t.batch(()=>{let P=Array.from(k.values());for(let{queryCacheKey:_}of P){let j=O.queries[_],B=Bd(m.currentSubscriptions,_,SS);j&&(B.size===0?T.dispatch(f({queryCacheKey:_})):j.status!==Dn&&T.dispatch(p(j)))}})}return y},oV=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,m=null,f=(w,E)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,E),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,E),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&S(w.meta.arg,E),r.util.resetApiState.match(w)&&(y(),m&&(clearTimeout(m),m=null),p.clear())};function g(w,E){p.add(w),m||(m=setTimeout(()=>{for(let T of p)C({queryCacheKey:T},E);p.clear(),m=null},0))}function S({queryCacheKey:w},E){let T=E.getState()[e],F=T.queries[w],O=i.get(w);if(!F||F.status===Dn)return;let{lowestPollingInterval:I,skipPollingIfUnfocused:k}=x(O);if(!Number.isFinite(I))return;let P=a.get(w);P?.timeout&&(clearTimeout(P.timeout),P.timeout=void 0);let _=Date.now()+I;a.set(w,{nextPollTimestamp:_,pollingInterval:I,timeout:setTimeout(()=>{(T.config.focused||!k)&&E.dispatch(n(F)),S({queryCacheKey:w},E)},I)})}function C({queryCacheKey:w},E){let F=E.getState()[e].queries[w],O=i.get(w);if(!F||F.status===Dn)return;let{lowestPollingInterval:I}=x(O);if(!Number.isFinite(I)){h(w);return}let k=a.get(w),P=Date.now()+I;(!k||P<k.nextPollTimestamp)&&S({queryCacheKey:w},E)}function h(w){let E=a.get(w);E?.timeout&&clearTimeout(E.timeout),a.delete(w)}function y(){for(let w of a.keys())h(w)}function x(w=new Map){let E=!1,T=Number.POSITIVE_INFINITY;for(let F of w.values())F.pollingInterval&&(T=Math.min(F.pollingInterval,T),E=F.skipPollingIfUnfocused||E);return{lowestPollingInterval:T,skipPollingIfUnfocused:E}}return f},aV=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Tl(r,n),a=zo(r,n),i=Pn(r,n),p={};return(f,g)=>{if(o(f)){let{requestId:S,arg:{endpointName:C,originalArgs:h}}=f.meta,y=Ui(t,C),x=y?.onQueryStarted;if(x){let w={},E=new Promise((I,k)=>{w.resolve=I,w.reject=k});E.catch(()=>{}),p[S]=w;let T=e.endpoints[C].select(Gd(y)?h:S),F=g.dispatch((I,k,P)=>P),O={...g,getCacheEntry:()=>T(g.getState()),requestId:S,extra:F,updateCachedData:Gd(y)?I=>g.dispatch(e.util.updateQueryData(C,h,I)):void 0,queryFulfilled:E};x(h,O)}}else if(i(f)){let{requestId:S,baseQueryMeta:C}=f.meta;p[S]?.resolve({data:f.payload,meta:C}),delete p[S]}else if(a(f)){let{requestId:S,rejectedWithValue:C,baseQueryMeta:h}=f.meta;p[S]?.reject({error:f.payload??f.error,isUnhandledError:!C,meta:h}),delete p[S]}}},iV=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(m,f)=>{CS.match(m)&&p(f,"refetchOnFocus"),xS.match(m)&&p(f,"refetchOnReconnect")};function p(m,f){let g=m.getState()[e],S=g.queries,C=o.currentSubscriptions;t.batch(()=>{for(let h of C.keys()){let y=S[h],x=C.get(h);if(!x||!y)continue;let w=[...x.values()];(w.some(T=>T[f]===!0)||w.every(T=>T[f]===void 0)&&g.config[f])&&(x.size===0?m.dispatch(a({queryCacheKey:h})):y.status!==Dn&&m.dispatch(n(y)))}})}return i};function sV(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:N(`${t}/invalidateTags`)},m=C=>C.type.startsWith(`${t}/`),f=[rV,eV,nV,oV,tV,aV];return{middleware:C=>{let h=!1,y=a(C.dispatch),x={...e,internalState:y,refetchQuery:S,isThisApiSliceAction:m,mwApi:C},w=f.map(F=>F(x)),E=ZM(x),T=iV(x);return F=>O=>{if(!vc(O))return F(O);h||(h=!0,C.dispatch(n.internalActions.middlewareRegistered(i)));let I={...C,next:F},k=C.getState(),[P,_]=E(O,I,k),j;if(P?j=F(O):j=_,C.getState()[t]&&(T(O,I,k),m(O)||o.hasRehydrationInfo(O)))for(let B of w)B(O,I,k);return j}},actions:p};function S(C){return e.api.endpoints[C.endpointName].initiate(C.originalArgs,{subscribe:!1,forceRefetch:!0})}}var OR=Symbol(),cV=({createSelector:e=lt}={})=>({name:OR,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:m,refetchOnReconnect:f,invalidationBehavior:g,onSchemaFailure:S,catchSchemaFailure:C,skipSchemaValidation:h},y){_b();let x=Oe=>(typeof process<"u",Oe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:xS,onOffline:jR,onFocus:CS,onFocusLost:VR},util:{}});let w=KM({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:E,selectCachedArgsForQuery:T,buildQuerySelector:F,buildInfiniteQuerySelector:O,buildMutationSelector:I}=w;Nn(t.util,{selectInvalidatedBy:E,selectCachedArgsForQuery:T});let{queryThunk:k,infiniteQueryThunk:P,mutationThunk:_,patchQueryData:j,updateQueryData:B,upsertQueryData:U,prefetch:V,buildMatchThunkActions:L}=WM({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:a,assertTagType:x,selectors:w,onSchemaFailure:S,catchSchemaFailure:C,skipSchemaValidation:h}),{reducer:Q,actions:W}=YM({context:y,queryThunk:k,infiniteQueryThunk:P,mutationThunk:_,serializeQueryArgs:a,reducerPath:o,assertTagType:x,config:{refetchOnFocus:m,refetchOnReconnect:f,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Nn(t.util,{patchQueryData:j,updateQueryData:B,upsertQueryData:U,prefetch:V,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),Nn(t.internalActions,W);let z=new WeakMap,ne=Oe=>Bd(z,Oe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:Ae,getRunningMutationsThunk:Ge,getRunningQueriesThunk:it,getRunningQueryThunk:Ye}=zM({queryThunk:k,mutationThunk:_,infiniteQueryThunk:P,api:t,serializeQueryArgs:a,context:y,getInternalState:ne});Nn(t.util,{getRunningMutationThunk:Ae,getRunningMutationsThunk:Ge,getRunningQueryThunk:Ye,getRunningQueriesThunk:it});let{middleware:rt,actions:nt}=sV({reducerPath:o,context:y,queryThunk:k,mutationThunk:_,infiniteQueryThunk:P,api:t,assertTagType:x,selectors:w,getRunningQueryThunk:Ye,getInternalState:ne});return Nn(t.util,nt),Nn(t,{reducer:Q,middleware:rt}),{name:OR,injectEndpoint(Oe,Ee){var ht;let _e=(ht=t.endpoints)[Oe]??(ht[Oe]={});Hd(Ee)&&Nn(_e,{name:Oe,select:F(Oe,Ee),initiate:Z(Oe,Ee)},L(k,Oe)),GM(Ee)&&Nn(_e,{name:Oe,select:I(),initiate:ce(Oe)},L(_,Oe)),zd(Ee)&&Nn(_e,{name:Oe,select:O(Oe,Ee),initiate:K(Oe,Ee)},L(k,Oe))}}}}),zR=XM(cV());d();c();l();u();d();c();l();u();var aa=e=>e.query,WR=e=>e.query?.enableQuerySyntax;var YR=lt(e=>aa(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})),Wd=lt(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var KR=lt(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})}});d();c();l();u();var wS=e=>e.context;d();c();l();u();var IS=e=>e.pipeline;d();c();l();u();var ES=e=>e.searchHub;d();c();l();u();var Ut=lt(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),xse=lt(e=>e,e=>{let t=Ut(e);return t&&e?e[t].expression:""});d();c();l();u();var XR=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var ZR=e=>e.excerptLength?.length;d();c();l();u();var tn=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,JR=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var ew=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var tw=e=>e.sortCriteria;var rw=/*#__PURE__*/function(){var _ref64=_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 rw(_x183){return _ref64.apply(this,arguments)}}(),nw=(e,t)=>{let r=aa(e)?.q,{aq:n,cq:o,dq:a,lq:i}=iw(e),p=wS(e),m=ta(e.configuration.analytics,t,{actionCause:pS(e)}),f=ES(e),g=IS(e),S=Dy(e)??[],C=aw(e),h=Ut(e.tabSet)||"default",y=_y(e),x=tx(e),w=t.referrer||"",E=JR(e),T=tw(e),F=uV(e),O=ZR(e),I=ew(e),k=XR(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:WR(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:S}},...(f?.length&&{searchHub:f}),...(g?.length&&{pipeline:g}),...(C.length&&{facets:C}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:sS(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...F,...(I??{}),...(O&&{excerptLength:O}),...(k&&{dictionaryFieldContext:k}),sortCriteria:T,...(E&&{facetOptions:E}),...m,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ow=(e,t)=>{let r=aa(e)?.q,n=aw(e),o=ta(e.configuration.analytics,t,{actionCause:pS(e)}),a=_y(e),i=Ut(e.tabSet)||"default",p=t.referrer,{aq:m,cq:f}=iw(e),g=ES(e),S=IS(e),C=wS(e),h=Dy(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(S?.length&&{pipeline:S}),...(C?.contextValues&&{context:C.contextValues}),...(m&&{aq:m}),...(f&&{cq:f}),tab:i,referrer:p,...o,locale:a}},aw=e=>Nd(e)?.map(t=>$y(t,Gy())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),uV=e=>({actionsHistory:e.configuration.analytics.enabled?At.getInstance().getHistory():[]}),iw=e=>{let t=KR(e),r=cS(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Yd=["searching","thinking","answering"];function Kd(e){return e.toLowerCase()}var Xd=["search","generic"];function FS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var sw=["text/plain","text/markdown"];var Qi=new $({required:!0}),cw=new $,Bi=new pe({required:!0}),TS={id:Qi,title:Qi,uri:Qi,permanentid:Qi,clickUri:cw},Zd=new $({required:!0,constrainTo:sw}),uw=new $({required:!0,constrainTo:Yd}),lw=e=>({...e,name:Kd(e.name)}),Gi=N("generatedAnswer/setIsVisible",e=>q(e,Bi)),$i=N("generatedAnswer/setAnswerId",e=>q(e,H)),Hi=N("generatedAnswer/setAnswerGenerationMode",e=>q(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),zi=N("generatedAnswer/setIsEnabled",e=>q(e,Bi)),sa=N("generatedAnswer/updateMessage",e=>q(e,{textDelta:Qi})),ca=N("generatedAnswer/updateCitations",e=>q(e,{citations:new ae({required:!0,each:new Y({values:TS})})})),ua=N("generatedAnswer/updateError",e=>q(e,{message:cw,code:new oe({min:0})})),dr=N("generatedAnswer/resetAnswer"),Jd=N("generatedAnswer/like"),ep=N("generatedAnswer/dislike"),tp=N("generatedAnswer/feedbackModal/open"),ru=N("generatedAnswer/expand"),rp=N("generatedAnswer/collapse"),np=N("generatedAnswer/setId",e=>q(e,{id:new $({required:!0})})),op=N("generatedAnswer/feedbackModal/close"),Wi=N("generatedAnswer/sendFeedback"),rn=N("generatedAnswer/setIsLoading",e=>q(e,Bi)),ia=N("generatedAnswer/setIsStreaming",e=>q(e,Bi)),la=N("generatedAnswer/setAnswerContentFormat",e=>q(e,Zd)),ap=N("generatedAnswer/updateResponseFormat",e=>q(e,{contentFormat:new ae({each:Zd,default:["text/plain"]})})),ip=N("knowledge/updateAnswerConfigurationId",e=>q(e,Qi)),sp=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>q(e,sl)),nu=N("generatedAnswer/setIsAnswerGenerated",e=>q(e,Bi)),da=N("generatedAnswer/setCannotAnswer",e=>q(e,Bi)),PS=N("generatedAnswer/setAnswerApiQueryParams",e=>q(e,new Y({}))),cp=N("generatedAnswer/startStep",e=>q(lw(e),{name:uw,startedAt:new oe({min:0,required:!0})})),up=N("generatedAnswer/finishStep",e=>q(lw(e),{name:uw,finishedAt:new oe({min:0,required:!0})})),lp=N("generatedAnswer/startToolCall",e=>q(e,{toolCallName:H,startedAt:new oe({min:0,required:!0}),toolCallId:H})),dp=N("generatedAnswer/finishToolCall",e=>q(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:H})),Yi=N("generatedAnswer/toolCallArgs",e=>q(e,{toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Xd})})),dw=me("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:p}=a(),{queryExecuted:m}=p,{setAbortControllerRef:f}=e,g=yield rw(r),S=(y,x)=>{switch(y){case"genqa.headerMessageType":{let w=JSON.parse(x);n(la(w.contentFormat));break}case"genqa.messageType":n(sa(JSON.parse(x)));break;case"genqa.citationsType":n(ca(JSON.parse(x)));break;case"genqa.endOfStreamType":{let w=JSON.parse(x).answerGenerated,{answerId:E,answer:T}=a().generatedAnswer,O=m.length!==0&&!w,I=!T?.trim();n(da(O)),n(ia(!1)),n(nu(w)),n((i??ld).logGeneratedAnswerStreamEnd(w,E,w?I:void 0)),n(Fi());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(rn(!0));let C=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{C(g)&&(n(rn(!1)),y.payload&&y.payloadType&&S(y.payloadType,y.payload))},abort:y=>{C(g)&&n(ua(y))},close:()=>{C(g)&&n(ia(!1))},resetAnswer:()=>{C(g)&&n(dr())}});h?f(h):n(rn(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),pp=me("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(dr());let a=t();if(a.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(a.generatedAnswer.answerConfigurationId){let i=nw(a,n);r(PS(i)),yield r(fp(i))}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(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var lV=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,p=n.generatedAnswer.answerConfigurationId,m={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let f=Hn(n.configuration.search?.apiBaseUrl,i,a);return NR({baseUrl:`${f}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=g.url,C={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{C[h]=g[h]}),C.duplex="half",C.body=yield g.text(),A(S,C)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(m,{...t,signal:null},r)}catch(f){return{error:f}}});return function lV(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),mp=zR({reducerPath:"answer",baseQuery:qR(lV,{maxRetries:3}),endpoints:()=>({})});var dV=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},pV=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},fV=(e,t)=>{delete e.error,e.citations=t.citations},mV=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},gV=(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})`)},hV=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&gV(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(dV(t,a),r(la(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(pV(t,a),r(sa({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(fV(t,a),r(ca({citations:a.citations})));break;case"genqa.endOfStreamType":{mV(t,a);let i=t.answerId,p=a.answerGenerated??!1,m=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,i,m)),r(Fi());break}}},yV=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,a=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${a}/${r}/generate`},pa=mp.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(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){yield n;let{configuration:p,generatedAnswer:m,insightConfiguration:f}=r(),{generatedAnswerAnalyticsClient:g}=i,{organizationId:S,environment:C,accessToken:h}=p,y=Hn(p.search.apiBaseUrl,S,C),x=yV(y,S,m.answerConfigurationId,f?.insightId);yield nl(x,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:A,onopen:function(){var _ref69=_asyncToGenerator(function*(w){let E=w.headers.get("x-answer-id");E&&o(T=>{T.answerId=E,a($i(E))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:w=>{o(E=>{hV(w,E,a,g??ld)})},onerror:w=>{throw w},onclose:()=>{o(w=>{a(da(!w.generated))})}})}).apply(this,arguments)}})})}),fp=e=>pa.endpoints.getAnswer.initiate(e),kS=e=>{let t=Wd(e);return pa.endpoints.getAnswer.select(t??oa)(e)};d();c();l();u();var pw=fe(Kn,e=>e);d();c();l();u();function SV(e){let t=e.payload?.analyticsAction;return fw(e)&&!J(t)}function fw(e){return"type"in e}var mw=e=>t=>r=>{let n;SV(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return fw(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};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var gp={q:new $,enableQuerySyntax:new pe,aq:new $,cq:new $,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new pe,sf:new Y,tab:new $,af:new Y};var st=N("searchParameters/restore",e=>q(e,gp)),hp=N("searchParameters/restoreTab",e=>q(e,H));d();c();l();u();var yp=N("tab/register",e=>{let t=new Y({values:{id:H,expression:Je}});return q(e,t)}),Nt=N("tab/updateActiveTab",e=>q(e,H));d();c();l();u();var Sp=Pr(Ju(),1),yw=Pr(gw(),1),Sw=Pr(hw(),1);Sp.default.extend(Sw.default);Sp.default.extend(yw.default);var vp=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Sp.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"});d();c();l();u();var vV=/(^|; )Coveo-Pendragon=([^;]*)/,AV=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function vw(){return typeof window>"u"?!1:vV.exec(document.cookie)?.pop()||null}function Aw(){return typeof window>"u"?!1:AV.test(document.cookie)}var Ap=fe(vp(),e=>e.addCase(Ii,(t,r)=>{bV(t,r.payload)}).addCase(Ei,(t,r)=>{CV(t,r.payload)}).addCase(ad,(t,r)=>{xV(t,r.payload)}).addCase(id,t=>{t.analytics.enabled=!1}).addCase(sd,t=>{t.analytics.enabled=!0}).addCase(Ex,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Fx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Nt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hp,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(st,(t,r)=>{J(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Tx,(t,{payload:r})=>{RV(t,r)}));function bV(e,t){J(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",J(t.organizationId)||(e.organizationId=t.organizationId)}function CV(e,t){J(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),J(t.locale)||(e.search.locale=t.locale),J(t.timezone)||(e.search.timezone=t.timezone),J(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xV(e,t){J(t.enabled)||(e.analytics.enabled=t.enabled),J(t.originContext)||(e.analytics.originContext=t.originContext),J(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),J(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),J(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),J(t.trackingId)||(e.analytics.trackingId=t.trackingId),J(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),J(t.source)||(e.analytics.source=t.source);try{let r=vw();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}J(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),J(t.anonymous)||(e.analytics.anonymous=t.anonymous),J(t.deviceId)||(e.analytics.deviceId=t.deviceId),J(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),J(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function RV(e,t){e.knowledge.agentId=t;try{Aw()&&(e.knowledge.debugAgentSession=!0)}catch{}}var we=Ap;d();c();l();u();function wV(e){return e.instantlyCallable}var bw=()=>e=>t=>e(wV(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function Cw(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}d();c();l();u();var qS,IV=new Uint8Array(16);function MS(){if(!qS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qS=crypto.getRandomValues.bind(crypto)}return qS(IV)}d();c();l();u();d();c();l();u();var EV=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),VS={randomUUID:EV};function FV(e,t,r){if(VS.randomUUID&&!t&&!e)return VS.randomUUID();e=e||{};let n=e.random??e.rng?.()??MS();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 Cw(n)}var mo=FV;d();c();l();u();d();c();l();u();var R={};ac(R,{BRAND:()=>ej,DIRTY:()=>fa,EMPTY_PATH:()=>OV,INVALID:()=>xe,NEVER:()=>Vj,OK:()=>Qt,ParseStatus:()=>qt,Schema:()=>Ve,ZodAny:()=>yo,ZodArray:()=>jn,ZodBigInt:()=>ga,ZodBoolean:()=>ha,ZodBranded:()=>au,ZodCatch:()=>Ea,ZodDate:()=>ya,ZodDefault:()=>Ia,ZodDiscriminatedUnion:()=>xp,ZodEffects:()=>Rr,ZodEnum:()=>Ra,ZodError:()=>tr,ZodFirstPartyTypeKind:()=>Ie,ZodFunction:()=>wp,ZodIntersection:()=>ba,ZodIssueCode:()=>X,ZodLazy:()=>Ca,ZodLiteral:()=>xa,ZodMap:()=>ts,ZodNaN:()=>ns,ZodNativeEnum:()=>wa,ZodNever:()=>Dr,ZodNull:()=>va,ZodNullable:()=>an,ZodNumber:()=>ma,ZodObject:()=>rr,ZodOptional:()=>Cr,ZodParsedType:()=>ue,ZodPipeline:()=>iu,ZodPromise:()=>So,ZodReadonly:()=>Fa,ZodRecord:()=>Rp,ZodSchema:()=>Ve,ZodSet:()=>rs,ZodString:()=>ho,ZodSymbol:()=>Ji,ZodTransformer:()=>Rr,ZodTuple:()=>on,ZodType:()=>Ve,ZodUndefined:()=>Sa,ZodUnion:()=>Aa,ZodUnknown:()=>Vn,ZodVoid:()=>es,addIssueToContext:()=>se,any:()=>uj,array:()=>fj,bigint:()=>oj,boolean:()=>_w,coerce:()=>Mj,custom:()=>Pw,date:()=>aj,datetimeRegex:()=>Fw,defaultErrorMap:()=>qn,discriminatedUnion:()=>yj,effect:()=>Tj,enum:()=>Ij,function:()=>xj,getErrorMap:()=>Ki,getParsedType:()=>nn,instanceof:()=>rj,intersection:()=>Sj,isAborted:()=>bp,isAsync:()=>Xi,isDirty:()=>Cp,isValid:()=>go,late:()=>tj,lazy:()=>Rj,literal:()=>wj,makeIssue:()=>ou,map:()=>bj,nan:()=>nj,nativeEnum:()=>Ej,never:()=>dj,null:()=>cj,nullable:()=>kj,number:()=>Ow,object:()=>mj,objectUtil:()=>jS,oboolean:()=>qj,onumber:()=>Dj,optional:()=>Pj,ostring:()=>Nj,pipeline:()=>_j,preprocess:()=>Oj,promise:()=>Fj,quotelessJson:()=>TV,record:()=>Aj,set:()=>Cj,setErrorMap:()=>kV,strictObject:()=>gj,string:()=>kw,symbol:()=>ij,transformer:()=>Tj,tuple:()=>vj,undefined:()=>sj,union:()=>hj,unknown:()=>lj,util:()=>Ue,void:()=>pj});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ue;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let a={};for(let i of o)a[i]=i;return a},e.getValidEnumValues=o=>{let a=e.objectKeys(o).filter(p=>typeof o[o[p]]!="number"),i={};for(let p of a)i[p]=o[p];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(a){return o[a]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},e.find=(o,a)=>{for(let i of o)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(Ue||(Ue={}));var jS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(jS||(jS={}));var ue=Ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nn=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var X=Ue.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"]),TV=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),tr=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(a){return a.message},n={_errors:[]},o=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let p=n,m=0;for(;m<i.path.length;){let f=i.path[m];m===i.path.length-1?(p[f]=p[f]||{_errors:[]},p[f]._errors.push(r(i))):p[f]=p[f]||{_errors:[]},p=p[f],m++}}};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,Ue.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 a=o.path[0];r[a]=r[a]||[],r[a].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};tr.create=e=>new tr(e);var PV=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ue.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ue.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ue.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ue.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.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}"`:Ue.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.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 X.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 X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ue.assertNever(e)}return{message:r}},qn=PV;var xw=qn;function kV(e){xw=e}function Ki(){return xw}d();c();l();u();var ou=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,a=[...r,...(o.path||[])],i={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let p="",m=n.filter(f=>!!f).slice().reverse();for(let f of m)p=f(i,{data:t,defaultError:p}).message;return{...o,path:a,message:p}},OV=[];function se(e,t){let r=Ki(),n=ou({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===qn?void 0:qn].filter(o=>!!o)});e.common.issues.push(n)}var qt=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 xe;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 a=yield o.key,i=yield o.value;n.push({key:a,value:i})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return xe;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}},xe=Object.freeze({status:"aborted"}),fa=e=>({status:"dirty",value:e}),Qt=e=>({status:"valid",value:e}),bp=e=>e.status==="aborted",Cp=e=>e.status==="dirty",go=e=>e.status==="valid",Xi=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var he;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(he||(he={}));var xr=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}},Rw=(e,t)=>{if(go(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 tr(e.common.issues);return this._error=r,this._error}}};function Ne(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:(i,p)=>{let{message:m}=e;return i.code==="invalid_enum_value"?{message:m??p.defaultError}:typeof p.data>"u"?{message:m??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:m??r??p.defaultError}},description:o}}var Ve=class{get description(){return this._def.description}_getType(t){return nn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:nn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qt,ctx:{common:t.parent.common,data:t.data,parsedType:nn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Xi(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:nn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Rw(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:nn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return go(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=>go(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:nn(t)},o=_this32._parse({data:t,path:n.path,parent:n}),a=yield Xi(o)?o:Promise.resolve(o);return Rw(n,a)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,a)=>{let i=t(o),p=()=>a.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(m=>m?!0:(p(),!1)):i?!0:(p(),!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 Rr({schema:this,typeName:Ie.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 Cr.create(this,this._def)}nullable(){return an.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jn.create(this)}promise(){return So.create(this,this._def)}or(t){return Aa.create([this,t],this._def)}and(t){return ba.create(this,t,this._def)}transform(t){return new Rr({...Ne(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ia({...Ne(this._def),innerType:this,defaultValue:r,typeName:Ie.ZodDefault})}brand(){return new au({typeName:Ie.ZodBranded,type:this,...Ne(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ea({...Ne(this._def),innerType:this,catchValue:r,typeName:Ie.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return iu.create(this,t)}readonly(){return Fa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_V=/^c[^\s-]{8,}$/i,NV=/^[0-9a-z]+$/,DV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qV=/^[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,MV=/^[a-z0-9_-]{21}$/i,VV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jV=/^[-+]?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)?)??$/,LV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",LS,QV=/^(?:(?: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])$/,BV=/^(?:(?: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])$/,GV=/^(([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]))$/,$V=/^(([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])$/,HV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Iw="((\\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])))",WV=new RegExp(`^${Iw}$`);function Ew(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 YV(e){return new RegExp(`^${Ew(e)}$`)}function Fw(e){let t=`${Iw}T${Ew(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 KV(e,t){return!!((t==="v4"||!t)&&QV.test(e)||(t==="v6"||!t)&&GV.test(e))}function XV(e,t){if(!VV.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 ZV(e,t){return!!((t==="v4"||!t)&&BV.test(e)||(t==="v6"||!t)&&$V.test(e))}var ho=class e extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.string,received:a.parsedType}),xe}let n=new qt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=t.data.length>a.value,p=t.data.length<a.value;(i||p)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")LV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")LS||(LS=new RegExp(UV,"u")),LS.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")qV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")MV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")_V.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")NV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")DV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:X.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Fw(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?WV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?YV(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?KV(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?XV(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ZV(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?HV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?zV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:a.message}),n.dirty()):Ue.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...he.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...he.errToObj(t)})}url(t){return this._addCheck({kind:"url",...he.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...he.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...he.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...he.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...he.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...he.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...he.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...he.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...he.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...he.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...he.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...he.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,...he.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,...he.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...he.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...he.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...he.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...he.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...he.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...he.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...he.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...he.errToObj(r)})}nonempty(t){return this.min(1,he.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}};ho.create=e=>new ho({checks:[],typeName:Ie.ZodString,coerce:e?.coerce??!1,...Ne(e)});function JV(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,a=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return a%i/10**o}var ma=class e extends Ve{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)!==ue.number){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.number,received:a.parsedType}),xe}let n,o=new qt;for(let a of this._def.checks)a.kind==="int"?Ue.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?JV(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:a.message}),o.dirty()):Ue.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,he.toString(r))}gt(t,r){return this.setLimit("min",t,!1,he.toString(r))}lte(t,r){return this.setLimit("max",t,!0,he.toString(r))}lt(t,r){return this.setLimit("max",t,!1,he.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:he.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:he.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:he.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:he.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:he.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:he.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:he.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:he.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:he.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:he.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"&&Ue.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)}};ma.create=e=>new ma({checks:[],typeName:Ie.ZodNumber,coerce:e?.coerce||!1,...Ne(e)});var ga=class e extends Ve{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)!==ue.bigint)return this._getInvalidInput(t);let n,o=new qt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):Ue.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.bigint,received:r.parsedType}),xe}gte(t,r){return this.setLimit("min",t,!0,he.toString(r))}gt(t,r){return this.setLimit("min",t,!1,he.toString(r))}lte(t,r){return this.setLimit("max",t,!0,he.toString(r))}lt(t,r){return this.setLimit("max",t,!1,he.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:he.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:he.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:he.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:he.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:he.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:he.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}};ga.create=e=>new ga({checks:[],typeName:Ie.ZodBigInt,coerce:e?.coerce??!1,...Ne(e)});var ha=class extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.boolean,received:n.parsedType}),xe}return Qt(t.data)}};ha.create=e=>new ha({typeName:Ie.ZodBoolean,coerce:e?.coerce||!1,...Ne(e)});var ya=class e extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.date,received:a.parsedType}),xe}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_date}),xe}let n=new qt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ue.assertNever(a);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:he.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:he.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}};ya.create=e=>new ya({checks:[],coerce:e?.coerce||!1,typeName:Ie.ZodDate,...Ne(e)});var Ji=class extends Ve{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.symbol,received:n.parsedType}),xe}return Qt(t.data)}};Ji.create=e=>new Ji({typeName:Ie.ZodSymbol,...Ne(e)});var Sa=class extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.undefined,received:n.parsedType}),xe}return Qt(t.data)}};Sa.create=e=>new Sa({typeName:Ie.ZodUndefined,...Ne(e)});var va=class extends Ve{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.null,received:n.parsedType}),xe}return Qt(t.data)}};va.create=e=>new va({typeName:Ie.ZodNull,...Ne(e)});var yo=class extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Qt(t.data)}};yo.create=e=>new yo({typeName:Ie.ZodAny,...Ne(e)});var Vn=class extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Qt(t.data)}};Vn.create=e=>new Vn({typeName:Ie.ZodUnknown,...Ne(e)});var Dr=class extends Ve{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),xe}};Dr.create=e=>new Dr({typeName:Ie.ZodNever,...Ne(e)});var es=class extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.void,received:n.parsedType}),xe}return Qt(t.data)}};es.create=e=>new es({typeName:Ie.ZodVoid,...Ne(e)});var jn=class e extends Ve{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return se(r,{code:X.invalid_type,expected:ue.array,received:r.parsedType}),xe;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(se(r,{code:i?X.too_big:X.too_small,minimum:p?o.exactLength.value:void 0,maximum:i?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&&(se(r,{code:X.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&&(se(r,{code:X.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((i,p)=>o.type._parseAsync(new xr(r,i,r.path,p)))).then(i=>qt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new xr(r,i,r.path,p)));return qt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:he.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:he.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:he.toString(r)}})}nonempty(t){return this.min(1,t)}};jn.create=(e,t)=>new jn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...Ne(t)});function Zi(e){if(e instanceof rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Cr.create(Zi(n))}return new rr({...e._def,shape:()=>t})}else return e instanceof jn?new jn({...e._def,type:Zi(e.element)}):e instanceof Cr?Cr.create(Zi(e.unwrap())):e instanceof an?an.create(Zi(e.unwrap())):e instanceof on?on.create(e.items.map(t=>Zi(t))):e}var rr=class e extends Ve{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=Ue.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let f=this._getOrReturnCtx(t);return se(f,{code:X.invalid_type,expected:ue.object,received:f.parsedType}),xe}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof Dr&&this._def.unknownKeys==="strip"))for(let f in o.data)i.includes(f)||p.push(f);let m=[];for(let f of i){let g=a[f],S=o.data[f];m.push({key:{status:"valid",value:f},value:g._parse(new xr(o,S,o.path,f)),alwaysSet:f in o.data})}if(this._def.catchall instanceof Dr){let f=this._def.unknownKeys;if(f==="passthrough")for(let g of p)m.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(f==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let g of p){let S=o.data[g];m.push({key:{status:"valid",value:g},value:f._parse(new xr(o,S,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let f=[];for(let g of m){let S=yield g.key,C=yield g.value;f.push({key:S,value:C,alwaysSet:g.alwaysSet})}return f})).then(f=>qt.mergeObjectSync(n,f)):qt.mergeObjectSync(n,m)}get shape(){return this._def.shape()}strict(t){return he.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:he.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:Ie.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 Ue.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 Ue.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zi(this)}partial(t){let r={};for(let n of Ue.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 Ue.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Cr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return Tw(Ue.objectKeys(this.shape))}};rr.create=(e,t)=>new rr({shape:()=>e,unknownKeys:"strip",catchall:Dr.create(),typeName:Ie.ZodObject,...Ne(t)});rr.strictCreate=(e,t)=>new rr({shape:()=>e,unknownKeys:"strict",catchall:Dr.create(),typeName:Ie.ZodObject,...Ne(t)});rr.lazycreate=(e,t)=>new rr({shape:e,unknownKeys:"strip",catchall:Dr.create(),typeName:Ie.ZodObject,...Ne(t)});var Aa=class extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let i=a.map(p=>new tr(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:i}),xe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(a){let i={...r,common:{...r.common,issues:[]},parent:null};return{result:yield a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}});return function(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let a,i=[];for(let m of n){let f={...r,common:{...r.common,issues:[]},parent:null},g=m._parseSync({data:r.data,path:r.path,parent:f});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=i.map(m=>new tr(m));return se(r,{code:X.invalid_union,unionErrors:p}),xe}}get options(){return this._def.options}};Aa.create=(e,t)=>new Aa({options:e,typeName:Ie.ZodUnion,...Ne(t)});var Mn=e=>e instanceof Ca?Mn(e.schema):e instanceof Rr?Mn(e.innerType()):e instanceof xa?[e.value]:e instanceof Ra?e.options:e instanceof wa?Ue.objectValues(e.enum):e instanceof Ia?Mn(e._def.innerType):e instanceof Sa?[void 0]:e instanceof va?[null]:e instanceof Cr?[void 0,...Mn(e.unwrap())]:e instanceof an?[null,...Mn(e.unwrap())]:e instanceof au||e instanceof Fa?Mn(e.unwrap()):e instanceof Ea?Mn(e._def.innerType):[],xp=class e extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:X.invalid_type,expected:ue.object,received:r.parsedType}),xe;let n=this.discriminator,o=r.data[n],a=this.optionsMap.get(o);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),xe)}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 a of r){let i=Mn(a.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of i){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,a)}}return new e({typeName:Ie.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ne(n)})}};function US(e,t){let r=nn(e),n=nn(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Ue.objectKeys(t),a=Ue.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let m=US(e[p],t[p]);if(!m.valid)return{valid:!1};i[p]=m.data}return{valid:!0,data:i}}else if(r===ue.array&&n===ue.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],p=t[a],m=US(i,p);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ba=class extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(bp(a)||bp(i))return xe;let p=US(a.value,i.value);return p.valid?((Cp(a)||Cp(i))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),xe)};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(([a,i])=>o(a,i)):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}))}};ba.create=(e,t,r)=>new ba({left:e,right:t,typeName:Ie.ZodIntersection,...Ne(r)});var on=class e extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return se(n,{code:X.invalid_type,expected:ue.array,received:n.parsedType}),xe;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),xe;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,p)=>{let m=this._def.items[p]||this._def.rest;return m?m._parse(new xr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>qt.mergeArray(r,i)):qt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};on.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new on({items:e,typeName:Ie.ZodTuple,rest:null,...Ne(t)})};var Rp=class e extends Ve{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!==ue.object)return se(n,{code:X.invalid_type,expected:ue.object,received:n.parsedType}),xe;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new xr(n,p,n.path,p)),value:i._parse(new xr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?qt.mergeObjectAsync(r,o):qt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ve?new e({keyType:t,valueType:r,typeName:Ie.ZodRecord,...Ne(n)}):new e({keyType:ho.create(),valueType:t,typeName:Ie.ZodRecord,...Ne(r)})}},ts=class extends Ve{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!==ue.map)return se(n,{code:X.invalid_type,expected:ue.map,received:n.parsedType}),xe;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,m],f)=>({key:o._parse(new xr(n,p,n.path,[f,"key"])),value:a._parse(new xr(n,m,n.path,[f,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let m of i){let f=yield m.key,g=yield m.value;if(f.status==="aborted"||g.status==="aborted")return xe;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let m of i){let f=m.key,g=m.value;if(f.status==="aborted"||g.status==="aborted")return xe;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}}};ts.create=(e,t,r)=>new ts({valueType:t,keyType:e,typeName:Ie.ZodMap,...Ne(r)});var rs=class e extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return se(n,{code:X.invalid_type,expected:ue.set,received:n.parsedType}),xe;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.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&&(se(n,{code:X.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let a=this._def.valueType;function i(m){let f=new Set;for(let g of m){if(g.status==="aborted")return xe;g.status==="dirty"&&r.dirty(),f.add(g.value)}return{status:r.value,value:f}}let p=[...n.data.values()].map((m,f)=>a._parse(new xr(n,m,n.path,f)));return n.common.async?Promise.all(p).then(m=>i(m)):i(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:he.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:he.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};rs.create=(e,t)=>new rs({valueType:e,minSize:null,maxSize:null,typeName:Ie.ZodSet,...Ne(t)});var wp=class e extends Ve{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.function)return se(r,{code:X.invalid_type,expected:ue.function,received:r.parsedType}),xe;function n(p,m){return ou({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ki(),qn].filter(f=>!!f),issueData:{code:X.invalid_arguments,argumentsError:m}})}function o(p,m){return ou({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ki(),qn].filter(f=>!!f),issueData:{code:X.invalid_return_type,returnTypeError:m}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof So){let p=this;return Qt(/*#__PURE__*/_asyncToGenerator(function*(...m){let f=new tr([]),g=yield p._def.args.parseAsync(m,a).catch(h=>{throw f.addIssue(n(m,h)),f}),S=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(S,a).catch(h=>{throw f.addIssue(o(S,h)),f})}))}else{let p=this;return Qt(function(...m){let f=p._def.args.safeParse(m,a);if(!f.success)throw new tr([n(m,f.error)]);let g=Reflect.apply(i,this,f.data),S=p._def.returns.safeParse(g,a);if(!S.success)throw new tr([o(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:on.create(t).rest(Vn.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||on.create([]).rest(Vn.create()),returns:r||Vn.create(),typeName:Ie.ZodFunction,...Ne(n)})}},Ca=class extends Ve{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})}};Ca.create=(e,t)=>new Ca({getter:e,typeName:Ie.ZodLazy,...Ne(t)});var xa=class extends Ve{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),xe}return{status:"valid",value:t.data}}get value(){return this._def.value}};xa.create=(e,t)=>new xa({value:e,typeName:Ie.ZodLiteral,...Ne(t)});function Tw(e,t){return new Ra({values:e,typeName:Ie.ZodEnum,...Ne(t)})}var Ra=class e extends Ve{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Ue.joinValues(n),received:r.parsedType,code:X.invalid_type}),xe}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 se(r,{received:r.data,code:X.invalid_enum_value,options:n}),xe}return Qt(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})}};Ra.create=Tw;var wa=class extends Ve{_parse(t){let r=Ue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Ue.objectValues(r);return se(n,{expected:Ue.joinValues(o),received:n.parsedType,code:X.invalid_type}),xe}if(this._cache||(this._cache=new Set(Ue.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ue.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),xe}return Qt(t.data)}get enum(){return this._def.values}};wa.create=(e,t)=>new wa({values:e,typeName:Ie.ZodNativeEnum,...Ne(t)});var So=class extends Ve{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ue.promise,received:r.parsedType}),xe;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Qt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};So.create=(e,t)=>new So({type:e,typeName:Ie.ZodPromise,...Ne(t)});var Rr=class extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{se(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return xe;let m=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return m.status==="aborted"?xe:m.status==="dirty"?fa(m.value):r.value==="dirty"?fa(m.value):m});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return xe;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?xe:p.status==="dirty"?fa(p.value):r.value==="dirty"?fa(p.value):p}}if(o.type==="refinement"){let i=p=>{let m=o.refinement(p,a);if(n.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?xe:(p.status==="dirty"&&r.dirty(),i(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?xe:(p.status==="dirty"&&r.dirty(),i(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!go(i))return xe;let p=o.transform(i.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>go(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):xe);Ue.assertNever(o)}};Rr.create=(e,t,r)=>new Rr({schema:e,typeName:Ie.ZodEffects,effect:t,...Ne(r)});Rr.createWithPreprocess=(e,t,r)=>new Rr({schema:t,effect:{type:"preprocess",transform:e},typeName:Ie.ZodEffects,...Ne(r)});var Cr=class extends Ve{_parse(t){return this._getType(t)===ue.undefined?Qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Cr.create=(e,t)=>new Cr({innerType:e,typeName:Ie.ZodOptional,...Ne(t)});var an=class extends Ve{_parse(t){return this._getType(t)===ue.null?Qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};an.create=(e,t)=>new an({innerType:e,typeName:Ie.ZodNullable,...Ne(t)});var Ia=class extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ia.create=(e,t)=>new Ia({innerType:e,typeName:Ie.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ne(t)});var Ea=class extends Ve{_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 Xi(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ea.create=(e,t)=>new Ea({innerType:e,typeName:Ie.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ne(t)});var ns=class extends Ve{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.nan,received:n.parsedType}),xe}return{status:"valid",value:t.data}}};ns.create=e=>new ns({typeName:Ie.ZodNaN,...Ne(e)});var ej=Symbol("zod_brand"),au=class extends Ve{_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}},iu=class e extends Ve{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?xe:a.status==="dirty"?(r.dirty(),fa(a.value)):_this34._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?xe: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:Ie.ZodPipeline})}},Fa=class extends Ve{_parse(t){let r=this._def.innerType._parse(t),n=o=>(go(o)&&(o.value=Object.freeze(o.value)),o);return Xi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Fa.create=(e,t)=>new Fa({innerType:e,typeName:Ie.ZodReadonly,...Ne(t)});function ww(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Pw(e,t={},r){return e?yo.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=ww(t,n),m=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:m})}});if(!a){let i=ww(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):yo.create()}var tj={object:rr.lazycreate},Ie;(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"})(Ie||(Ie={}));var rj=(e,t={message:`Input not instance of ${e.name}`})=>Pw(r=>r instanceof e,t),kw=ho.create,Ow=ma.create,nj=ns.create,oj=ga.create,_w=ha.create,aj=ya.create,ij=Ji.create,sj=Sa.create,cj=va.create,uj=yo.create,lj=Vn.create,dj=Dr.create,pj=es.create,fj=jn.create,mj=rr.create,gj=rr.strictCreate,hj=Aa.create,yj=xp.create,Sj=ba.create,vj=on.create,Aj=Rp.create,bj=ts.create,Cj=rs.create,xj=wp.create,Rj=Ca.create,wj=xa.create,Ij=Ra.create,Ej=wa.create,Fj=So.create,Tj=Rr.create,Pj=Cr.create,kj=an.create,Oj=Rr.createWithPreprocess,_j=iu.create,Nj=()=>kw().optional(),Dj=()=>Ow().optional(),qj=()=>_w().optional(),Mj={string:e=>ho.create({...e,coerce:!0}),number:e=>ma.create({...e,coerce:!0}),boolean:e=>ha.create({...e,coerce:!0}),bigint:e=>ga.create({...e,coerce:!0}),date:e=>ya.create({...e,coerce:!0})};var Vj=xe;var jj=R.record(R.any()),Ta=jj.optional();function Nw(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Lj=R.object({name:R.string(),arguments:R.string()}),Uj=R.object({id:R.string(),type:R.literal("function"),function:Lj,encryptedValue:R.string().optional(),metadata:Ta}),Ip=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ta}),Qj=R.object({type:R.literal("text"),text:R.string()}),Bj=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),Gj=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),Ep=R.discriminatedUnion("type",[Bj,Gj]),$j=R.object({type:R.literal("image"),source:Ep,metadata:R.unknown().optional()}),Hj=R.object({type:R.literal("audio"),source:Ep,metadata:R.unknown().optional()}),zj=R.object({type:R.literal("video"),source:Ep,metadata:R.unknown().optional()}),Wj=R.object({type:R.literal("document"),source:Ep,metadata:R.unknown().optional()});var Dw=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),qw=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},vpe=Dw.superRefine((e,t)=>{qw(e,t)}),Yj=R.discriminatedUnion("type",[Qj,$j,Hj,zj,Wj,Dw]),Kj=Yj.superRefine((e,t)=>{e.type==="binary"&&qw(e,t)}),Xj=Ip.extend({role:R.literal("developer"),content:R.string()}),Zj=Ip.extend({role:R.literal("system"),content:R.string()}),Jj=Ip.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(Uj).optional()}),eL=Ip.extend({role:R.literal("user"),content:R.union([R.string(),R.array(Kj)])}),tL=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ta}),rL=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any()),subagentRunId:R.string().optional(),metadata:Ta}),nL=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ta}),Mw=R.discriminatedUnion("role",[Xj,Zj,Jj,eL,tL,rL,nL]),Ape=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),oL=R.object({description:R.string(),value:R.string()}),Vw=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),aL=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional(),subagentRunId:R.string().optional()}),iL=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional(),metadata:Ta}),sL=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any().transform(e=>e??void 0),messages:R.array(Mw),tools:R.array(Vw),context:R.array(oL),forwardedProps:R.any(),resume:R.array(iL).optional()}),cL=R.any(),Fe=class extends Error{constructor(e){super(e)}},QS=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},uL=R.object({name:R.string(),description:R.string().optional()}),lL=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),dL=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),pL=R.object({supported:R.boolean().optional(),items:R.array(Vw).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),fL=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),mL=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),gL=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(uL).optional()}),hL=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),yL=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),SL=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),vL=R.object({input:yL.optional(),output:SL.optional()}),AL=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),bL=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),bpe=R.object({identity:lL.optional(),transport:dL.optional(),tools:pL.optional(),output:fL.optional(),state:mL.optional(),multiAgent:gL.optional(),reasoning:hL.optional(),multimodal:vL.optional(),execution:AL.optional(),humanInTheLoop:bL.optional(),custom:R.record(R.unknown()).optional()}),jw=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.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.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Qe=R.object({type:R.nativeEnum(M),timestamp:R.number().optional(),rawEvent:R.any().optional(),metadata:Ta}).passthrough(),CL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_START),messageId:R.string(),role:jw.default("assistant"),name:R.string().optional(),subagentRunId:R.string().optional()}),Lw=Qe.extend({type:R.literal(M.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),xL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_END),messageId:R.string(),subagentRunId:R.string().optional()}),RL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:jw.optional(),delta:R.string().optional(),name:R.string().optional(),subagentRunId:R.string().optional()}),wL=Qe.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_START)}),IL=Lw.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:R.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),EL=Qe.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_END)}),FL=Qe.extend({type:R.literal(M.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0),subagentRunId:R.string().optional()}),TL=Qe.extend({type:R.literal(M.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),PL=Qe.extend({type:R.literal(M.TOOL_CALL_END),toolCallId:R.string(),subagentRunId:R.string().optional()}),kL=Qe.extend({messageId:R.string(),type:R.literal(M.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional(),subagentRunId:R.string().optional()}),OL=Qe.extend({type:R.literal(M.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0),delta:R.string().optional(),subagentRunId:R.string().optional()}),_L=Qe.extend({type:R.literal(M.THINKING_START),title:R.string().optional()}),NL=Qe.extend({type:R.literal(M.THINKING_END)}),DL=Qe.extend({type:R.literal(M.STATE_SNAPSHOT),snapshot:cL,subagentRunId:R.string().optional()}),qL=Qe.extend({type:R.literal(M.STATE_DELTA),delta:R.array(R.any()),subagentRunId:R.string().optional()}),ML=Qe.extend({type:R.literal(M.MESSAGES_SNAPSHOT),messages:R.array(Mw)}),VL=Qe.extend({type:R.literal(M.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0),subagentRunId:R.string().optional()}),jL=Qe.extend({type:R.literal(M.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any()),subagentRunId:R.string().optional()}),LL=Qe.extend({type:R.literal(M.RAW),event:R.any(),source:R.string().optional(),subagentRunId:R.string().optional()}),UL=Qe.extend({type:R.literal(M.CUSTOM),name:R.string(),value:R.any(),subagentRunId:R.string().optional()}),QL=Qe.extend({type:R.literal(M.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:sL.optional()}),BL=R.object({type:R.literal("success")}).strict(),GL=R.object({type:R.literal("interrupt"),interrupts:R.array(aL).min(1)}).strict(),$L=R.discriminatedUnion("type",[BL,GL]),Uw=R.object({provider:R.string().optional(),model:R.string().optional(),inputTokens:R.number().int().nonnegative().optional(),outputTokens:R.number().int().nonnegative().optional(),totalTokens:R.number().int().nonnegative().optional(),reasoningTokens:R.number().int().nonnegative().optional(),cachedInputTokens:R.number().int().nonnegative().optional()}),HL=Qe.extend({type:R.literal(M.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:$L.nullable().optional().transform(e=>e??void 0),usage:R.array(Uw).optional()}),zL=Qe.extend({type:R.literal(M.RUN_ERROR),message:R.string(),code:R.string().optional(),usage:R.array(Uw).optional()}),WL=Qe.extend({type:R.literal(M.STEP_STARTED),stepName:R.string(),subagentRunId:R.string().optional()}),YL=Qe.extend({type:R.literal(M.STEP_FINISHED),stepName:R.string(),subagentRunId:R.string().optional()}),KL=R.union([R.literal("tool-call"),R.literal("message")]),XL=Qe.extend({type:R.literal(M.REASONING_START),messageId:R.string(),subagentRunId:R.string().optional()}),ZL=Qe.extend({type:R.literal(M.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning"),subagentRunId:R.string().optional()}),JL=Qe.extend({type:R.literal(M.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),eU=Qe.extend({type:R.literal(M.REASONING_MESSAGE_END),messageId:R.string(),subagentRunId:R.string().optional()}),tU=Qe.extend({type:R.literal(M.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional(),subagentRunId:R.string().optional()}),rU=Qe.extend({type:R.literal(M.REASONING_END),messageId:R.string(),subagentRunId:R.string().optional()}),nU=Qe.extend({type:R.literal(M.REASONING_ENCRYPTED_VALUE),subtype:KL,entityId:R.string(),encryptedValue:R.string(),subagentRunId:R.string().optional()}),oU=Qe.extend({type:R.literal(M.SUBAGENT_STARTED),subagentRunId:R.string(),name:R.string(),description:R.string().optional(),parentSubagentRunId:R.string().optional(),parentToolCallId:R.string().optional(),parentMessageId:R.string().optional()}),aU=R.object({type:R.literal("success")}).strict(),iU=R.object({type:R.literal("suspended"),interruptIds:R.array(R.string()).optional()}).strict(),sU=R.discriminatedUnion("type",[aU,iU]),cU=Qe.extend({type:R.literal(M.SUBAGENT_FINISHED),subagentRunId:R.string(),result:R.any().optional(),outcome:sU.optional()}),uU=Qe.extend({type:R.literal(M.SUBAGENT_ERROR),subagentRunId:R.string(),message:R.string(),code:R.string().optional()}),Fp=R.discriminatedUnion("type",[CL,Lw,xL,RL,_L,NL,wL,IL,EL,FL,TL,PL,OL,kL,DL,qL,ML,VL,jL,LL,UL,QL,HL,zL,WL,YL,XL,ZL,JL,eU,tU,rU,nU,oU,cU,uU]);d();c();l();u();var BS={};ac(BS,{JsonPatchError:()=>dt,_areEquals:()=>uu,applyOperation:()=>Pa,applyPatch:()=>Dp,applyReducer:()=>mU,deepClone:()=>pU,getValueByPointer:()=>_p,validate:()=>Bw,validator:()=>Np});d();c();l();u();d();c();l();u();var lU=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},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)}}(),dU=Object.prototype.hasOwnProperty;function Pp(e,t){return dU.call(e,t)}function kp(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)Pp(e,o)&&n.push(o);return n}function Mt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Op(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 sn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function su(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Tp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Tp(e[t]))return!0}else if(typeof e=="object"){for(var n=kp(e),o=n.length,a=0;a<o;a++)if(Tp(e[n[a]]))return!0}}return!1}function Qw(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 cu=function(e){lU(t,e);function t(r,n,o,a,i){var p=this.constructor,m=e.call(this,Qw(r,{name:n,index:o,operation:a,tree:i}))||this;return m.name=n,m.index=o,m.operation=a,m.tree=i,Object.setPrototypeOf(m,p.prototype),m.message=Qw(r,{name:n,index:o,operation:a,tree:i}),m}return t}(Error);var dt=cu,pU=Mt,os={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=_p(r,this.path);n&&(n=Mt(n));var o=Pa(r,{op:"remove",path:this.from}).removed;return Pa(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=_p(r,this.from);return Pa(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:uu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},fU={add:function(e,t,r){return Op(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:os.move,copy:os.copy,test:os.test,_get:os._get};function _p(e,t){if(t=="")return e;var r={op:"_get",path:t};return Pa(e,r),r.value}function Pa(e,t,r,n,o,a){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=0),r&&(typeof r=="function"?r(t,0,e,t.path):Np(t,0)),t.path===""){var i={newDocument:e};if(t.op==="add")return i.newDocument=t.value,i;if(t.op==="replace")return i.newDocument=t.value,i.removed=e,i;if(t.op==="move"||t.op==="copy")return i.newDocument=_p(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=uu(e,t.value),i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i.newDocument=e,i}else{if(t.op==="remove")return i.removed=e,i.newDocument=null,i;if(t.op==="_get")return t.value=e,i;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=Mt(e));var p=t.path||"",m=p.split("/"),f=e,g=1,S=m.length,C=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Np;;){if(h=m[g],h&&h.indexOf("~")!=-1&&(h=su(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&m[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&&C===void 0&&(f[h]===void 0?C=m.slice(0,g).join("/"):g==S-1&&(C=t.path),C!==void 0&&y(t,0,e,C)),g++,Array.isArray(f)){if(h==="-")h=f.length;else{if(r&&!Op(h))throw new dt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);Op(h)&&(h=~~h)}if(g>=S){if(r&&t.op==="add"&&h>f.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);var i=fU[t.op].call(t,f,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=S){var i=os[t.op].call(t,f,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(f=f[h],r&&g<S&&(!f||typeof f!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function Dp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Mt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=Pa(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function mU(e,t,r){var n=Pa(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Np(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(os[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("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 dt("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 dt("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")&&Tp(e.value))throw new dt("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,a=n.split("/").length;if(o!==a+1&&o!==a)throw new dt("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 dt("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 i={op:"_get",path:e.from,value:void 0},p=Bw([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Bw(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Dp(Mt(t),Mt(e),r||!0);else{r=r||Np;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function uu(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,a,i;if(r&&n){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!uu(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=a;o--!==0;)if(i=p[o],!uu(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var zS={};ac(zS,{compare:()=>CU,generate:()=>GS,observe:()=>bU,unobserve:()=>AU});d();c();l();u();var $S=new WeakMap,gU=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),hU=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function yU(e){return $S.get(e)}function SU(e,t){return e.observers.get(t)}function vU(e,t){e.observers.delete(t.callback)}function AU(e,t){t.unobserve()}function bU(e,t){var r=[],n,o=yU(e);if(!o)o=new gU(e),$S.set(e,o);else{var a=SU(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var i=function(){GS(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){GS(n),clearTimeout(n.next),vU(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new hU(t,n)),n}function GS(e,t){t===void 0&&(t=!1);var r=$S.get(e.object);HS(r.value,e.object,e.patches,"",t),e.patches.length&&Dp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function HS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=kp(t),i=kp(e),p=!1,m=!1,f=i.length-1;f>=0;f--){var g=i[f],S=e[g];if(Pp(t,g)&&!(t[g]===void 0&&S!==void 0&&Array.isArray(t)===!1)){var C=t[g];typeof S=="object"&&S!=null&&typeof C=="object"&&C!=null&&Array.isArray(S)===Array.isArray(C)?HS(S,C,r,n+"/"+sn(g),o):S!==C&&(p=!0,o&&r.push({op:"test",path:n+"/"+sn(g),value:Mt(S)}),r.push({op:"replace",path:n+"/"+sn(g),value:Mt(C)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+sn(g),value:Mt(S)}),r.push({op:"remove",path:n+"/"+sn(g)}),m=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!m&&a.length==i.length))for(var f=0;f<a.length;f++){var g=a[f];!Pp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+sn(g),value:Mt(t[g])})}}}function CU(e,t,r){r===void 0&&(r=!1);var n=[];return HS(e,t,n,"",r),n}var qp=Object.assign({},BS,zS,{JsonPatchError:cu,deepClone:Mt,escapePathComponent:sn,unescapePathComponent:su});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var WS=function(e,t){return WS=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])},WS(e,t)};function cn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");WS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Gw(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{f(n.next(g))}catch(S){i(S)}}function m(g){try{f(n.throw(g))}catch(S){i(S)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})}function Mp(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=p(0),i.throw=p(1),i.return=p(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,f[0]&&(r=0)),r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ln(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 as(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,a=[],i;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)a.push(o.value)}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function is(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function ka(e){return this instanceof ka?(this.v=e,this):new ka(e)}function $w(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(y){return Promise.resolve(y).then(h,S)}}function p(h,y){n[h]&&(o[h]=function(x){return new Promise(function(w,E){a.push([h,x,w,E])>1||m(h,x)})},y&&(o[h]=y(o[h])))}function m(h,y){try{f(n[h](y))}catch(x){C(a[0][3],x)}}function f(h){h.value instanceof ka?Promise.resolve(h.value.v).then(g,S):C(a[0][2],h)}function g(h){m("next",h)}function S(h){m("throw",h)}function C(h,y){h(y),a.shift(),a.length&&m(a[0][0],a[0][1])}}function Hw(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 Ln=="function"?Ln(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(i){return new Promise(function(p,m){i=e[a](i),o(p,m,i.done,i.value)})}}function o(a,i,p,m){Promise.resolve(m).then(function(f){a({value:f,done:p})},i)}}d();c();l();u();function Le(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function ss(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 Vp=ss(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function kD(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var OD=["1",1,"yes",!0];function _D(){let e=[];return cy()&&e.push(window.doNotTrack),xy()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>OD.indexOf(t)!==-1)}function Vc(e){return e===!0?!1:_D()}var Ub="v15",Qb={default:"https://analytics.cloud.coveo.com/rest/ua"};function ND(e=Qb.default,t=Ub,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 DD="38824e1f-37f5-42d3-8372-a4b8fa9df946",ur=class{get defaultOptions(){return{endpoint:Qb.default,isCustomEndpoint:!1,token:"",version:Ub,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Mb}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=[RN,yN].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};Vc(this.options.disableBrowserPrivacySignals)?this.runtime=new Vl:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(je.view,{newEventType:je.view,addClientIdParameter:!0}),this.addEventTypeMapping(je.click,{newEventType:je.click,addClientIdParameter:!0}),this.addEventTypeMapping(je.custom,{newEventType:je.custom,addClientIdParameter:!0}),this.addEventTypeMapping(je.search,{newEventType:je.search,addClientIdParameter:!0})}initRuntime(t){return cy()&&pa()?new Ay(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(kD()&&console.warn(PD),new Cy(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return cy()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Yo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Yo()}})}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(_l(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Nl(t,Nl(r,DD)))}})}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(Yo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Vc(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Kn.cvo_cid);if(r==null)return null;let n=Kn.fromString(r);return!n||!pa()||!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,x)=>U(this,void 0,void 0,function*(){let w=yield y;return yield x(t,w)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let x=yield h;return yield y(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[S=>this.setTrackingIdIfTrackingIdNotPresent(S),S=>this.removeEmptyPayloadValues(S,t),S=>this.validateParams(S,t),S=>n?AD(S):S,S=>n?this.removeUnknownParameters(S):S,S=>n?this.processCustomParameters(S):this.mapCustomParametersToCustomData(S)].reduce((S,b)=>U(this,void 0,void 0,function*(){let h=yield S;return yield b(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(p=>p(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 Ol().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(je.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Gr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(je.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Gr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(je.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Gr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(je.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield A(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[je.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(RD(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=Gr(t,["custom"]),o={};r&&kl(r)&&(o=this.lowercaseKeys(r));let i=wD(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Gr(t,["custom"]);if(r&&kl(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=Gr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==je.view||r==je.click||r==je.search||r==je.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==je.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=Gr(t,["userId"]);return TD(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Gr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&kl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&kl(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"?MN(t,r):t}get baseUrl(){return ND(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Ot;(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"})(Ot||(Ot={}));var D;(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"})(D||(D={}));var by={[D.triggerNotify]:"queryPipelineTriggers",[D.triggerExecute]:"queryPipelineTriggers",[D.triggerQuery]:"queryPipelineTriggers",[D.triggerRedirect]:"queryPipelineTriggers",[D.queryErrorBack]:"errors",[D.queryErrorClear]:"errors",[D.queryErrorRetry]:"errors",[D.pagerNext]:"getMoreResults",[D.pagerPrevious]:"getMoreResults",[D.pagerNumber]:"getMoreResults",[D.pagerResize]:"getMoreResults",[D.pagerScrolling]:"getMoreResults",[D.facetSearch]:"facet",[D.facetShowLess]:"facet",[D.facetShowMore]:"facet",[D.recommendation]:"recommendation",[D.likeSmartSnippet]:"smartSnippet",[D.dislikeSmartSnippet]:"smartSnippet",[D.expandSmartSnippet]:"smartSnippet",[D.collapseSmartSnippet]:"smartSnippet",[D.openSmartSnippetFeedbackModal]:"smartSnippet",[D.closeSmartSnippetFeedbackModal]:"smartSnippet",[D.sendSmartSnippetReason]:"smartSnippet",[D.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[D.clearRecentQueries]:"recentQueries",[D.recentResultClick]:"recentlyClickedDocuments",[D.clearRecentResults]:"recentlyClickedDocuments",[D.showLessFoldedResults]:"folding",[D.caseDetach]:"case",[D.likeGeneratedAnswer]:"generatedAnswer",[D.dislikeGeneratedAnswer]:"generatedAnswer",[D.openGeneratedAnswerSource]:"generatedAnswer",[D.generatedAnswerOpenInlineLink]:"generatedAnswer",[D.generatedAnswerFollowupOpenSource]:"generatedAnswer",[D.generatedAnswerStreamEnd]:"generatedAnswer",[D.generatedAnswerSourceHover]:"generatedAnswer",[D.generatedAnswerCopyToClipboard]:"generatedAnswer",[D.generatedAnswerHideAnswers]:"generatedAnswer",[D.generatedAnswerShowAnswers]:"generatedAnswer",[D.generatedAnswerExpand]:"generatedAnswer",[D.generatedAnswerCollapse]:"generatedAnswer",[D.generatedAnswerFeedbackSubmit]:"generatedAnswer",[D.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Ot.expandToFullUI]:"interface",[Ot.openUserActions]:"User Actions",[Ot.showPrecedingSessions]:"User Actions",[Ot.showFollowingSessions]:"User Actions",[Ot.clickViewedDocument]:"User Actions",[Ot.clickPageView]:"User Actions",[Ot.createArticle]:"createArticle"},Xn=class{constructor(){this.runtime=new Vl,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(je.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(je.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(je.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(je.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Mb}};function qD(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function MD(e){return e.map(t=>t.replace(/;/g,""))}function Bb(e){let r=e.join(";");return r.length<=256?r:Bb(e.slice(1))}var Ob=e=>{let t=MD(e),r=qD(t);return Bb(r)};function _b(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Ob(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Ob(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var jl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Vc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Xn:new ur(t)}disable(){this.coveoAnalyticsClient=new Xn}enable(){this.coveoAnalyticsClient=new ur(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(D.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(D.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(D.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(D.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(D.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(D.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(D.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(D.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(D.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(D.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(D.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(D.omniboxAnalytics,_b(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(D.omniboxFromLink,_b(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(D.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.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(D.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.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(D.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(D.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(D.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(D.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(D.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(D.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(D.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(D.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(D.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(D.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(D.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(D.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(D.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(D.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(D.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(D.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(D.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=by[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),m=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(m,n),log:({searchUID:f})=>m.log({lastSearchQueryUid:f})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=by[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:p})=>a.log({lastSearchQueryUid:p})}})}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:p})=>a.log({searchQueryUid:p})}})}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 ur?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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.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(D.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(D.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ll=Object.assign({},qc),Nb=Object.keys(Ll).map(e=>Ll[e]),ma=class extends py{constructor({client:t,uuidGenerator:r=Yo}){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])=>Nb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Nb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ll.pageview,{newEventType:je.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ll.event,{newEventType:je.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 QN(this.ticket)}};ma.Id="svc";var Ul;(function(e){e.click="click",e.flowStart="flowStart"})(Ul||(Ul={}));var vr;(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"})(vr||(vr={}));var Ql;(function(e){e.quit="Quit",e.solved="Solved"})(Ql||(Ql={}));var Bl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Vc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new ur(t):new Xn,this.svc=new ma({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Xn,this.svc=new ma({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new ur(this.options),this.svc=new ma({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(vr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(vr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(vr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(vr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(vr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(vr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(vr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(vr.caseCancelled,{reason:Ql.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(vr.caseSolved,{reason:Ql.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(vr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ul.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ul.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 ur?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 p=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(p)})}},VD=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let i=`context_${r}`;t[i]=o}}),t},ue=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,i=Gr(e,["caseContext","caseId","caseNumber"]),a=VD(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},i),!!a.context_Case_Subject&&{CaseSubject:a.context_Case_Subject}),t&&a)},Gl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Vc(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Xn:new ur(t)}disable(){this.coveoAnalyticsClient=new Xn}enable(){this.coveoAnalyticsClient=new ur(this.opts)}logInterfaceLoad(t){if(t){let r=ue(t);return this.logSearchEvent(D.interfaceLoad,r)}return this.logSearchEvent(D.interfaceLoad)}logRecentQueryClick(t){if(t){let r=ue(t);return this.logSearchEvent(D.recentQueryClick,r)}return this.logSearchEvent(D.recentQueryClick)}logClearRecentQueries(t){if(t){let r=ue(t);return this.logCustomEvent(D.clearRecentQueries,r)}return this.logCustomEvent(D.clearRecentQueries)}logInterfaceChange(t){let r=ue(t);return this.logSearchEvent(D.interfaceChange,r)}logStaticFilterDeselect(t){let r=ue(t);return this.logSearchEvent(D.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=ue(t);return this.logCustomEvent(D.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(D.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=ue(t);return this.logSearchEvent(D.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=ue(t);return this.logSearchEvent(D.breadcrumbResetAll,r)}return this.logSearchEvent(D.breadcrumbResetAll)}logFacetSelect(t){let r=ue(t);return this.logSearchEvent(D.facetSelect,r)}logFacetExclude(t){let r=ue(t);return this.logSearchEvent(D.facetExclude,r)}logFacetDeselect(t){let r=ue(t);return this.logSearchEvent(D.facetDeselect,r)}logFacetUpdateSort(t){let r=ue(t);return this.logSearchEvent(D.facetUpdateSort,r)}logFacetClearAll(t){let r=ue(t);return this.logSearchEvent(D.facetClearAll,r)}logFacetShowMore(t){let r=ue(t,!1);return this.logCustomEvent(D.facetShowMore,r)}logFacetShowLess(t){let r=ue(t,!1);return this.logCustomEvent(D.facetShowLess,r)}logQueryError(t){let r=ue(t,!1);return this.logCustomEvent(D.queryError,r)}logPagerNumber(t){let r=ue(t,!1);return this.logCustomEvent(D.pagerNumber,r)}logPagerNext(t){let r=ue(t,!1);return this.logCustomEvent(D.pagerNext,r)}logPagerPrevious(t){let r=ue(t,!1);return this.logCustomEvent(D.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=ue(t);return this.logSearchEvent(D.didyoumeanAutomatic,r)}return this.logSearchEvent(D.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=ue(t);return this.logSearchEvent(D.didyoumeanClick,r)}return this.logSearchEvent(D.didyoumeanClick)}logResultsSort(t){let r=ue(t);return this.logSearchEvent(D.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=ue(t);return this.logSearchEvent(D.searchboxSubmit,r)}return this.logSearchEvent(D.searchboxSubmit)}logContextChanged(t){let r=ue(t);return this.logSearchEvent(Ot.contextChanged,r)}logExpandToFullUI(t){let r=ue(t);return this.logCustomEvent(Ot.expandToFullUI,r)}logOpenUserActions(t){let r=ue(t,!1);return this.logCustomEvent(Ot.openUserActions,r)}logShowPrecedingSessions(t){let r=ue(t,!1);return this.logCustomEvent(Ot.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=ue(t,!1);return this.logCustomEvent(Ot.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(Ot.clickViewedDocument,Object.assign(Object.assign({},ue(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(Ot.clickPageView,Object.assign(Object.assign({},ue(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(Ot.createArticle,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(D.documentOpen,t,r,n?ue(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(D.copyToClipboard,t,r,n?ue(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(D.caseSendEmail,t,r,n?ue(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(D.feedItemTextPost,t,r,n?ue(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(D.documentQuickview,t,r,n?Object.assign(Object.assign({},ue(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(D.caseAttach,t,r,n?Object.assign(Object.assign({},ue(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&ue(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(D.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(D.likeSmartSnippet,t?ue(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(D.dislikeSmartSnippet,t?ue(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(D.expandSmartSnippet,t?ue(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(D.collapseSmartSnippet,t?ue(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(D.openSmartSnippetFeedbackModal,t?ue(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(D.closeSmartSnippetFeedbackModal,t?ue(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(D.sendSmartSnippetReason,n?Object.assign(Object.assign({},ue(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(D.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},ue(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(D.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},ue(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(D.openSmartSnippetSource,t,r,n?ue(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(D.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(D.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(D.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(D.likeGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(D.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(D.openGeneratedAnswerSource,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(D.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(D.generatedAnswerSourceHover,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(D.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(D.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(D.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(D.generatedAnswerExpand,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(D.generatedAnswerCollapse,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(D.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(D.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(D.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(D.retryGeneratedAnswer,t?Object.assign({},ue(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(D.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(D.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},ue(n,!1)),r):r)}logCustomEvent(t,r){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:by[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(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))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(i)})}logShowMoreFoldedResults(t,r,n){return U(this,void 0,void 0,function*(){return this.logClickEvent(D.showMoreFoldedResults,t,r,n?ue(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(D.showLessFoldedResults,t?ue(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(D.triggerNotify,r?Object.assign(Object.assign({},ue(r,!1)),t):t)}getBaseCustomEventRequest(t){return U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid: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()),{searchQueryUid:this.provider.getSearchUID(),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({},this.getOrigins()),{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 ur?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var ha=()=>"default";var jD=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Zn=class{constructor(t){le(this,"getState",t);le(this,"state");this.state=t()}getLanguage(){return jD(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let p=`context_${i}`;o[p]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Yn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ha()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var Gb=e=>new ur(e).getCurrentVisitorId(),ya=(e,t)=>typeof t=="function"?(...r)=>{let n=uc(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Sa=(e,t)=>(...r)=>{let n=uc(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var jc=class extends Zn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},$b=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o=new jc(t),disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,m=a.configuration.analytics.apiBaseUrl??gt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,S=new Bl({enableAnalytics:g,token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:i,preprocessRequest:ya(e,n),beforeSendHooks:[Sa(e,r),(b,h)=>(e.info({...h,type:b,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function $l(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function LD(e,t){return!!t&&t.facetId in e.facetSet}var kn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),Hb=(e,t)=>e.facetSet[t]?.request,Iy=(e,t)=>{let r=kn(e,t);return LD(e,r)?r:void 0};var zb=(e,t)=>Iy(e,t)?.values.filter(r=>r.state!=="idle")||[],$r=e=>e.search.isLoading;d();c();l();u();function Wb(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function Hr(e){let{activeValue:t,ancestryMap:r}=UD(e);return t?QD(t,r):[]}function UD(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 QD(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function BD(e,t){return!!t&&t.facetId in e.categoryFacetSet}var Ey=(e,t)=>{let r=kn(e,t);if(BD(e,r))return r},Fy=(e,t)=>e.categoryFacetSet[t]?.request,Yb=(e,t)=>{let r=Ey(e,t);return Hr(r?.values??[])},Ty=(e,t)=>{let r=Fy(e,t);return Hr(r?.currentValues??[])};d();c();l();u();function va(){return{}}d();c();l();u();function Kb(e,t){return{request:e,tabs:t}}function Aa(){return{}}d();c();l();u();function Xb(e,t){return{request:e,tabs:t}}function Ca(){return{}}d();c();l();u();function Zb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ba(){return{}}var Ko=(e,t)=>{let r=rx(t,e),n=r?r.field:"",o=Py(n,e);return{facetId:e,facetField:n,facetTitle:o}};function xa(e,t){let{facetId:r,facetValue:n}=e,o=Ko(r,t),i=nx(t,r);return{...o,facetValue:i==="hierarchical"?tx(t,r):n}}function Zt(e){return{facetSet:e.facetSet??ba(),categoryFacetSet:e.categoryFacetSet??va(),dateFacetSet:e.dateFacetSet??Aa(),numericFacetSet:e.numericFacetSet??Ca(),automaticFacetSet:e.automaticFacetSet??$l()}}var Hl=e=>{let t=[];return HD(e).forEach((r,n)=>{let o=nx(e,r.facetId),i=XD(r,n+1);if($D(r)){if(!!!Ty(e,r.facetId).length)return;t.push({...i,...YD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,p)=>{if(a.state==="idle")return;let m=Jb(a,p+1,o),f=GD(r)?ex(a):WD(a);t.push({...i,...m,...f})})}),zD(e).forEach((r,n)=>{let o=KD(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let p=Jb(i,a+1,"specific"),m=ex(i);t.push({...o,...p,...m})})}),t},GD=e=>e.type==="specific",$D=e=>e.type==="hierarchical",HD=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),zD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Jb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),WD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),ex=e=>({displayValue:e.value,value:e.value}),tx=(e,t)=>Ty(e,t).map(n=>n.value).join(";"),YD=(e,t)=>{let n=tx(e,t);return{value:n,valuePosition:1,displayValue:n}},KD=(e,t)=>({title:Py(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),XD=(e,t)=>({title:Py(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Py=(e,t)=>`${e}_${t}`,rx=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,nx=(e,t)=>{let r=rx(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var ky=e=>e.configuration.search.locale,ox=e=>e.configuration.search.timezone,ix=e=>e.configuration.accessToken,ax=e=>e.configuration.organizationId,sx=e=>e.configuration.environment,zl=e=>e.configuration?.knowledge?.agentId,cx=e=>e.configuration.knowledge.debugAgentSession;var Ce=e=>{if(ZD(e)||Oy(e))return e.generatedAnswer?.answerId;if(JD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},ZD=e=>"answer"in e&&"generatedAnswer"in e&&!ee(e.generatedAnswer?.answerConfigurationId),Oy=e=>{let t=zl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},JD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",_y=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Jn=e=>e.followUpAnswers?.conversationId,eq=e=>e.generatedAnswer?.citations,tq=e=>e.followUpAnswers?.followUpAnswers,rq=lt(tq,e=>e?.flatMap(t=>t.citations)),nq=(e,t)=>t,Or=lt(eq,rq,nq,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ut=()=>({q:"",enableQuerySyntax:!1});var Lc=class extends Zn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||xt().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Hl(Zt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ce(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||xt().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||xt().response.results.length}},ux=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o=new Lc(t),disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,m=a.configuration.analytics.apiBaseUrl??gt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,S=new Gl({enableAnalytics:g,token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:i,preprocessRequest:ya(e,n),beforeSendHooks:[Sa(e,r),(b,h)=>(e.info({...h,type:b,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S};d();c();l();u();d();c();l();u();d();c();l();u();var Wl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Wl||{}),Yl=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Yl||{}),zr=e=>{if(Xi(e))return e.map(t=>zr(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""}},Kl=()=>({by:"relevancy"}),lx=e=>({by:"date",order:e});var dx=new W({values:{by:new cc({enum:Yl,required:!0}),order:new cc({enum:Wl}),field:new B}});function lr(){return zr(Kl())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function oq(){return typeof navigator<"u"}function px(){try{return typeof localStorage<"u"}catch{return!1}}function fx(){try{return typeof sessionStorage<"u"}catch{return!1}}function mx(){return oq()&&navigator.cookieEnabled}d();c();l();u();var Xo=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Ny(t,r,o,iq(window.location.hostname))}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 iq(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(aq(n))return n}}function aq(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Ny(t,"1",void 0,e),Xo.get(t)==="1"}catch{return!1}finally{try{Ny(t,"",new Date(0),e)}catch{}}}function Ny(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function gx(){return px()?localStorage:mx()?new Xl:fx()?sessionStorage:new Dy}var Xl=class e{getItem(t){return Xo.get(`${e.prefix}${t}`)}removeItem(t){Xo.erase(`${e.prefix}${t}`)}setItem(t,r,n){Xo.set(`${e.prefix}${t}`,r,n)}};Xl.prefix="coveo_";var Dy=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Zl="__coveo.analytics.history",sq=20,cq=1e3*60,uq=75,Jl=class{constructor(t){this.store=t||gx()}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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!=null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Zl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(Zl);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Zl,JSON.stringify(t.slice(0,sq)))}catch{}}clear(){try{this.store.removeItem(Zl)}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,uq)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>cq:!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 Zo=class Zo extends Jl{static getInstance(t){return Zo.instance||(Zo.instance=new Zo(t)),Zo.instance}constructor(t){super(t)}};le(Zo,"instance",null);var At=Zo;var Uc=class Uc extends Zn{constructor(){super(...arguments);le(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 Hl(Zt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Uc.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||xt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Uc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ce(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??lr()}}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(f=>f.expression),a=o.partialQueries.length-1,p=o.partialQueries[a]||"",m=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:m}}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||ut().q}get responseTime(){return this.state.search?.duration||xt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||xt().response.totalCountFiltered}};le(Uc,"fallbackPipelineName","default");var eo=Uc,hx=({logger:e,getState:t,analyticsClientMiddleware:r=(a,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),p=a.configuration.accessToken,m=a.configuration.analytics.apiBaseUrl??gt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,S=new jl({token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:i,preprocessRequest:ya(e,n),beforeSendHooks:[Sa(e,r),(b,h)=>(e.info({...h,type:b,endpoint:m,token:p},"Analytics request"),h)]},o);return g||S.disable(),S},qy=()=>{let t=At.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function ed(e){let t=yx(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return IA([e,...t,...r],o=>o.uniqueId)}function yx(e){return e.childResults?e.childResults.flatMap(t=>[t,...yx(t)]):[]}d();c();l();u();var Ra=()=>"";function vx(e,t){return{...new eo(t).getBaseMetadata(),actionCause:e,type:e}}function lq(e){return Object.assign(e,{instantlyCallable:!0})}function dq(e,t){let r=i=>{let a=fe(e,i);return lq(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(i,{getState:a,extra:p}){let{analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S}=p;return yield(yield t({getState:a,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S})).log({state:a(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:p,logger:m,disableBrowserPrivacySignals:f}){let{description:g,log:S}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:p,logger:m,disableBrowserPrivacySignals:f});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(b,{getState:h,extra:y}){return yield S({state:h(),extra:y})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var My=(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 mq(i)}return n},pq=e=>e.configuration.analytics.analyticsMode==="legacy",fq=e=>e.configuration.analytics.analyticsMode==="next",mq=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=p=>new a(p)),dq(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:S}){let b=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:k}){for(let F of b)yield F(k)});return function log(_x25){return _ref14.apply(this,arguments)}}()},y=p(),x=i({getState:p,logger:g,analyticsClientMiddleware:m,preprocessRequest:f,disableBrowserPrivacySignals:S,provider:r(p)}),w=yield t(x,p());h.description=w?.description,b.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(k){pq(k)&&(yield gq(w,r,k,g,x.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:E}=Dc(y);return b.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(k){if(fq(k)&&o&&n){let F=n(k);yield bq(E,o,F)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function gq(_x28,_x29,_x30,_x31,_x32){return _gq.apply(this,arguments)}function _gq(){_gq=_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 _gq.apply(this,arguments)}var Ax=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(i){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),Pe=My(e=>hx({...e,provider:e.provider||new eo(e.getState)}),e=>e,eo),n9=My($b,Ax("caseAssist"),jc),ne=e=>My(ux,Ax(e),Lc),et=(e,t)=>{let r=i=>i+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=Rx(e,o),n<0&&(n=Cq(e,o)),n<0&&(n=0),hq(e,r(n),t)};var Qc=(e,t)=>({sourceName:bx(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ra()}),Cx=(e,t)=>({sourceName:bx(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Ra()});function bx(e){let t=e.source;return ee(t)?"unknown":t}var Bc=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function hq(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:vq(e),...(Sx(e)?{documentCategory:Sx(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:Aq(e),queryPipeline:r.pipeline||Ra()}}function Sx(e){return e.raw?.objecttype||void 0}var tt=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||""}),xx={urihash:new B,sourcetype:new B,permanentid:new B},td={uniqueId:H,raw:new W({values:xx}),title:H,uri:H,clickUri:H,rankingModifier:new B({required:!1,emptyAllowed:!0})};function yq(e){return Object.assign({},...Object.keys(xx).map(t=>({[t]:e[t]})))}function Sq(e){return Object.assign({},...Object.keys(td).map(t=>({[t]:e[t]})),{raw:yq(e.raw)})}function vq(e){let t=e.raw.author;return ee(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function Aq(e){let t=e.raw.source;return ee(t)?"unknown":t}var _t=e=>new De(td).validate(Sq(e));function Cq(e,t){for(let[r,n]of t.entries()){let o=ed(n);if(Rx(e,o)!==-1)return r}return-1}function Rx(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function bq(_x34,_x35,_x36){return _bq.apply(this,arguments)}function _bq(){_bq=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _bq.apply(this,arguments)}var _r=(e,t)=>{let r=tt(e),n=et(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Vy=e=>q(e,{evt:H,type:Ze}),wx=e=>Pe("analytics/generic/search",t=>{Vy(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),Ix=e=>Pe("analytics/generic/click",(t,r)=>(_t(e.result),Vy(e),t.makeClickEvent(e.evt,et(e.result,r),tt(e.result),e.meta))),Ex=e=>Pe("analytics/generic/custom",t=>(Vy(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var Fx=()=>({actionCause:"interfaceLoad"}),wa=()=>({actionCause:"interfaceChange"});d();c();l();u();var jy=()=>Ze,Tx=()=>H,Ia=N("configuration/updateBasicConfiguration",e=>q(e,{accessToken:Ze,environment:new B({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Ze})),Ea=N("configuration/updateSearchConfiguration",e=>q(e,{proxyBaseUrl:new B({required:!1,url:!0}),pipeline:new B({required:!1,emptyAllowed:!0}),searchHub:Ze,timezone:Ze,locale:Ze,authenticationProviders:new ie({required:!1,each:H})})),xq={enabled:new de({default:!0}),originContext:jy(),originLevel2:jy(),originLevel3:jy(),proxyBaseUrl:new B({required:!1,url:!0}),runtimeEnvironment:new Ke,anonymous:new de({default:!1}),deviceId:Ze,userDisplayName:Ze,documentLocation:Ze,trackingId:SC,analyticsMode:new B({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new W({options:{required:!1},values:Rb.reduce((e,t)=>(e[t]=yC,e),{})})},rd=N("configuration/updateAnalyticsConfiguration",e=>q(e,xq)),nd=N("configuration/analytics/disable"),od=N("configuration/analytics/enable"),Px=N("configuration/analytics/originlevel2",e=>q(e,{originLevel2:Tx()})),kx=N("configuration/analytics/originlevel3",e=>q(e,{originLevel3:Tx()})),Ox=N("knowledge/setAgentId",e=>q(e,new B({required:!0})));d();c();l();u();var id=N("insightConfiguration/set",e=>q(e,{insightId:H}));d();c();l();u();d();c();l();u();var _x=()=>({insightId:""});var ad=pe(_x(),e=>{e.addCase(id,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Nx=()=>({caseContext:{},caseId:"",caseNumber:""}),te=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});d();c();l();u();var On=e=>{if(e==="yes")return!0;if(e==="no")return!1},Rq=()=>Pe("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function wq(e,t){return Pe({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ce(n),i=Or(n,e);if(!o||!i)return null;let a=Jn(n);return r.makeGeneratedAnswerCitationClick(Qc(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Bc(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Or(r,e);return{answerId:t??Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function Iq(e,t,r){return Pe({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Ce(o),a=Or(o,e);if(!i||!a)return null;let p=Jn(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Or(n,e);return{answerId:r??Ce(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function Eq(e,t){return Pe({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function Fq(e){return Pe({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Jn(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"like"})})}function Tq(e){return Pe({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Jn(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"dislike"})})}var Pq=e=>Pe({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:m,details:f}=e;return{answerId:r??"",helpful:n,details:{readable:On(o),documented:On(i),correctTopic:On(p),hallucinationFree:On(a)},additionalNotes:f,correctAnswerUrl:m}}}),Ly=(e,t,r)=>Pe({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Ce(o);if(!i)return null;let a=Jn(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e??!1})}),Fa=e=>Pe({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),kq=()=>Pe({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),Oq=()=>Pe({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),_q=()=>Pe({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),Nq=()=>Pe({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})});function Dq(e){return Pe({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ce(r);if(!n)return null;let o=Jn(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ce(t)??"",action:"copyToClipboard"})})}function qq(e,t){return Pe({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Or(n,e);if(!o)return null;let i=Jn(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Cx(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var Dx=()=>({actionCause:"retryGeneratedAnswer"}),sd={logCopyGeneratedAnswer:Dq,logGeneratedAnswerHideAnswers:Oq,logGeneratedAnswerShowAnswers:kq,logGeneratedAnswerStreamEnd:Ly,logGeneratedAnswerFeedback:Pq,logDislikeGeneratedAnswer:Tq,logLikeGeneratedAnswer:Fq,logGeneratedAnswerOpenInlineLink:Eq,logHoverCitation:Iq,logOpenGeneratedAnswerSource:wq,logOpenGeneratedAnswerFollowUpSource:qq,logRetryGeneratedAnswer:Rq,logGeneratedAnswerExpand:_q,logGeneratedAnswerCollapse:Nq};var Mq=()=>ne("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(te(t.insightCaseContext))),Uy=e=>ne("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ce(r),o=Or(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Qc(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:Bc(o)},te(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=Or(t,e);return{answerId:Ce(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),Vq=(e,t)=>ne("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ce(n),i=Or(n,e);return!o||!i?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t},te(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=Or(r,e);return{answerId:Ce(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),jq=()=>ne("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"like"})}),Lq=()=>ne("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"dislike"})}),Uq=e=>ne("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ce(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},te(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ce(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:p,documentUrl:m,details:f}=e;return{answerId:r??"",helpful:n,details:{readable:On(o),documented:On(i),correctTopic:On(p),hallucinationFree:On(a)},additionalNotes:f,correctAnswerUrl:m}}}),Qq=(e,t,r)=>ne("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Ce(o);return i?n.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r},te(o.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ce(n)??"",answerGenerated:e})});var Bq=()=>ne("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"show"})}),Gq=()=>ne("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"hide"})}),$q=()=>ne("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"expand"})}),Hq=()=>ne("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"collapse"})}),zq=()=>ne("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ce(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},te(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ce(e)??"",action:"copyToClipboard"})}),Ta={logCopyGeneratedAnswer:zq,logGeneratedAnswerHideAnswers:Gq,logGeneratedAnswerShowAnswers:Bq,logGeneratedAnswerStreamEnd:Qq,logGeneratedAnswerFeedback:Uq,logDislikeGeneratedAnswer:Lq,logLikeGeneratedAnswer:jq,logHoverCitation:Vq,logOpenGeneratedAnswerSource:Uy,logRetryGeneratedAnswer:Mq,logGeneratedAnswerExpand:$q,logGeneratedAnswerCollapse:Hq};d();c();l();u();d();c();l();u();var cd=N("searchHub/set",e=>q(e,new B({required:!0,emptyAllowed:!0})));var Wr=fe("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let i=t(),a=yield o.getInterface(Wq(i));return Xe(a)?n(a.error):(r(cd(a.success.searchHub)),{response:a.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),Wq=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:gt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var qx=()=>({loading:!1,config:void 0});var to=pe(qx(),e=>{e.addCase(Wr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Wr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Wr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function Mx(e){return e.type==="dateRange"}function Vx(e){return`start${e}`}function jx(e){return`end${e}`}var Qy=()=>({dateFacetValueMap:{}});function Yq(e,t,r){let n=e.start,o=e.end;return Hn(n)&&(n=fc(n),r.dateFacetValueMap[t][Vx(n)]=e.start),Hn(o)&&(o=fc(o),r.dateFacetValueMap[t][jx(o)]=e.end),{...e,start:n,end:o}}function By(e,t){if(Mx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>Yq(o,r,t))}}return e}function Yr(e){let t=Qy();return{request:{...e,facets:e.facets?.map(n=>By(n,t))},mappings:t}}function Kq(e,t,r){return{...e,start:r.dateFacetValueMap[t][Vx(e.start)]||e.start,end:r.dateFacetValueMap[t][jx(e.end)]||e.end}}function Xq(e,t){return e.facetId in t.dateFacetValueMap}function Zq(e,t){return Xq(e,t)?{...e,values:e.values.map(r=>Kq(r,e.facetId,t))}:e}function Nr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>Zq(n,t))}}:e}d();c();l();u();d();c();l();u();var ro=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Gb(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}),...(qy()&&{pageId:qy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:da(e)})}}});return function ro(_x39,_x40){return _ref19.apply(this,arguments)}}();var Lx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:gt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?At.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield ro(t.configuration.analytics)))})}});return function Lx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var ud=N("didYouMean/enable"),Ux=N("didYouMean/disable"),ld=N("didYouMean/automaticCorrections/disable"),Qx=N("didYouMean/automaticCorrections/enable"),Jt=N("didYouMean/correction",e=>q(e,H)),Gc=N("didYouMean/automaticCorrections/mode",e=>q(e,new B({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var Jq=N("history/undo"),eM=N("history/redo"),Rt=N("history/snapshot"),_X=fe("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(Jq()),yield t(ot())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),NX=fe("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(eM()),yield t(ot())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),ot=fe("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var _n=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function dd(){return{contextValues:{}}}d();c();l();u();var pd=()=>!1;d();c();l();u();function Bx(){return{contextValues:{}}}d();c();l();u();function Gy(){return{enabled:!0,tabs:{}}}function fd(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Gx(){return[]}d();c();l();u();function Kr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function md(){return{}}d();c();l();u();function $x(){return{}}d();c();l();u();function gd(){return{}}function wt(e){return{context:e.context||dd(),dictionaryFieldContext:e.dictionaryFieldContext||Bx(),facetSet:e.facetSet||ba(),numericFacetSet:e.numericFacetSet||Ca(),dateFacetSet:e.dateFacetSet||Aa(),categoryFacetSet:e.categoryFacetSet||va(),automaticFacetSet:e.automaticFacetSet??$l(),pagination:e.pagination||Kr(),query:e.query||ut(),tabSet:e.tabSet||gd(),advancedSearchQueries:e.advancedSearchQueries||_n(),staticFilterSet:e.staticFilterSet||$x(),querySet:e.querySet||md(),sortCriteria:e.sortCriteria||lr(),pipeline:e.pipeline||Ra(),searchHub:e.searchHub||ha(),facetOptions:e.facetOptions||fd(),facetOrder:e.facetOrder??Gx(),debug:e.debug??pd()}}d();c();l();u();var Yt=N("query/updateQuery",e=>q(e,{q:new B,enableQuerySyntax:new de}));d();c();l();u();var $y=()=>ne("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(te(t.insightCaseContext))),Pa=e=>ne("query")("search/queryError",(t,r)=>t.logQueryError({...te(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Hx=(e,t)=>ne("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),hd=()=>ne("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(te(t.insightCaseContext))),no=()=>ne("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...te(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Xr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var zx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=rM(e),n=tM(e);return Yr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:$n(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield ro(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{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.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function zx(_x49,_x50){return _ref24.apply(this,arguments)}}(),Cr=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield zx(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Cr(_x51,_x52){return _ref25.apply(this,arguments)}}(),Wx=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield zx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function Wx(_x53,_x54){return _ref26.apply(this,arguments)}}(),yd=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Cr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function yd(_x55,_x56){return _ref27.apply(this,arguments)}}(),Sd=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Cr(e,t);return r.request={...r.request,numberOfResults:0},r});return function Sd(_x57,_x58){return _ref28.apply(this,arguments)}}();function tM(e){return Xr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function rM(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Jo=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Nr(yield _this9.extra.apiClient.query(t,n),r),a=Date.now()-o,p=_this9.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(Pa(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:m}=n;if(!o)return null;if(!i)return!ee(m)&&!ee(m.correctedQuery)?_this1.processNextDidYouMeanAutoCorrection(t):null;let f=a.length===0&&p&&p.length!==0,g=!ee(m)&&!ee(m.correctedQuery);if(!f&&!g)return null;let b=f?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(Rt(wt(_this1.getState()))),b})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this10.automaticallyRetryQueryWithCorrection(o);return Xe(i.response)?(_this10.dispatch(Pa(i.response.error)),_this10.rejectWithValue(i.response.error)):(_this10.dispatch(Rt(wt(_this10.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(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}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Cr(r));return _this11.dispatch(Jt(t)),n})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Wn(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var Yx=()=>ne("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(te(t.insightCaseContext))),Hy=()=>ne("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(te(t.insightCaseContext)));var ei=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),i=Nr(yield _this12.extra.apiClient.query(t,n),r),a=Date.now()-o,p=_this12.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(Pa(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:i,automaticallyCorrectQuery:a}=n.didYouMean,{results:p,queryCorrections:m,queryCorrection:f}=o;if(!i||!a)return null;let g=p.length===0&&m&&m.length!==0,S=!ee(f)&&!ee(f.correctedQuery);if(!g&&!S)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(Rt(wt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this15.automaticallyRetryQueryWithCorrection(o);return Xe(i.response)?(_this15.dispatch(Pa(i.response.error)),_this15.rejectWithValue(i.response.error)):(_this15.dispatch(Rt(wt(_this15.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Hy()})})()}processNextDidYouMeanAutoCorrection(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:Hy()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Yt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Cr(r));return _this16.dispatch(Jt(t)),n})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Wn(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...xt(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=Nr(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function zy(_x63,_x64,_x65){return _zy.apply(this,arguments)}function _zy(){_zy=_asyncToGenerator(function*(e,t,r){$c(e);let n=new ei({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),m=yield Cr(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _zy.apply(this,arguments)}function Wy(_x66,_x67,_x68){return _Wy.apply(this,arguments)}function _Wy(){_Wy=_asyncToGenerator(function*(e,t,r){$c(e);let n=new ei({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),m=yield Cr(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _Wy.apply(this,arguments)}function Yy(_x69,_x70){return _Yy.apply(this,arguments)}function _Yy(){_Yy=_asyncToGenerator(function*(e,t){let r=new ei({...t,analyticsAction:$y()}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield $y().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield yd(e,a),m=yield r.fetchFromAPI(p);return yield r.process(m,p)});return _Yy.apply(this,arguments)}function Ky(_x71,_x72,_x73){return _Ky.apply(this,arguments)}function _Ky(){_Ky=_asyncToGenerator(function*(e,t,r){let n=new ei({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:i,logger:a}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:i,logger:a}),m=yield Sd(e,p),f=yield n.fetchFromAPI(m);return yield n.process(f,m)});return _Ky.apply(this,arguments)}var Kx=fe("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield zy(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Xx=fe("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Wy(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),Zx=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Yy(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Jx=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ky(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var eR=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let i=Date.now(),a=Nr(yield e.query(r,o),n),p=Date.now()-i,m=t.query?.q||"";return{response:a,duration:p,queryExecuted:m,requestExecuted:r}});return function eR(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),xe=fe("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return zy(r,t,e.legacy);$c(r);let n=new Jo({...t}),o=e.next?Xy(e.next):void 0,i=yield Cr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),vd=fe("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wy(r,t,e.legacy);$c(r);let n=new Jo({...t}),o=e.next?Xy(e.next):void 0,i=yield Cr(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),Ad=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Yy(r,t);let n=new Jo({...t}),o=Xy({actionCause:"browseResults"}),i=yield yd(r,o),a=yield n.fetchFromAPI(i);return yield n.process(a)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),ka=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ky(r,t,e.legacy);let n=new Jo({...t}),o=yield Sd(r),i=yield n.fetchFromAPI(o);return yield n.process(i)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),Cd=fe("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:H});let i=e.id,a=yield Lx(i,t()),p=yield n.querySuggest(a);return Xe(p)?r(p.error):{id:i,q:a.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),$c=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Xy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var er=N("breadcrumb/deselectAll"),bd=N("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Oa=N("facet/updateFacetAutoSelection",e=>q(e,{allow:new de({required:!0})}));d();c();l();u();d();c();l();u();var xd=class extends eo{constructor(r){super(r);le(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??ut().q}get responseTime(){return this.activeInstantResultCache?.duration??xt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??xt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var tR=()=>Pe("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new xd(e)),rR=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Zy={id:H},nM={...Zy,q:Je},Nte=N("instantResults/register",e=>q(e,Zy)),Rd=N("instantResults/updateQuery",e=>q(e,nM)),Dte=N("instantResults/clearExpired",e=>q(e,Zy));d();c();l();u();var wd=new oe({required:!0,min:0}),Id=N("pagination/registerNumberOfResults",e=>q(e,wd)),Ed=N("pagination/updateNumberOfResults",e=>q(e,wd)),Fd=N("pagination/registerPage",e=>q(e,wd)),oo=N("pagination/updatePage",e=>q(e,wd)),Td=N("pagination/nextPage"),Pd=N("pagination/previousPage");d();c();l();u();d();c();l();u();var ti=(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:da(e)}});var _a=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Xt(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&&ti(e.configuration.analytics,t,r)),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var io=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Xt(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:At.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 ro(e.configuration.analytics,t))),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function io(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var Jy=()=>Pe("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),ao=e=>Pe("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||_n().aq,cq:r.advancedSearchQueries?.cq||_n().cq,dq:r.advancedSearchQueries?.dq||_n().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var eS=()=>Pe("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),nR=()=>({actionCause:"didYouMeanClick"}),oR=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var qre=new W({values:{undoneQuery:Je},options:{required:!0}}),iR=()=>Pe("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var Na=N("trigger/query/ignore",e=>q(e,new B({emptyAllowed:!0,required:!0}))),Da=N("trigger/query/modification",e=>q(e,new W({values:{originalQuery:Ze,modification:Ze}})));d();c();l();u();d();c();l();u();function Hc(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 aR(e){return Xr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var tS={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function oM(e){return Xr(e).map(t=>{let r=tS[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function iM(e){return[...oM(e.facetSet??{}),...aR(e.numericFacetSet??{}),...aR(e.dateFacetSet??{}),...Xr(e.categoryFacetSet??{})]}function aM(e){return iM(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function kd(e){return Hc(aM(e),e.facetOrder??[])}var so=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=uM(e),n=kd(e),o=sM(e),i=yield io(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Yr({...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 so(_x98,_x99){return _ref40.apply(this,arguments)}}();function sM(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(cM).filter(r=>r.currentValues.length>0):void 0}function cM(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function uM(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=lM(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function lM(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 co=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Nr(yield _this17.extra.apiClient.search(r,n),t),a=Date.now()-o,p=_this17.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(ao(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:m}=n;if(!o||!i)return null;let f=a.length===0&&p&&p.length!==0,g=!ee(m)&&!ee(m.correctedQuery);if(!f&&!g)return null;let b=f?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(Rt(wt(_this19.getState()))),b})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this20.automaticallyRetryQueryWithCorrection(o);return Xe(i.response)?(_this20.dispatch(ao(i.response.error)),_this20.rejectWithValue(i.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(Rt(wt(_this20.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:eS()})})()}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:eS()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(Na("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let i=_this21.getCurrentQuery(),a=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return Xe(a.response)?(_this21.dispatch(ao(a.response.error)),_this21.rejectWithValue(a.response.error)):(_this21.dispatch(Rt(wt(_this21.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:iR()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...xt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Wn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield so(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Jt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Da({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield so(_this23.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 Qne=fe("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Od(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),Bne=fe("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield nS(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),Gne=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield oS(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),$ne=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield mM(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),Hne=fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return rS(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),dM=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield so(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function dM(_x112,_x113){return _ref46.apply(this,arguments)}}(),pM=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield io(e);return Yr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function pM(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),fM=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield so(e,t);return r.request.numberOfResults=0,r});return function fM(_x117,_x118){return _ref48.apply(this,arguments)}}(),sR=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function rS(_x119,_x120){return _rS.apply(this,arguments)}function _rS(){_rS=_asyncToGenerator(function*(e,t){q(e,{id:H,q:H,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new co({...t,analyticsAction:tR()},f=>{t.dispatch(Rd({q:f,id:e.id}))}),a=yield pM(o,r,n),p=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),m=yield i.process(p);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,analyticsAction:m.analyticsAction,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return _rS.apply(this,arguments)}function nS(_x121,_x122,_x123){return _nS.apply(this,arguments)}function _nS(){_nS=_asyncToGenerator(function*(e,t,r){sR(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=new co({...t,analyticsAction:r}),m=yield so(e,a),f=yield p.fetchFromAPI(m,{origin:"mainSearch"});return yield p.process(f)});return _nS.apply(this,arguments)}function oS(_x124,_x125){return _oS.apply(this,arguments)}function _oS(){_oS=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Jy().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new co({...e,analyticsAction:Jy()}),p=yield dM(t,i),m=yield a.fetchFromAPI(p,{origin:"mainSearch"});return yield a.process(m)});return _oS.apply(this,arguments)}function mM(_x126,_x127,_x128){return _mM.apply(this,arguments)}function _mM(){_mM=_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}),p=new co({...e,analyticsAction:t}),m=yield fM(r,a),f=yield p.fetchFromAPI(m,{origin:"facetValues"});return yield p.process(f)});return _mM.apply(this,arguments)}function Od(_x129,_x130,_x131){return _Od.apply(this,arguments)}function _Od(){_Od=_asyncToGenerator(function*(e,t,r){sR(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),p=yield so(e,a),m=new co({...t,analyticsAction:r}),f=yield m.fetchFromAPI(p,{origin:"mainSearch"});return yield m.process(f)});return _Od.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var cR=lt(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 br=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=aS(e),o=gM(e),i=hM(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield io(e,r):_a(e,t,r);return Yr({...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:iS(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 br(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function iS(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function gM(e){return Hc(SM(e),e.facetOrder??[])}function hM(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(yM).filter(r=>r.currentValues.length>0):void 0}function yM(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function SM(e){return vM(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function vM(e){return[...AM(e.facetSet??{}),...uR(e.numericFacetSet??{}),...uR(e.dateFacetSet??{}),...Xr(e.categoryFacetSet??{})]}function AM(e){return Xr(e).map(t=>{let r=tS[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function uR(e){return Xr(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 aS(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=cR(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}var uo=class{constructor(t,r=n=>{this.dispatch(Yt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Nr(yield _this24.extra.apiClient.search(r,n),t),a=Date.now()-o,p=_this24.getState().query?.q||"";return{response:i,duration:a,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return Xe(t.response)?(this.dispatch(ao(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:p,queryCorrection:m}=n;if(!o)return null;if(!i)return!ee(m)&&!ee(m.correctedQuery)?_this26.processModernDidYouMeanAutoCorrection(t):null;let f=a.length===0&&p&&p.length!==0,g=!ee(m)&&!ee(m.correctedQuery);if(!f&&!g)return null;let b=f?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(Rt(wt(_this26.getState()))),b})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this27.automaticallyRetryQueryWithCorrection(o);return Xe(i.response)?(_this27.dispatch(ao(i.response.error)),_this27.rejectWithValue(i.response.error)):(_this27.dispatch(Rt(wt(_this27.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 _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(Na("")),null;let i=_this28.getCurrentQuery(),a=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return Xe(a.response)?(_this28.dispatch(ao(a.response.error)),_this28.rejectWithValue(a.response.error)):(_this28.dispatch(Rt(wt(_this28.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Rt(wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Wn(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=oR(),o=yield _this29.fetchFromAPI(yield br(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Jt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(Da({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield br(_this30.getState(),_this30.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 qa=fe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{q:new B,enableQuerySyntax:new de,clearFilters:new de}),e.clearFilters&&(r(er()),r(bd())),r(Oa({allow:!0})),r(Yt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(oo(1))}),lR=N("search/updateSearchAction"),qe=fe("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Od(r,t,e.legacy);dR(r);let n=e.next?pR(e.next):void 0,o=yield br(r,t.extra.navigatorContext,n),i=new uo({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Jr=fe("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(dR(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return nS(r,t,e.legacy);let n=new uo({...t,analyticsAction:e.next}),o=yield br(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),lo=fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return oS(t,r);let n=vx("browseResults",t.getState),o=new uo({...t,analyticsAction:n}),i=yield CM(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),Ma=fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Od(r,t,e.legacy);let n=new uo({...t,analyticsAction:{}}),o=yield xM(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),Koe=fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return rS(e,t);q(e,{id:H,q:H,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,i=pR(rR()),a=yield bM(r,t.extra.navigatorContext,n,o,i),p=new uo({...t,analyticsAction:i},g=>{t.dispatch(Rd({q:g,id:e.id}))}),m=yield p.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),f=yield p.process(m);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),CM=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function CM(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),bM=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let i=_a(e,t,o);return Yr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function bM(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),xM=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield br(e,t,r);return n.request.numberOfResults=0,n});return function xM(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),dR=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},pR=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function fR(_x158,_x159){return _fR.apply(this,arguments)}function _fR(){_fR=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:r.apiBaseUrl??Xt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _fR.apply(this,arguments)}var zc=fe("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),i=yield fR(o,e),a=yield t.apiClient.html(i);return Xe(a)?n(a.error):{content:a.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),_d=N("resultPreview/next"),Nd=N("resultPreview/previous"),gR=N("resultPreview/prepare",e=>q(e,{results:new ie({required:!0})})),mR=2048,Dd=fe("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=cC(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>mR&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${mR} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function sS(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var cS=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=sS();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},uS=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Va=pe(sS(),e=>{e.addCase(zc.pending,t=>{t.isLoading=!0}).addCase(zc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(qe.fulfilled,(t,r)=>{cS(t),t.resultsWithPreview=uS(r.payload.response.results)}).addCase(lo.fulfilled,(t,r)=>{cS(t),t.resultsWithPreview=t.resultsWithPreview.concat(uS(r.payload.response.results))}).addCase(Jr.fulfilled,cS).addCase(gR,(t,r)=>{t.resultsWithPreview=uS(r.payload.results)}).addCase(_d,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Nd,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(Dd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var po=(e,t)=>{let r=e;return ee(r[t])?ee(e.raw[t])?null:e.raw[t]:r[t]},RM=e=>t=>e.every(r=>!ee(po(t,r))),wM=e=>t=>e.every(r=>ee(po(t,r))),IM=(e,t)=>r=>{let n=hR(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},EM=(e,t)=>r=>{let n=hR(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},hR=(e,t)=>{let r=po(t,e);return Bu(r)?r:[r]},yR={getResultProperty:po,fieldsMustBeDefined:RM,fieldsMustNotBeDefined:wM,fieldMustMatch:IM,fieldMustNotMatch:EM};function qd(e){return e.search.response.searchUid!==""}function SR(e,t,r){return e.search.results.find(n=>po(n,t)===r)}var lS=lt(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var ja=N("app/setError");function dS(e,t){let r=t.payload??null;r&&(e.response=xt().response,e.results=[],e.questionAnswer=ra()),e.error=r,e.isLoading=!1}function pS(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function FM(e,t){pS(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function vR(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function TM(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Te=pe(xt(),e=>{e.addCase(qe.rejected,(t,r)=>dS(t,r)),e.addCase(lo.rejected,(t,r)=>dS(t,r)),e.addCase(Jr.rejected,(t,r)=>dS(t,r)),e.addCase(qe.fulfilled,(t,r)=>{FM(t,r)}),e.addCase(lo.fulfilled,(t,r)=>{pS(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Jr.fulfilled,(t,r)=>{pS(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ma.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(qe.pending,vR),e.addCase(lo.pending,TM),e.addCase(Jr.pending,vR),e.addCase(lR,(t,r)=>{t.searchAction=r.payload}),e.addCase(ja,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Md=pe(ha(),e=>{e.addCase(cd,(t,r)=>r.payload).addCase(ot.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ea,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var AR=class extends Error{constructor(t){super(t[0].message);le(this,"issues");this.name="SchemaError",this.issues=t}};var CS="uninitialized",mS="pending",gS="fulfilled",hS="rejected";function CR(e){return{status:e,isUninitialized:e===CS,isLoading:e===mS,isSuccess:e===gS,isError:e===hS}}var bR=Qr;function qR(e,t){if(e===t||!(bR(e)&&bR(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]=qR(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function yS(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function PM(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function kM(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function bS(e){return e!=null}function xR(e){return[...(e?.values()??[])].filter(bS)}function OM(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var _M=e=>e.replace(/\/$/,""),NM=e=>e.replace(/^\//,"");function DM(e,t){if(!e)return t;if(!t)return e;if(PM(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=_M(e),t=NM(t),`${e}${r}${t}`}function Ud(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var SS=()=>new Map,qM=e=>{let t=new s.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},MM=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},RR=(...e)=>A(...e),VM=e=>e.status>=200&&e.status<=299,jM=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function wR(e){if(!Qr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var LM=e=>typeof e=="object"&&(Qr(e)||Array.isArray(e)||typeof e.toJSON=="function");function MR({baseUrl:e,prepareHeaders:t=S=>S,fetchFn:r=RR,paramsSerializer:n,isJsonContentType:o=jM,jsonContentType:i="application/json",jsonReplacer:a,timeout:p,responseHandler:m,validateStatus:f,...g}={}){return typeof A>"u"&&r===RR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(b,h,y){let{getState:x,extra:w,endpoint:E,forced:k,type:F}=h,_,{url:I,headers:O=new C(g.headers),params:P=void 0,responseHandler:T=m??"json",validateStatus:V=f??VM,timeout:G=p,...j}=typeof b=="string"?{url:b}:b,L={...g,signal:G?MM(h.signal,qM(G)):h.signal,...j};O=new C(wR(O)),L.headers=(yield t(O,{getState:x,arg:b,extra:w,endpoint:E,forced:k,type:F,extraOptions:y}))||O;let $=LM(L.body);if(L.body!=null&&!$&&typeof L.body!="string"&&L.headers.delete("content-type"),!L.headers.has("content-type")&&$&&L.headers.set("content-type",i),$&&o(L.headers)&&(L.body=JSON.stringify(L.body,a)),L.headers.has("accept")||(T==="json"?L.headers.set("accept","application/json"):T==="text"&&L.headers.set("accept","text/plain, text/html, */*")),P){let J=~I.indexOf("?")?"&":"?",Se=n?n(P):new URLSearchParams(wR(P));I+=J+Se}I=DM(e,I);let Q=new Request(I,L);_={request:new Request(I,L)};let K;try{K=yield r(Q)}catch(J){return{error:{status:(J instanceof Error||typeof DOMException<"u"&&J instanceof DOMException)&&J.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(J)},meta:_}}let z=K.clone();_.response=z;let Z,Y="";try{let J;if(yield Promise.all([S(K,T).then(Se=>Z=Se,Se=>J=Se),z.text().then(Se=>Y=Se,()=>{})]),J)throw J}catch(J){return{error:{status:"PARSING_ERROR",originalStatus:K.status,data:Y,error:String(J)},meta:_}}return V(K,Z)?{data:Z,meta:_}:{error:{status:K.status,data:Z},meta:_}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function S(_x167,_x168){return _S2.apply(this,arguments)}function _S2(){_S2=_asyncToGenerator(function*(b,h){if(typeof h=="function")return h(b);if(h==="content-type"&&(h=o(b.headers)?"json":"text"),h==="json"){let y=yield b.text();return y.length?JSON.parse(y):null}return b.text()});return _S2.apply(this,arguments)}}var La=class{constructor(e,t=void 0){le(this,"value");le(this,"meta");this.value=e,this.meta=t}};function UM(){return _UM.apply(this,arguments)}function _UM(){_UM=_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 p=setTimeout(()=>i(),o);if(r){let m=()=>{clearTimeout(p),a(new Error("Aborted"))};r.aborted?(clearTimeout(p),a(new Error("Aborted"))):r.addEventListener("abort",m,{once:!0})}})});return _UM.apply(this,arguments)}function VR(e,t){throw Object.assign(new La({error:e,meta:t}),{throwImmediately:!0})}function fS(e){e.aborted&&VR({status:"CUSTOM_ERROR",error:"Aborted"})}var IR={},QM=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let[i]=[5,(t||IR).maxRetries,(o||IR).maxRetries].filter(f=>f!==void 0).slice(-1),p={maxRetries:i,backoff:UM,retryCondition:(f,g,{attempt:S})=>S<=i,...t,...o},m=0;for(;;){fS(n.signal);try{let f=yield e(r,n,o);if(f.error)throw new La(f);return f}catch(f){if(m++,f.throwImmediately){if(f instanceof La)return f.value;throw f}if(f instanceof La){if(!p.retryCondition(f.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return f.value}else if(m>p.maxRetries)return{error:f};fS(n.signal);try{yield p.backoff(m,p.maxRetries,n.signal)}catch(g){throw fS(n.signal),g}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),jR=Object.assign(QM,{fail:VR}),Bd="__rtkq/",BM="online",GM="offline";var LR="focused";var xS=N(`${Bd}${LR}`),UR=N(`${Bd}un${LR}`),RS=N(`${Bd}${BM}`),QR=N(`${Bd}${GM}`);var Zc="query",BR="mutation",GR="infinitequery";function Gd(e){return e.type===Zc}function $M(e){return e.type===BR}function Yc(e){return e.type===GR}function Qd(e){return Gd(e)||Yc(e)}function wS(e,t,r,n,o,i){let a=HM(e)?e(t,r,n,o):e;return a?yS(a,bS,p=>i($R(p))):[]}function HM(e){return typeof e=="function"}function $R(e){return typeof e=="string"?{type:e}:e}function zM(e,t){return e.catch(t)}var Ua=(e,t)=>e.endpointDefinitions[t],Kc=Symbol("forceQueryFn"),vS=e=>typeof e[Kc]=="function";function WM({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let p=I=>a(I)?.runningQueries,m=I=>a(I)?.runningMutations,{unsubscribeQueryResult:f,removeMutationResult:g,updateSubscriptionOptions:S}=o.internalActions;return{buildInitiateQuery:k,buildInitiateInfiniteQuery:F,buildInitiateMutation:_,getRunningQueryThunk:b,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:x};function b(I,O){return P=>{let T=e({queryArgs:O,endpointDefinition:Ua(i,I),endpointName:I});return p(P)?.get(T)}}function h(I,O){return P=>m(P)?.get(O)}function y(){return I=>xR(p(I))}function x(){return I=>xR(m(I))}function w(I){}function E(I,O){let P=(T,{subscribe:V=!0,forceRefetch:G,subscriptionOptions:j,[Kc]:L,...$}={})=>(Q,K)=>{let z=e({queryArgs:T,endpointDefinition:O,endpointName:I}),Z,Y={...$,type:Zc,subscribe:V,forceRefetch:G,subscriptionOptions:j,endpointName:I,originalArgs:T,queryCacheKey:z,[Kc]:L};if(Gd(O))Z=t(Y);else{let{direction:Ie,initialPageParam:Me,refetchCachedPages:_e}=$;Z=r({...Y,direction:Ie,initialPageParam:Me,refetchCachedPages:_e})}let J=o.endpoints[I].select(T),Se=Q(Z),ke=J(K());let{requestId:$e,abort:ct}=Se,Ye=ke.requestId!==$e,rt=p(Q)?.get(z),nt=()=>J(K()),Oe=Object.assign(L?Se.then(nt):Ye&&!rt?Promise.resolve(ke):Promise.all([rt,Se]).then(nt),{arg:T,requestId:$e,subscriptionOptions:j,queryCacheKey:z,abort:ct,unwrap(){return _asyncToGenerator(function*(){let Ie=yield Oe;if(Ie.isError)throw Ie.error;return Ie.data})()},refetch:Ie=>Q(P(T,{subscribe:!1,forceRefetch:!0,...Ie})),unsubscribe(){V&&Q(f({queryCacheKey:z,requestId:$e}))},updateSubscriptionOptions(Ie){Oe.subscriptionOptions=Ie,Q(S({endpointName:I,requestId:$e,queryCacheKey:z,options:Ie}))}});if(!rt&&!Ye&&!L){let Ie=p(Q);Ie.set(z,Oe),Oe.then(()=>{Ie.delete(z)})}return Oe};return P}function k(I,O){return E(I,O)}function F(I,O){return E(I,O)}function _(I){return(O,{track:P=!0,fixedCacheKey:T}={})=>(V,G)=>{let j=V(n({type:"mutation",endpointName:I,originalArgs:O,track:P,fixedCacheKey:T}));let{requestId:L,abort:$,unwrap:Q}=j,K=zM(j.unwrap().then(J=>({data:J})),J=>({error:J})),z=()=>{V(g({requestId:L,fixedCacheKey:T}))},Z=Object.assign(K,{arg:j.arg,requestId:L,abort:$,unwrap:Q,reset:z}),Y=m(V);return Y.set(L,Z),Z.then(()=>{Y.delete(L)}),T&&(Y.set(T,Z),Z.then(()=>{Y.get(T)===Z&&Y.delete(T)})),Z}}}var HR=class extends AR{constructor(t,r,n,o){super(t);le(this,"value");le(this,"schemaName");le(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},ri=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function ni(_x172,_x173,_x174,_x175){return _ni.apply(this,arguments)}function _ni(){_ni=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new HR(o.issues,t,r,n);return o.value});return _ni.apply(this,arguments)}function ER(e){return e}var Wc=(e={})=>({...e,[kc]:!0});function YM({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:p,catchSchemaFailure:m,skipSchemaValidation:f}){let g=(j,L,$,Q)=>(K,z)=>{let Z=r[j],Y=n({queryArgs:L,endpointDefinition:Z,endpointName:j});if(K(o.internalActions.queryResultPatched({queryCacheKey:Y,patches:$})),!Q)return;let J=o.endpoints[j].select(L)(z()),Se=wS(Z.providesTags,J.data,void 0,L,{},i);K(o.internalActions.updateProvidedBy([{queryCacheKey:Y,providedTags:Se}]))};function S(j,L,$=0){let Q=[L,...j];return $&&Q.length>$?Q.slice(0,-1):Q}function b(j,L,$=0){let Q=[...j,L];return $&&Q.length>$?Q.slice(1):Q}let h=(j,L,$,Q=!0)=>(K,z)=>{let Z=o.endpoints[j].select(L)(z()),Y={patches:[],inversePatches:[],undo:()=>K(o.util.patchQueryData(j,L,Y.inversePatches,Q))};if(Z.status==="uninitialized")return Y;let J;if("data"in Z)if(jt(Z.data)){let[Se,ke,$e]=$h(Z.data,$);Y.patches.push(...ke),Y.inversePatches.push(...$e),J=Se}else J=$(Z.data),Y.patches.push({op:"replace",path:[],value:J}),Y.inversePatches.push({op:"replace",path:[],value:Z.data});return Y.patches.length===0||K(o.util.patchQueryData(j,L,Y.patches,Q)),Y},y=(j,L,$)=>Q=>Q(o.endpoints[j].initiate(L,{subscribe:!1,forceRefetch:!0,[Kc]:()=>({data:$})})),x=(j,L)=>j.query&&j[L]?j[L]:ER,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(j,{signal:L,abort:$,rejectWithValue:Q,fulfillWithValue:K,dispatch:z,getState:Z,extra:Y}){let J=r[j.endpointName],{metaSchema:Se,skipSchemaValidation:ke=f}=J,$e=j.type===Zc;try{let ct=ER,Ye={signal:L,abort:$,dispatch:z,getState:Z,extra:Y,endpoint:j.endpointName,type:j.type,forced:$e?E(j,Z()):void 0,queryCacheKey:$e?j.queryCacheKey:void 0},rt=$e?j[Kc]:void 0,nt,Oe=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(Me,_e,ht,bt){if(_e==null&&Me.pages.length)return Promise.resolve({data:Me});let gr=yield Ie({queryArg:j.originalArgs,pageParam:_e}),sr=bt?S:b;return{data:{pages:sr(Me.pages,gr.data,ht),pageParams:sr(Me.pageParams,_e,ht)},meta:gr.meta}});return function Oe(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Ie(_x182){return _Ie.apply(this,arguments)}function _Ie(){_Ie=_asyncToGenerator(function*(Me){let _e,{extraOptions:ht,argSchema:bt,rawResponseSchema:gr,responseSchema:sr}=J;if(bt&&!ri(ke,"arg")&&(Me=yield ni(bt,Me,"argSchema",{})),rt?_e=rt():J.query?(ct=x(J,"transformResponse"),_e=yield t(J.query(Me),Ye,ht)):_e=yield J.queryFn(Me,Ye,ht,In=>t(In,Ye,ht)),typeof process<"u",_e.error)throw new La(_e.error,_e.meta);let{data:Tr}=_e;gr&&!ri(ke,"rawResponse")&&(Tr=yield ni(gr,_e.data,"rawResponseSchema",_e.meta));let hr=yield ct(Tr,_e.meta,Me);return sr&&!ri(ke,"response")&&(hr=yield ni(sr,hr,"responseSchema",_e.meta)),{..._e,data:hr}});return _Ie.apply(this,arguments)}if($e&&"infiniteQueryOptions"in J){let{infiniteQueryOptions:Me}=J,{maxPages:_e=1/0}=Me,ht=j.refetchCachedPages??Me.refetchCachedPages??!0,bt,gr={pages:[],pageParams:[]},sr=a.selectQueryEntry(Z(),j.queryCacheKey)?.data,Tr=E(j,Z())&&!j.direction||!sr?gr:sr;if("direction"in j&&j.direction&&Tr.pages.length){let hr=j.direction==="backward";bt=yield Oe(Tr,(hr?AS:Ld)(Me,Tr,j.originalArgs),_e,hr)}else{let{initialPageParam:hr=Me.initialPageParam}=j,In=sr?.pageParams??[],$g=In[0]??hr,iA=In.length;if(bt=yield Oe(Tr,$g,_e),rt&&(bt={data:bt.data.pages[0]}),ht)for(let aA=1;aA<iA;aA++){let oO=Ld(Me,bt.data,j.originalArgs);bt=yield Oe(bt.data,oO,_e)}}nt=bt}else nt=yield Ie(j.originalArgs);return Se&&!ri(ke,"meta")&&nt.meta&&(nt.meta=yield ni(Se,nt.meta,"metaSchema",nt.meta)),K(nt.data,Wc({fulfilledTimeStamp:Date.now(),baseQueryMeta:nt.meta}))}catch(ct){let Ye=ct;if(Ye instanceof La){let rt=x(J,"transformErrorResponse"),{rawErrorResponseSchema:nt,errorResponseSchema:Oe}=J,{value:Ie,meta:Me}=Ye;try{nt&&!ri(ke,"rawErrorResponse")&&(Ie=yield ni(nt,Ie,"rawErrorResponseSchema",Me)),Se&&!ri(ke,"meta")&&(Me=yield ni(Se,Me,"metaSchema",Me));let _e=yield rt(Ie,Me,j.originalArgs);return Oe&&!ri(ke,"errorResponse")&&(_e=yield ni(Oe,_e,"errorResponseSchema",Me)),Q(_e,Wc({baseQueryMeta:Me}))}catch(_e){Ye=_e}}try{if(Ye instanceof HR){let rt={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:$e?j.queryCacheKey:void 0};J.onSchemaFailure?.(Ye,rt),p?.(Ye,rt);let{catchSchemaFailure:nt=m}=J;if(nt)return Q(nt(Ye,rt),Wc({baseQueryMeta:Ye._bqMeta}))}}catch(rt){Ye=rt}throw typeof process<"u",console.error(Ye),Ye}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function E(j,L){let $=a.selectQueryEntry(L,j.queryCacheKey),Q=a.selectConfig(L).refetchOnMountOrArgChange,K=$?.fulfilledTimeStamp,z=j.forceRefetch??(j.subscribe&&Q);return z?z===!0||(Number(new Date)-Number(K))/1e3>=z:!1}let k=()=>fe(`${e}/executeQuery`,w,{getPendingMeta({arg:j}){let L=r[j.endpointName];return Wc({startedTimeStamp:Date.now(),...(Yc(L)?{direction:j.direction}:{})})},condition(j,{getState:L}){let $=L(),Q=a.selectQueryEntry($,j.queryCacheKey),K=Q?.fulfilledTimeStamp,z=j.originalArgs,Z=Q?.originalArgs,Y=r[j.endpointName],J=j.direction;if(vS(j))return!0;if(Q?.status==="pending")return!1;if(E(j,$)||Gd(Y)&&Y?.forceRefetch?.({currentArg:z,previousArg:Z,endpointState:Q,state:$}))return!0;if(K&&!J)return!1;if(J&&Yc(Y)){let Se=Q?.data;if(Se?.pages.length){let{infiniteQueryOptions:ke}=Y;if((J==="forward"?Ld:AS)(ke,Se,z)==null)return!1}}return!0},dispatchConditionRejection:!0}),F=k(),_=k(),I=fe(`${e}/executeMutation`,w,{getPendingMeta(){return Wc({startedTimeStamp:Date.now()})}}),O=j=>"force"in j,P=j=>"ifOlderThan"in j,T=(j,L,$={})=>(Q,K)=>{let z=O($)&&$.force,Z=P($)&&$.ifOlderThan,Y=(Se=!0)=>{let ke={forceRefetch:Se,subscribe:!1};return o.endpoints[j].initiate(L,ke)},J=o.endpoints[j].select(L)(K());if(z)Q(Y());else if(Z){let Se=J?.fulfilledTimeStamp;if(!Se){Q(Y());return}(Number(new Date)-Number(new Date(Se)))/1e3>=Z&&Q(Y())}else Q(Y(!1))};function V(j){return L=>L?.meta?.arg?.endpointName===j}function G(j,L){return{matchPending:ua(Il(j),V(L)),matchFulfilled:ua(Pn(j),V(L)),matchRejected:ua(zo(j),V(L))}}return{queryThunk:F,mutationThunk:I,infiniteQueryThunk:_,prefetch:T,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:G}}function Ld(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function AS(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function zR(e,t,r,n){return wS(r[e.meta.arg.endpointName][t],Pn(e)?e.payload:void 0,_c(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function FR(e){return Wt(e)?Sl(e):e}function Vd(e,t,r){let n=e[t];n&&r(n)}function Xc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function TR(e,t,r){let n=e[Xc(t)];n&&r(n)}var jd={};function KM({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:p},assertTagType:m,config:f}){let g=N(`${e}/resetApiState`);function S(P,T,V,G){var j;P[j=T.queryCacheKey]??(P[j]={status:CS,endpointName:T.endpointName}),Vd(P,T.queryCacheKey,L=>{L.status=mS,L.requestId=V&&L.requestId?L.requestId:G.requestId,T.originalArgs!==void 0&&(L.originalArgs=T.originalArgs),L.startedTimeStamp=G.startedTimeStamp;let $=o[G.arg.endpointName];Yc($)&&"direction"in T&&(L.direction=T.direction)})}function b(P,T,V,G){Vd(P,T.arg.queryCacheKey,j=>{if(j.requestId!==T.requestId&&!G)return;let{merge:L}=o[T.arg.endpointName];if(j.status=gS,L){if(j.data!==void 0){let{fulfilledTimeStamp:$,arg:Q,baseQueryMeta:K,requestId:z}=T;j.data=$o(j.data,Z=>L(Z,V,{arg:Q.originalArgs,baseQueryMeta:K,fulfilledTimeStamp:$,requestId:z}))}else j.data=V;}else j.data=o[T.arg.endpointName].structuralSharing??!0?qR(Wt(j.data)?Bh(j.data):j.data,V):V;delete j.error,j.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=Wo({name:`${e}/queries`,initialState:jd,reducers:{removeQueryResult:{reducer(P,{payload:{queryCacheKey:T}}){delete P[T]},prepare:la()},cacheEntriesUpserted:{reducer(P,T){for(let V of T.payload){let{queryDescription:G,value:j}=V;S(P,G,!0,{arg:G,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),b(P,{arg:G,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},j,!0)}},prepare:P=>({payload:P.map(T=>{let{endpointName:V,arg:G,value:j}=T,L=o[V];return{queryDescription:{type:Zc,endpointName:V,originalArgs:T.arg,queryCacheKey:n({queryArgs:G,endpointDefinition:L,endpointName:V})},value:j}}),meta:{[kc]:!0,requestId:Nc(),timestamp:Date.now()}})},queryResultPatched:{reducer(P,{payload:{queryCacheKey:T,patches:V}}){Vd(P,T,G=>{G.data=Hh(G.data,V.concat())})},prepare:la()}},extraReducers(P){P.addCase(t.pending,(T,{meta:V,meta:{arg:G}})=>{S(T,G,vS(G),V)}).addCase(t.fulfilled,(T,{meta:V,payload:G})=>{b(T,V,G,vS(V.arg))}).addCase(t.rejected,(T,{meta:{condition:V,arg:G,requestId:j},error:L,payload:$})=>{Vd(T,G.queryCacheKey,Q=>{if(!V){if(Q.requestId!==j)return;Q.status=hS,Q.error=$??L}})}).addMatcher(p,(T,V)=>{let{queries:G}=a(V);for(let[j,L]of Object.entries(G))(L?.status==="fulfilled"||L?.status==="rejected")&&(T[j]=L)})}}),y=Wo({name:`${e}/mutations`,initialState:jd,reducers:{removeMutationResult:{reducer(P,{payload:T}){let V=Xc(T);V in P&&delete P[V]},prepare:la()}},extraReducers(P){P.addCase(r.pending,(T,{meta:V,meta:{requestId:G,arg:j,startedTimeStamp:L}})=>{j.track&&(T[Xc(V)]={requestId:G,status:mS,endpointName:j.endpointName,startedTimeStamp:L})}).addCase(r.fulfilled,(T,{payload:V,meta:G})=>{G.arg.track&&TR(T,G,j=>{j.requestId===G.requestId&&(j.status=gS,j.data=V,j.fulfilledTimeStamp=G.fulfilledTimeStamp)})}).addCase(r.rejected,(T,{payload:V,error:G,meta:j})=>{j.arg.track&&TR(T,j,L=>{L.requestId===j.requestId&&(L.status=hS,L.error=V??G)})}).addMatcher(p,(T,V)=>{let{mutations:G}=a(V);for(let[j,L]of Object.entries(G))(L?.status==="fulfilled"||L?.status==="rejected")&&j!==L?.requestId&&(T[j]=L)})}}),x=Wo({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(P,T){var V,G,j;for(let{queryCacheKey:L,providedTags:$}of T.payload){w(P,L);for(let{type:Q,id:K}of $){let z=(G=(V=P.tags)[Q]??(V[Q]={}))[j=K??"__internal_without_id"]??(G[j]=[]);z.includes(L)||z.push(L)}P.keys[L]=$}},prepare:la()}},extraReducers(P){P.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:V}})=>{w(T,V)}).addMatcher(p,(T,V)=>{var j,L,$;let{provided:G}=a(V);for(let[Q,K]of Object.entries(G.tags??{}))for(let[z,Z]of Object.entries(K)){let Y=(L=(j=T.tags)[Q]??(j[Q]={}))[$=z??"__internal_without_id"]??(L[$]=[]);for(let J of Z)Y.includes(J)||Y.push(J),T.keys[J]=G.keys[J]}}).addMatcher(Br(Pn(t),_c(t)),(T,V)=>{E(T,[V])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,V)=>{E(T,V.payload.map(({queryDescription:G,value:j})=>({type:"UNKNOWN",payload:j,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:G}})))})}});function w(P,T){let V=FR(P.keys[T]??[]);for(let G of V){let j=G.type,L=G.id??"__internal_without_id",$=P.tags[j]?.[L];$&&(P.tags[j][L]=FR($).filter(Q=>Q!==T))}delete P.keys[T]}function E(P,T){let V=T.map(G=>{let j=zR(G,"providesTags",o,m),{queryCacheKey:L}=G.meta.arg;return{queryCacheKey:L,providedTags:j}});x.caseReducers.updateProvidedBy(P,x.actions.updateProvidedBy(V))}let k=Wo({name:`${e}/subscriptions`,initialState:jd,reducers:{updateSubscriptionOptions(P,T){},unsubscribeQueryResult(P,T){},internal_getRTKQSubscriptions(){}}}),F=Wo({name:`${e}/internalSubscriptions`,initialState:jd,reducers:{subscriptionsUpdated:{reducer(P,T){return Hh(P,T.payload)},prepare:la()}}}),_=Wo({name:`${e}/config`,initialState:{online:OM(),focused:kM(),middlewareRegistered:!1,...f},reducers:{middlewareRegistered(P,{payload:T}){P.middlewareRegistered=P.middlewareRegistered==="conflict"||i!==T?"conflict":!0}},extraReducers:P=>{P.addCase(RS,T=>{T.online=!0}).addCase(QR,T=>{T.online=!1}).addCase(xS,T=>{T.focused=!0}).addCase(UR,T=>{T.focused=!1}).addMatcher(p,T=>({...T}))}}),I=Lo({queries:h.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:F.reducer,config:_.reducer});return{reducer:(P,T)=>I(g.match(T)?void 0:P,T),actions:{..._.actions,...h.actions,...k.actions,...F.actions,...y.actions,...x.actions,resetApiState:g}}}var oi=Symbol.for("RTKQ/skipToken"),WR={status:CS},PR=$o(WR,()=>{}),kR=$o(WR,()=>{});function XM({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=F=>PR,o=F=>kR;return{buildQuerySelector:b,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:x,selectCachedArgsForQuery:w,selectApiState:a,selectQueries:p,selectMutations:f,selectQueryEntry:m,selectConfig:g};function i(F){return{...F,...CR(F.status)}}function a(F){return F[t]}function p(F){return a(F)?.queries}function m(F,_){return p(F)?.[_]}function f(F){return a(F)?.mutations}function g(F){return a(F)?.config}function S(F,_,I){return O=>{if(O===oi)return r(n,I);let P=e({queryArgs:O,endpointDefinition:_,endpointName:F});return r(V=>m(V,P)??PR,I)}}function b(F,_){return S(F,_,i)}function h(F,_){let{infiniteQueryOptions:I}=_;function O(P){let T={...P,...CR(P.status)},{isLoading:V,isError:G,direction:j}=T,L=j==="forward",$=j==="backward";return{...T,hasNextPage:E(I,T.data,T.originalArgs),hasPreviousPage:k(I,T.data,T.originalArgs),isFetchingNextPage:V&&L,isFetchingPreviousPage:V&&$,isFetchNextPageError:G&&L,isFetchPreviousPageError:G&&$}}return S(F,_,O)}function y(){return F=>{let _;return typeof F=="object"?_=Xc(F)??oi:_=F,r(_===oi?o:O=>a(O)?.mutations?.[_]??kR,i)}}function x(F,_){let I=F[t],O=new Set,P=yS(_,bS,$R);for(let T of P){let V=I.provided.tags[T.type];if(!V)continue;let G=(T.id!==void 0?V[T.id]:Object.values(V).flat())??[];for(let j of G)O.add(j)}return Array.from(O.values()).flatMap(T=>{let V=I.queries[T];return V?{queryCacheKey:T,endpointName:V.endpointName,originalArgs:V.originalArgs}:[]})}function w(F,_){return yS(Object.values(p(F)),I=>I?.endpointName===_&&I.status!=="uninitialized",I=>I.originalArgs)}function E(F,_,I){return _?Ld(F,_,I)!=null:!1}function k(F,_,I){return!_||!F.getPreviousPageParam?!1:AS(F,_,I)!=null}}var OR=WeakMap?new WeakMap:void 0,_R=({endpointName:e,queryArgs:t})=>{let r="",n=OR?.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=Qr(a)?Object.keys(a).sort().reduce((p,m)=>(p[m]=a[m],p),{}):a,a));Qr(t)&&OR?.set(t,o),r=o}return`${e}(${r})`};function ZM(...e){return function(r){let n=sa(f=>r.extractRehydrationInfo?.(f,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(f){let g=_R;if(f.endpointDefinition&&"serializeQueryArgs"in f.endpointDefinition){let S=f.endpointDefinition.serializeQueryArgs;g=b=>{let h=S(b);return typeof h=="string"?h:_R({...b,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(f)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(f){f()},apiUid:Nc(),extractRehydrationInfo:n,hasRehydrationInfo:sa(f=>n(f)!=null)},a={injectEndpoints:m,enhanceEndpoints({addTagTypes:f,endpoints:g}){if(f)for(let S of f)o.tagTypes.includes(S)||o.tagTypes.push(S);if(g)for(let[S,b]of Object.entries(g))typeof b=="function"?b(Ua(i,S)):Object.assign(Ua(i,S)||{},b);return a}},p=e.map(f=>f.init(a,o,i));function m(f){let g=f.endpoints({query:S=>({...S,type:Zc}),mutation:S=>({...S,type:BR}),infiniteQuery:S=>({...S,type:GR})});for(let[S,b]of Object.entries(g)){if(f.overrideExisting!==!0&&S in i.endpointDefinitions){if(f.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[S]=b;for(let h of p)h.injectEndpoint(S,b)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function Nn(e,...t){return Object.assign(e,...t)}var JM=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:m}=e.internalActions,f=(x,w)=>{if(p.match(w)){let{queryCacheKey:k,requestId:F,options:_}=w.payload,I=x.get(k);return I?.has(F)&&I.set(F,_),!0}if(m.match(w)){let{queryCacheKey:k,requestId:F}=w.payload,_=x.get(k);return _&&_.delete(F),!0}if(e.internalActions.removeQueryResult.match(w))return x.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:k,requestId:F}}=w,_=Ud(x,k.queryCacheKey,SS);return k.subscribe&&_.set(F,k.subscriptionOptions??_.get(F)??{}),!0}let E=!1;if(t.rejected.match(w)){let{meta:{condition:k,arg:F,requestId:_}}=w;if(k&&F.subscribe){let I=Ud(x,F.queryCacheKey,SS);I.set(_,F.subscriptionOptions??I.get(_)??{}),E=!0}}return E},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:x=>g().get(x)?.size??0,isRequestSubscribed:(x,w)=>!!g()?.get(x)?.get(w)};function y(x){return JSON.parse(JSON.stringify(Object.fromEntries([...x].map(([w,E])=>[w,Object.fromEntries(E)]))))}return(x,w)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(x))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(x))return[!1,h];let E=f(r.currentSubscriptions,x),k=!0;if(E){a||(a=setTimeout(()=>{let I=y(r.currentSubscriptions),[,O]=$h(i,()=>I);w.next(e.internalActions.subscriptionsUpdated(O)),i=I,a=null},500));let F=typeof x.type=="string"&&!!x.type.startsWith(o),_=t.rejected.match(x)&&x.meta.condition&&!!x.meta.arg.subscribe;k=!F&&!_}return[k,!1]}},eV=2147483647/1e3-1,tV=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:p,mwApi:m})=>{let{removeQueryResult:f,unsubscribeQueryResult:g,cacheEntriesUpserted:S}=t.internalActions,b=Br(g.match,r.fulfilled,r.rejected,S.match);function h(F){let _=o.currentSubscriptions.get(F);return _?_.size>0:!1}let y={};function x(F){for(let _ of F.values())_?.abort?.()}let w=(F,_)=>{let I=a(_.getState());if(b(F)){let O;if(S.match(F))O=F.payload.map(P=>P.queryDescription.queryCacheKey);else{let{queryCacheKey:P}=g.match(F)?F.payload:F.meta.arg;O=[P]}E(O,_,I)}if(t.util.resetApiState.match(F)){for(let[O,P]of Object.entries(y))P&&clearTimeout(P),delete y[O];x(o.runningQueries),x(o.runningMutations)}if(n.hasRehydrationInfo(F)){let{queries:O}=n.extractRehydrationInfo(F);E(Object.keys(O),_,I)}};function E(F,_,I){let O=_.getState();for(let P of F){let T=i(O,P);T?.endpointName&&k(P,T.endpointName,_,I)}}function k(F,_,I,O){let P=Ua(n,_)?.keepUnusedDataFor??O.keepUnusedDataFor;if(P===1/0)return;let T=Math.max(0,Math.min(P,eV));if(!h(F)){let V=y[F];V&&clearTimeout(V),y[F]=setTimeout(()=>{if(!h(F)){let G=i(I.getState(),F);G?.endpointName&&I.dispatch(p(G.endpointName,G.originalArgs))?.abort(),I.dispatch(f({queryCacheKey:F}))}delete y[F]},T*1e3)}}return w},NR=new Error("Promise never resolved before cacheEntryRemoved."),rV=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:p}})=>{let m=El(n),f=El(o),g=Pn(n,o),S={},{removeQueryResult:b,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function x(I,O,P){let T=S[I];T?.valueResolved&&(T.valueResolved({data:O,meta:P}),delete T.valueResolved)}function w(I){let O=S[I];O&&(delete S[I],O.cacheEntryRemoved())}function E(I){let{arg:O,requestId:P}=I.meta,{endpointName:T,originalArgs:V}=O;return[T,V,P]}let k=(I,O,P)=>{let T=F(I);function V(G,j,L,$){let Q=a(P,j),K=a(O.getState(),j);!Q&&K&&_(G,$,j,O,L)}if(n.pending.match(I)){let[G,j,L]=E(I);V(G,T,L,j)}else if(y.match(I))for(let{queryDescription:G,value:j}of I.payload){let{endpointName:L,originalArgs:$,queryCacheKey:Q}=G;V(L,Q,I.meta.requestId,$),x(Q,j,{})}else if(o.pending.match(I)){if(O.getState()[t].mutations[T]){let[G,j,L]=E(I);_(G,j,T,O,L)}}else if(g(I))x(T,I.payload,I.meta.baseQueryMeta);else if(b.match(I)||h.match(I))w(T);else if(e.util.resetApiState.match(I))for(let G of Object.keys(S))w(G)};function F(I){return m(I)?I.meta.arg.queryCacheKey:f(I)?I.meta.arg.fixedCacheKey??I.meta.requestId:b.match(I)?I.payload.queryCacheKey:h.match(I)?Xc(I.payload):""}function _(I,O,P,T,V){let G=Ua(r,I),j=G?.onCacheEntryAdded;if(!j)return;let L={},$=new Promise(Y=>{L.cacheEntryRemoved=Y}),Q=Promise.race([new Promise(Y=>{L.valueResolved=Y}),$.then(()=>{throw NR})]);Q.catch(()=>{}),S[P]=L;let K=e.endpoints[I].select(Qd(G)?O:P),z=T.dispatch((Y,J,Se)=>Se),Z=j(O,{...T,getCacheEntry:()=>K(T.getState()),requestId:V,extra:z,updateCachedData:Qd(G)?Y=>T.dispatch(e.util.updateQueryData(I,O,Y)):void 0,cacheDataLoaded:Q,cacheEntryRemoved:$});Promise.resolve(Z).catch(Y=>{if(Y!==NR)throw Y})}return k},nV=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},oV=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:p,internalState:m})=>{let{removeQueryResult:f}=i.internalActions,g=Br(Pn(n),_c(n)),S=Br(Pn(o,n),zo(o,n)),b=[],h=0,y=(E,k)=>{(o.pending.match(E)||n.pending.match(E))&&h++,S(E)&&!(o.rejected.match(E)&&E.meta.condition)&&(h=Math.max(0,h-1)),g(E)?w(zR(E,"invalidatesTags",r,a),k):S(E)?w([],k):i.util.invalidateTags.match(E)&&w(wS(E.payload,void 0,void 0,void 0,void 0,a),k)};function x(){return h>0}function w(E,k){let F=k.getState(),_=F[e];if(b.push(...E),_.config.invalidationBehavior==="delayed"&&x())return;let I=b;if(b=[],I.length===0)return;let O=i.util.selectInvalidatedBy(F,I);t.batch(()=>{let P=Array.from(O.values());for(let{queryCacheKey:T}of P){let V=_.queries[T],G=Ud(m.currentSubscriptions,T,SS);V&&(G.size===0?k.dispatch(f({queryCacheKey:T})):V.status!=="uninitialized"&&k.dispatch(p(V)))}})}return y},iV=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,p=new Set,m=null,f=(w,E)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,E),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,E),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&S(w.meta.arg,E),r.util.resetApiState.match(w)&&(y(),m&&(clearTimeout(m),m=null),p.clear())};function g(w,E){p.add(w),m||(m=setTimeout(()=>{for(let k of p)b({queryCacheKey:k},E);p.clear(),m=null},0))}function S({queryCacheKey:w},E){let k=E.getState()[e].queries[w],F=a.get(w);if(!k||k.status==="uninitialized")return;let{lowestPollingInterval:_,skipPollingIfUnfocused:I}=x(F);if(!Number.isFinite(_))return;let O=i.get(w);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let P=Date.now()+_;i.set(w,{nextPollTimestamp:P,pollingInterval:_,timeout:setTimeout(()=>{let T=E.getState()[e],V=T.queries[w];if(!V||V.status==="uninitialized"){h(w);return}(T.config.focused||!I)&&E.dispatch(n(V)),S({queryCacheKey:w},E)},_)})}function b({queryCacheKey:w},E){let k=E.getState()[e].queries[w],F=a.get(w);if(!k||k.status==="uninitialized")return;let{lowestPollingInterval:_}=x(F);if(!Number.isFinite(_)){h(w);return}let I=i.get(w),O=Date.now()+_;(!I||O<I.nextPollTimestamp)&&S({queryCacheKey:w},E)}function h(w){let E=i.get(w);E?.timeout&&clearTimeout(E.timeout),i.delete(w)}function y(){for(let w of i.keys())h(w)}function x(w=new Map){let E=!1,k=Number.POSITIVE_INFINITY;for(let F of w.values())F.pollingInterval&&(k=Math.min(F.pollingInterval,k),E=F.skipPollingIfUnfocused||E);return{lowestPollingInterval:k,skipPollingIfUnfocused:E}}return f},aV=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Il(r,n),i=zo(r,n),a=Pn(r,n),p={};return(f,g)=>{if(o(f)){let{requestId:S,arg:{endpointName:b,originalArgs:h}}=f.meta,y=Ua(t,b),x=y?.onQueryStarted;if(x){let w={},E=new Promise((_,I)=>{w.resolve=_,w.reject=I});E.catch(()=>{}),p[S]=w;let k=e.endpoints[b].select(Qd(y)?h:S),F=g.dispatch((_,I,O)=>O);x(h,{...g,getCacheEntry:()=>k(g.getState()),requestId:S,extra:F,updateCachedData:Qd(y)?_=>g.dispatch(e.util.updateQueryData(b,h,_)):void 0,queryFulfilled:E})}}else if(a(f)){let{requestId:S,baseQueryMeta:b}=f.meta;p[S]?.resolve({data:f.payload,meta:b}),delete p[S]}else if(i(f)){let{requestId:S,rejectedWithValue:b,baseQueryMeta:h}=f.meta;p[S]?.reject({error:f.payload??f.error,isUnhandledError:!b,meta:h}),delete p[S]}}},sV=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(m,f)=>{xS.match(m)&&p(f,"refetchOnFocus"),RS.match(m)&&p(f,"refetchOnReconnect")};function p(m,f){let g=m.getState()[e],S=g.queries,b=o.currentSubscriptions;t.batch(()=>{for(let h of b.keys()){let y=S[h],x=b.get(h);if(!x||!y)continue;let w=[...x.values()];(w.some(E=>E[f]===!0)||w.every(E=>E[f]===void 0)&&g.config[f])&&(x.size===0?m.dispatch(i({queryCacheKey:h})):y.status!=="uninitialized"&&m.dispatch(n(y)))}})}return a};function cV(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,p={invalidateTags:N(`${t}/invalidateTags`)},m=b=>b.type.startsWith(`${t}/`),f=[nV,tV,oV,iV,rV,aV];return{middleware:b=>{let h=!1,y=i(b.dispatch),x={...e,internalState:y,refetchQuery:S,isThisApiSliceAction:m,mwApi:b},w=f.map(F=>F(x)),E=JM(x),k=sV(x);return F=>_=>{if(!Sc(_))return F(_);h||(h=!0,b.dispatch(n.internalActions.middlewareRegistered(a)));let I={...b,next:F},O=b.getState(),[P,T]=E(_,I,O),V;if(P?V=F(_):V=T,b.getState()[t]&&(k(_,I,O),m(_)||o.hasRehydrationInfo(_)))for(let G of w)G(_,I,O);return V}},actions:p};function S(b){return e.api.endpoints[b.endpointName].initiate(b.originalArgs,{subscribe:!1,forceRefetch:!0})}}var DR=Symbol(),uV=({createSelector:e=lt}={})=>({name:DR,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:p,refetchOnFocus:m,refetchOnReconnect:f,invalidationBehavior:g,onSchemaFailure:S,catchSchemaFailure:b,skipSchemaValidation:h},y){qC();let x=Oe=>(typeof process<"u",Oe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:RS,onOffline:QR,onFocus:xS,onFocusLost:UR},util:{}});let w=XM({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:E,selectCachedArgsForQuery:k,buildQuerySelector:F,buildInfiniteQuerySelector:_,buildMutationSelector:I}=w;Nn(t.util,{selectInvalidatedBy:E,selectCachedArgsForQuery:k});let{queryThunk:O,infiniteQueryThunk:P,mutationThunk:T,patchQueryData:V,updateQueryData:G,upsertQueryData:j,prefetch:L,buildMatchThunkActions:$}=YM({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:x,selectors:w,onSchemaFailure:S,catchSchemaFailure:b,skipSchemaValidation:h}),{reducer:Q,actions:K}=KM({context:y,queryThunk:O,infiniteQueryThunk:P,mutationThunk:T,serializeQueryArgs:i,reducerPath:o,assertTagType:x,config:{refetchOnFocus:m,refetchOnReconnect:f,refetchOnMountOrArgChange:p,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});Nn(t.util,{patchQueryData:V,updateQueryData:G,upsertQueryData:j,prefetch:L,resetApiState:K.resetApiState,upsertQueryEntries:K.cacheEntriesUpserted}),Nn(t.internalActions,K);let z=new WeakMap,Z=Oe=>Ud(z,Oe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Y,buildInitiateInfiniteQuery:J,buildInitiateMutation:Se,getRunningMutationThunk:ke,getRunningMutationsThunk:$e,getRunningQueriesThunk:ct,getRunningQueryThunk:Ye}=WM({queryThunk:O,mutationThunk:T,infiniteQueryThunk:P,api:t,serializeQueryArgs:i,context:y,getInternalState:Z});Nn(t.util,{getRunningMutationThunk:ke,getRunningMutationsThunk:$e,getRunningQueryThunk:Ye,getRunningQueriesThunk:ct});let{middleware:rt,actions:nt}=cV({reducerPath:o,context:y,queryThunk:O,mutationThunk:T,infiniteQueryThunk:P,api:t,assertTagType:x,selectors:w,getRunningQueryThunk:Ye,getInternalState:Z});return Nn(t.util,nt),Nn(t,{reducer:Q,middleware:rt}),{name:DR,injectEndpoint(Oe,Ie){var ht;let _e=(ht=t.endpoints)[Oe]??(ht[Oe]={});Gd(Ie)&&Nn(_e,{name:Oe,select:F(Oe,Ie),initiate:Y(Oe,Ie)},$(O,Oe)),$M(Ie)&&Nn(_e,{name:Oe,select:I(),initiate:Se(Oe)},$(T,Oe)),Yc(Ie)&&Nn(_e,{name:Oe,select:_(Oe,Ie),initiate:J(Oe,Ie)},$(O,Oe))}}}}),YR=ZM(uV());d();c();l();u();d();c();l();u();var ii=e=>e.query,KR=e=>e.query?.enableQuerySyntax;var XR=lt(e=>ii(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})),$d=lt(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var ZR=lt(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})}});d();c();l();u();var IS=e=>e.context;d();c();l();u();var ES=e=>e.pipeline;d();c();l();u();var FS=e=>e.searchHub;d();c();l();u();var Qt=lt(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Sse=lt(e=>e,e=>{let t=Qt(e);return t&&e?e[t].expression:""});d();c();l();u();var JR=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var ew=e=>e.excerptLength?.length;d();c();l();u();var en=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,tw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var rw=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var nw=e=>e.sortCriteria;var ow=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:$n(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function ow(_x183){return _ref64.apply(this,arguments)}}(),iw=(e,t)=>{let r=ii(e)?.q,{aq:n,cq:o,dq:i,lq:a}=cw(e),p=IS(e),m=ti(e.configuration.analytics,t,{actionCause:lS(e)}),f=FS(e),g=ES(e),S=_y(e)??[],b=sw(e),h=Qt(e.tabSet)||"default",y=ky(e),x=ox(e),w=t.referrer||"",E=tw(e),k=nw(e),F=lV(e),_=ew(e),I=rw(e),O=JR(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:KR(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:S}},...(f?.length&&{searchHub:f}),...(g?.length&&{pipeline:g}),...(b.length&&{facets:b}),...(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:iS(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...F,...(I??{}),...(_&&{excerptLength:_}),...(O&&{dictionaryFieldContext:O}),sortCriteria:k,...(E&&{facetOptions:E}),...m,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},aw=(e,t)=>{let r=ii(e)?.q,n=sw(e),o=ti(e.configuration.analytics,t,{actionCause:lS(e)}),i=ky(e),a=Qt(e.tabSet)||"default",p=t.referrer,{aq:m,cq:f}=cw(e),g=FS(e),S=ES(e),b=IS(e),h=_y(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(S?.length&&{pipeline:S}),...(b?.contextValues&&{context:b.contextValues}),...(m&&{aq:m}),...(f&&{cq:f}),tab:a,referrer:p,...o,locale:i}},sw=e=>kd(e)?.map(t=>By(t,Qy())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),lV=e=>({actionsHistory:e.configuration.analytics.enabled?At.getInstance().getHistory():[]}),cw=e=>{let t=ZR(e),r=aS(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Hd=["searching","thinking","answering"];function zd(e){return e.toLowerCase()}var Wd=["search","generic"];function TS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var uw=["text/plain","text/markdown"];var Qa=new B({required:!0}),lw=new B,Ba=new de({required:!0}),PS={id:Qa,title:Qa,uri:Qa,permanentid:Qa,clickUri:lw},Yd=new B({required:!0,constrainTo:uw}),dw=new B({required:!0,constrainTo:Hd}),pw=e=>({...e,name:zd(e.name)}),Ga=N("generatedAnswer/setIsVisible",e=>q(e,Ba)),$a=N("generatedAnswer/setAnswerId",e=>q(e,H)),Ha=N("generatedAnswer/setAnswerGenerationMode",e=>q(e,new B({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),za=N("generatedAnswer/setIsEnabled",e=>q(e,Ba)),si=N("generatedAnswer/updateMessage",e=>q(e,{textDelta:Qa})),ci=N("generatedAnswer/updateCitations",e=>q(e,{citations:new ie({required:!0,each:new W({values:PS})})})),ui=N("generatedAnswer/updateError",e=>q(e,{message:lw,code:new oe({min:0})})),dr=N("generatedAnswer/resetAnswer"),Kd=N("generatedAnswer/like"),Xd=N("generatedAnswer/dislike"),Zd=N("generatedAnswer/feedbackModal/open"),Jc=N("generatedAnswer/expand"),Jd=N("generatedAnswer/collapse"),ep=N("generatedAnswer/setId",e=>q(e,{id:new B({required:!0})})),tp=N("generatedAnswer/feedbackModal/close"),Wa=N("generatedAnswer/sendFeedback"),tn=N("generatedAnswer/setIsLoading",e=>q(e,Ba)),ai=N("generatedAnswer/setIsStreaming",e=>q(e,Ba)),li=N("generatedAnswer/setAnswerContentFormat",e=>q(e,Yd)),rp=N("generatedAnswer/updateResponseFormat",e=>q(e,{contentFormat:new ie({each:Yd,default:["text/plain"]})})),np=N("knowledge/updateAnswerConfigurationId",e=>q(e,Qa)),op=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>q(e,nl)),eu=N("generatedAnswer/setIsAnswerGenerated",e=>q(e,Ba)),di=N("generatedAnswer/setCannotAnswer",e=>q(e,Ba)),kS=N("generatedAnswer/setAnswerApiQueryParams",e=>q(e,new W({}))),ip=N("generatedAnswer/startStep",e=>q(pw(e),{name:dw,startedAt:new oe({min:0,required:!0})})),ap=N("generatedAnswer/finishStep",e=>q(pw(e),{name:dw,finishedAt:new oe({min:0,required:!0})})),sp=N("generatedAnswer/startToolCall",e=>q(e,{toolCallName:H,startedAt:new oe({min:0,required:!0}),toolCallId:H})),cp=N("generatedAnswer/finishToolCall",e=>q(e,{finishedAt:new oe({min:0,required:!0}),toolCallId:H})),Ya=N("generatedAnswer/toolCallArgs",e=>q(e,{toolCallId:H,args:new W({options:{required:!0}}),type:new B({required:!0,constrainTo:Wd})})),fw=fe("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:p}=i(),{queryExecuted:m}=p,{setAbortControllerRef:f}=e,g=yield ow(r),S=(y,x)=>{switch(y){case"genqa.headerMessageType":{let w=JSON.parse(x);n(li(w.contentFormat));break}case"genqa.messageType":n(si(JSON.parse(x)));break;case"genqa.citationsType":n(ci(JSON.parse(x)));break;case"genqa.endOfStreamType":{let w=JSON.parse(x).answerGenerated,{answerId:E,answer:k}=i().generatedAnswer,_=m.length!==0&&!w,I=!k?.trim();n(di(_)),n(ai(!1)),n(eu(w)),n((a??sd).logGeneratedAnswerStreamEnd(w,E,w?I:void 0)),n(Fa());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(tn(!0));let b=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{b(g)&&(n(tn(!1)),y.payload&&y.payloadType&&S(y.payloadType,y.payload))},abort:y=>{b(g)&&n(ui(y))},close:()=>{b(g)&&n(ai(!1))},resetAnswer:()=>{b(g)&&n(dr())}});h?f(h):n(tn(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),up=fe("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(dr());let i=t();if(i.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(i.generatedAnswer.answerConfigurationId){let a=iw(i,n);r(kS(a)),yield r(lp(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(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var dV=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,p=n.generatedAnswer.answerConfigurationId,m={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let f=$n(n.configuration.search?.apiBaseUrl,a,i);return MR({baseUrl:`${f}/rest/organizations/${a}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=g.url,b={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{b[h]=g[h]}),b.duplex="half",b.body=yield g.text(),A(S,b)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(m,{...t,signal:null},r)}catch(f){return{error:f}}});return function dV(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),dp=YR({reducerPath:"answer",baseQuery:jR(dV,{maxRetries:3}),endpoints:()=>({})});var pV=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},fV=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},mV=(e,t)=>{delete e.error,e.citations=t.citations},gV=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},hV=(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})`)},yV=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&hV(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(pV(t,i),r(li(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(fV(t,i),r(si({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(mV(t,i),r(ci({citations:i.citations})));break;case"genqa.endOfStreamType":{gV(t,i);let a=t.answerId,p=i.answerGenerated??!1,m=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,a,m)),r(Fa());break}}},SV=(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`},pi=dp.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(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:p,generatedAnswer:m,insightConfiguration:f}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:S,environment:b,accessToken:h}=p,y=$n(p.search.apiBaseUrl,S,b),x=SV(y,S,m.answerConfigurationId,f?.insightId);yield Ju(x,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:A,onopen:function(){var _ref69=_asyncToGenerator(function*(w){let E=w.headers.get("x-answer-id");E&&o(k=>{k.answerId=E,i($a(E))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:w=>{o(E=>{yV(w,E,i,g??sd)})},onerror:w=>{throw w},onclose:()=>{o(w=>{i(di(!w.generated))})}})}).apply(this,arguments)}})})}),lp=e=>pi.endpoints.getAnswer.initiate(e),OS=e=>{let t=$d(e);return pi.endpoints.getAnswer.select(t??oi)(e)};d();c();l();u();var mw=pe(Yn,e=>e);d();c();l();u();function vV(e){let t=e.payload?.analyticsAction;return gw(e)&&!ee(t)}function gw(e){return"type"in e}var hw=e=>t=>r=>{let n;vV(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return gw(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};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var pp={q:new B,enableQuerySyntax:new de,aq:new B,cq:new B,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new B,f:new W,fExcluded:new W,cf:new W,nf:new W,mnf:new W,df:new W,debug:new de,sf:new W,tab:new B,af:new W};var at=N("searchParameters/restore",e=>q(e,pp)),fp=N("searchParameters/restoreTab",e=>q(e,H));d();c();l();u();var mp=N("tab/register",e=>{let t=new W({values:{id:H,expression:Je}});return q(e,t)}),Nt=N("tab/updateActiveTab",e=>q(e,H));d();c();l();u();var gp=Pr(Yu(),1),vw=Pr(yw(),1),Aw=Pr(Sw(),1);gp.default.extend(Aw.default);gp.default.extend(vw.default);var hp=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:gp.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"});d();c();l();u();var AV=/(^|; )Coveo-Pendragon=([^;]*)/,CV=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Cw(){return typeof window>"u"?!1:AV.exec(document.cookie)?.pop()||null}function bw(){return typeof window>"u"?!1:CV.test(document.cookie)}var yp=pe(hp(),e=>e.addCase(Ia,(t,r)=>{bV(t,r.payload)}).addCase(Ea,(t,r)=>{xV(t,r.payload)}).addCase(rd,(t,r)=>{RV(t,r.payload)}).addCase(nd,t=>{t.analytics.enabled=!1}).addCase(od,t=>{t.analytics.enabled=!0}).addCase(Px,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(kx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(Nt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(fp,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(at,(t,r)=>{ee(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Ox,(t,{payload:r})=>{wV(t,r)}));function bV(e,t){ee(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ee(t.organizationId)||(e.organizationId=t.organizationId)}function xV(e,t){ee(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ee(t.locale)||(e.search.locale=t.locale),ee(t.timezone)||(e.search.timezone=t.timezone),ee(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function RV(e,t){ee(t.enabled)||(e.analytics.enabled=t.enabled),ee(t.originContext)||(e.analytics.originContext=t.originContext),ee(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ee(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ee(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ee(t.trackingId)||(e.analytics.trackingId=t.trackingId),ee(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ee(t.source)||(e.analytics.source=t.source);try{let r=Cw();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ee(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ee(t.anonymous)||(e.analytics.anonymous=t.anonymous),ee(t.deviceId)||(e.analytics.deviceId=t.deviceId),ee(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ee(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function wV(e,t){e.knowledge.agentId=t;try{bw()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Re=yp;d();c();l();u();function IV(e){return e.instantlyCallable}var xw=()=>e=>t=>e(IV(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function Rw(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}d();c();l();u();var MS,EV=new Uint8Array(16);function VS(){if(!MS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");MS=crypto.getRandomValues.bind(crypto)}return MS(EV)}d();c();l();u();d();c();l();u();var FV=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jS={randomUUID:FV};function TV(e,t,r){if(jS.randomUUID&&!t&&!e)return jS.randomUUID();e=e||{};let n=e.random??e.rng?.()??VS();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 Rw(n)}var fo=TV;d();c();l();u();d();c();l();u();var R={};oc(R,{BRAND:()=>tj,DIRTY:()=>fi,EMPTY_PATH:()=>_V,INVALID:()=>be,NEVER:()=>jj,OK:()=>Bt,ParseStatus:()=>qt,Schema:()=>Ve,ZodAny:()=>ho,ZodArray:()=>Vn,ZodBigInt:()=>gi,ZodBoolean:()=>hi,ZodBranded:()=>ru,ZodCatch:()=>Ei,ZodDate:()=>yi,ZodDefault:()=>Ii,ZodDiscriminatedUnion:()=>Ap,ZodEffects:()=>wr,ZodEnum:()=>Ri,ZodError:()=>tr,ZodFirstPartyTypeKind:()=>we,ZodFunction:()=>bp,ZodIntersection:()=>Ci,ZodIssueCode:()=>X,ZodLazy:()=>bi,ZodLiteral:()=>xi,ZodMap:()=>ts,ZodNaN:()=>ns,ZodNativeEnum:()=>wi,ZodNever:()=>Dr,ZodNull:()=>vi,ZodNullable:()=>on,ZodNumber:()=>mi,ZodObject:()=>rr,ZodOptional:()=>xr,ZodParsedType:()=>ce,ZodPipeline:()=>nu,ZodPromise:()=>yo,ZodReadonly:()=>Fi,ZodRecord:()=>Cp,ZodSchema:()=>Ve,ZodSet:()=>rs,ZodString:()=>go,ZodSymbol:()=>Ja,ZodTransformer:()=>wr,ZodTuple:()=>nn,ZodType:()=>Ve,ZodUndefined:()=>Si,ZodUnion:()=>Ai,ZodUnknown:()=>Mn,ZodVoid:()=>es,addIssueToContext:()=>se,any:()=>lj,array:()=>mj,bigint:()=>ij,boolean:()=>Dw,coerce:()=>Vj,custom:()=>Ow,date:()=>aj,datetimeRegex:()=>Pw,defaultErrorMap:()=>Dn,discriminatedUnion:()=>Sj,effect:()=>Pj,enum:()=>Ej,function:()=>Rj,getErrorMap:()=>Ka,getParsedType:()=>rn,instanceof:()=>nj,intersection:()=>vj,isAborted:()=>Sp,isAsync:()=>Xa,isDirty:()=>vp,isValid:()=>mo,late:()=>rj,lazy:()=>wj,literal:()=>Ij,makeIssue:()=>tu,map:()=>bj,nan:()=>oj,nativeEnum:()=>Fj,never:()=>pj,null:()=>uj,nullable:()=>Oj,number:()=>Nw,object:()=>gj,objectUtil:()=>LS,oboolean:()=>Mj,onumber:()=>qj,optional:()=>kj,ostring:()=>Dj,pipeline:()=>Nj,preprocess:()=>_j,promise:()=>Tj,quotelessJson:()=>PV,record:()=>Cj,set:()=>xj,setErrorMap:()=>OV,strictObject:()=>hj,string:()=>_w,symbol:()=>sj,transformer:()=>Pj,tuple:()=>Aj,undefined:()=>cj,union:()=>yj,unknown:()=>dj,util:()=>Ue,void:()=>fj});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ue;(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(p=>typeof o[o[p]]!="number"),a={};for(let p of i)a[p]=o[p];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})(Ue||(Ue={}));var LS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(LS||(LS={}));var ce=Ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rn=e=>{switch(typeof e){case"undefined":return ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(e)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(e)?ce.array:e===null?ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ce.promise:typeof Map<"u"&&e instanceof Map?ce.map:typeof Set<"u"&&e instanceof Set?ce.set:typeof Date<"u"&&e instanceof Date?ce.date:ce.object;default:return ce.unknown}};var X=Ue.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"]),PV=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),tr=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 p=n,m=0;for(;m<a.path.length;){let f=a.path[m];m===a.path.length-1?(p[f]=p[f]||{_errors:[]},p[f]._errors.push(r(a))):p[f]=p[f]||{_errors:[]},p=p[f],m++}}};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,Ue.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()}};tr.create=e=>new tr(e);var kV=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ce.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ue.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ue.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ue.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Ue.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.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}"`:Ue.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.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 X.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 X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ue.assertNever(e)}return{message:r}},Dn=kV;var ww=Dn;function OV(e){ww=e}function Ka(){return ww}d();c();l();u();var tu=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 p="",m=n.filter(f=>!!f).slice().reverse();for(let f of m)p=f(a,{data:t,defaultError:p}).message;return{...o,path:i,message:p}},_V=[];function se(e,t){let r=Ka(),n=tu({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Dn?void 0:Dn].filter(o=>!!o)});e.common.issues.push(n)}var qt=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 be;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 be;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}}},be=Object.freeze({status:"aborted"}),fi=e=>({status:"dirty",value:e}),Bt=e=>({status:"valid",value:e}),Sp=e=>e.status==="aborted",vp=e=>e.status==="dirty",mo=e=>e.status==="valid",Xa=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));var Rr=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}},Iw=(e,t)=>{if(mo(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 tr(e.common.issues);return this._error=r,this._error}}};function Ne(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,p)=>{let{message:m}=e;return a.code==="invalid_enum_value"?{message:m??p.defaultError}:typeof p.data>"u"?{message:m??n??p.defaultError}:a.code!=="invalid_type"?{message:p.defaultError}:{message:m??r??p.defaultError}},description:o}}var Ve=class{get description(){return this._def.description}_getType(t){return rn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qt,ctx:{common:t.parent.common,data:t.data,parsedType:rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Xa(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:rn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Iw(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:rn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return mo(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=>mo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:rn(t)},o=_this32._parse({data:t,path:n.path,parent:n}),i=yield Xa(o)?o:Promise.resolve(o);return Iw(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),p=()=>i.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(m=>m?!0:(p(),!1)):a?!0:(p(),!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 wr({schema:this,typeName:we.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 xr.create(this,this._def)}nullable(){return on.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vn.create(this)}promise(){return yo.create(this,this._def)}or(t){return Ai.create([this,t],this._def)}and(t){return Ci.create(this,t,this._def)}transform(t){return new wr({...Ne(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ii({...Ne(this._def),innerType:this,defaultValue:r,typeName:we.ZodDefault})}brand(){return new ru({typeName:we.ZodBranded,type:this,...Ne(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ei({...Ne(this._def),innerType:this,catchValue:r,typeName:we.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return nu.create(this,t)}readonly(){return Fi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},NV=/^c[^\s-]{8,}$/i,DV=/^[0-9a-z]+$/,qV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MV=/^[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,VV=/^[a-z0-9_-]{21}$/i,jV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LV=/^[-+]?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)?)??$/,UV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",US,BV=/^(?:(?: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])$/,GV=/^(?:(?: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])$/,$V=/^(([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]))$/,HV=/^(([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])$/,zV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fw="((\\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])))",YV=new RegExp(`^${Fw}$`);function Tw(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 KV(e){return new RegExp(`^${Tw(e)}$`)}function Pw(e){let t=`${Fw}T${Tw(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 XV(e,t){return!!((t==="v4"||!t)&&BV.test(e)||(t==="v6"||!t)&&$V.test(e))}function ZV(e,t){if(!jV.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 JV(e,t){return!!((t==="v4"||!t)&&GV.test(e)||(t==="v6"||!t)&&HV.test(e))}var go=class e extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ce.string){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ce.string,received:i.parsedType}),be}let n=new qt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.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),se(o,{code:X.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,p=t.data.length<i.value;(a||p)&&(o=this._getOrReturnCtx(t,o),a?se(o,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):p&&se(o,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")UV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")US||(US=new RegExp(QV,"u")),US.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")MV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")VV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")NV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")DV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")qV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.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),se(o,{validation:"regex",code:X.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),se(o,{code:X.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),se(o,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Pw(i).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?YV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?KV(i).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?LV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?XV(t.data,i.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ZV(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?JV(t.data,i.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?zV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?WV.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:i.message}),n.dirty()):Ue.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...ge.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.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,...ge.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,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ge.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ge.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ge.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ge.errToObj(r)})}nonempty(t){return this.min(1,ge.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}};go.create=e=>new go({checks:[],typeName:we.ZodString,coerce:e?.coerce??!1,...Ne(e)});function ej(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 mi=class e extends Ve{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)!==ce.number){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ce.number,received:i.parsedType}),be}let n,o=new qt;for(let i of this._def.checks)i.kind==="int"?Ue.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.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),se(n,{code:X.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),se(n,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ej(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:i.message}),o.dirty()):Ue.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.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"&&Ue.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)}};mi.create=e=>new mi({checks:[],typeName:we.ZodNumber,coerce:e?.coerce||!1,...Ne(e)});var gi=class e extends Ve{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)!==ce.bigint)return this._getInvalidInput(t);let n,o=new qt;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),se(n,{code:X.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),se(n,{code:X.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),se(n,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ue.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ce.bigint,received:r.parsedType}),be}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.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:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.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}};gi.create=e=>new gi({checks:[],typeName:we.ZodBigInt,coerce:e?.coerce??!1,...Ne(e)});var hi=class extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ce.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.boolean,received:n.parsedType}),be}return Bt(t.data)}};hi.create=e=>new hi({typeName:we.ZodBoolean,coerce:e?.coerce||!1,...Ne(e)});var yi=class e extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ce.date){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_type,expected:ce.date,received:i.parsedType}),be}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return se(i,{code:X.invalid_date}),be}let n=new qt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.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),se(o,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ue.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:ge.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ge.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}};yi.create=e=>new yi({checks:[],coerce:e?.coerce||!1,typeName:we.ZodDate,...Ne(e)});var Ja=class extends Ve{_parse(t){if(this._getType(t)!==ce.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.symbol,received:n.parsedType}),be}return Bt(t.data)}};Ja.create=e=>new Ja({typeName:we.ZodSymbol,...Ne(e)});var Si=class extends Ve{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.undefined,received:n.parsedType}),be}return Bt(t.data)}};Si.create=e=>new Si({typeName:we.ZodUndefined,...Ne(e)});var vi=class extends Ve{_parse(t){if(this._getType(t)!==ce.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.null,received:n.parsedType}),be}return Bt(t.data)}};vi.create=e=>new vi({typeName:we.ZodNull,...Ne(e)});var ho=class extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Bt(t.data)}};ho.create=e=>new ho({typeName:we.ZodAny,...Ne(e)});var Mn=class extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Bt(t.data)}};Mn.create=e=>new Mn({typeName:we.ZodUnknown,...Ne(e)});var Dr=class extends Ve{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ce.never,received:r.parsedType}),be}};Dr.create=e=>new Dr({typeName:we.ZodNever,...Ne(e)});var es=class extends Ve{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.void,received:n.parsedType}),be}return Bt(t.data)}};es.create=e=>new es({typeName:we.ZodVoid,...Ne(e)});var Vn=class e extends Ve{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ce.array)return se(r,{code:X.invalid_type,expected:ce.array,received:r.parsedType}),be;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(a||p)&&(se(r,{code:a?X.too_big:X.too_small,minimum:p?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&&(se(r,{code:X.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&&(se(r,{code:X.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,p)=>o.type._parseAsync(new Rr(r,a,r.path,p)))).then(a=>qt.mergeArray(n,a));let i=[...r.data].map((a,p)=>o.type._parseSync(new Rr(r,a,r.path,p)));return qt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ge.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ge.toString(r)}})}nonempty(t){return this.min(1,t)}};Vn.create=(e,t)=>new Vn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Ne(t)});function Za(e){if(e instanceof rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=xr.create(Za(n))}return new rr({...e._def,shape:()=>t})}else return e instanceof Vn?new Vn({...e._def,type:Za(e.element)}):e instanceof xr?xr.create(Za(e.unwrap())):e instanceof on?on.create(Za(e.unwrap())):e instanceof nn?nn.create(e.items.map(t=>Za(t))):e}var rr=class e extends Ve{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=Ue.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ce.object){let f=this._getOrReturnCtx(t);return se(f,{code:X.invalid_type,expected:ce.object,received:f.parsedType}),be}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),p=[];if(!(this._def.catchall instanceof Dr&&this._def.unknownKeys==="strip"))for(let f in o.data)a.includes(f)||p.push(f);let m=[];for(let f of a){let g=i[f],S=o.data[f];m.push({key:{status:"valid",value:f},value:g._parse(new Rr(o,S,o.path,f)),alwaysSet:f in o.data})}if(this._def.catchall instanceof Dr){let f=this._def.unknownKeys;if(f==="passthrough")for(let g of p)m.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(f==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let g of p){let S=o.data[g];m.push({key:{status:"valid",value:g},value:f._parse(new Rr(o,S,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let f=[];for(let g of m){let S=yield g.key,b=yield g.value;f.push({key:S,value:b,alwaysSet:g.alwaysSet})}return f})).then(f=>qt.mergeObjectSync(n,f)):qt.mergeObjectSync(n,m)}get shape(){return this._def.shape()}strict(t){return ge.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:ge.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:we.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 Ue.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 Ue.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Za(this)}partial(t){let r={};for(let n of Ue.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 Ue.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof xr;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kw(Ue.objectKeys(this.shape))}};rr.create=(e,t)=>new rr({shape:()=>e,unknownKeys:"strip",catchall:Dr.create(),typeName:we.ZodObject,...Ne(t)});rr.strictCreate=(e,t)=>new rr({shape:()=>e,unknownKeys:"strict",catchall:Dr.create(),typeName:we.ZodObject,...Ne(t)});rr.lazycreate=(e,t)=>new rr({shape:e,unknownKeys:"strip",catchall:Dr.create(),typeName:we.ZodObject,...Ne(t)});var Ai=class extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let p of i)if(p.result.status==="valid")return p.result;for(let p of i)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let a=i.map(p=>new tr(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:a}),be}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_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(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let i,a=[];for(let m of n){let f={...r,common:{...r.common,issues:[]},parent:null},g=m._parseSync({data:r.data,path:r.path,parent:f});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:f}),f.common.issues.length&&a.push(f.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let p=a.map(m=>new tr(m));return se(r,{code:X.invalid_union,unionErrors:p}),be}}get options(){return this._def.options}};Ai.create=(e,t)=>new Ai({options:e,typeName:we.ZodUnion,...Ne(t)});var qn=e=>e instanceof bi?qn(e.schema):e instanceof wr?qn(e.innerType()):e instanceof xi?[e.value]:e instanceof Ri?e.options:e instanceof wi?Ue.objectValues(e.enum):e instanceof Ii?qn(e._def.innerType):e instanceof Si?[void 0]:e instanceof vi?[null]:e instanceof xr?[void 0,...qn(e.unwrap())]:e instanceof on?[null,...qn(e.unwrap())]:e instanceof ru||e instanceof Fi?qn(e.unwrap()):e instanceof Ei?qn(e._def.innerType):[],Ap=class e extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.object)return se(r,{code:X.invalid_type,expected:ce.object,received:r.parsedType}),be;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}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}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=qn(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 p of a){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,i)}}return new e({typeName:we.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Ne(n)})}};function QS(e,t){let r=rn(e),n=rn(t);if(e===t)return{valid:!0,data:e};if(r===ce.object&&n===ce.object){let o=Ue.objectKeys(t),i=Ue.objectKeys(e).filter(p=>o.indexOf(p)!==-1),a={...e,...t};for(let p of i){let m=QS(e[p],t[p]);if(!m.valid)return{valid:!1};a[p]=m.data}return{valid:!0,data:a}}else if(r===ce.array&&n===ce.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],p=t[i],m=QS(a,p);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return r===ce.date&&n===ce.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ci=class extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Sp(i)||Sp(a))return be;let p=QS(i.value,a.value);return p.valid?((vp(i)||vp(a))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),be)};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}))}};Ci.create=(e,t,r)=>new Ci({left:e,right:t,typeName:we.ZodIntersection,...Ne(r)});var nn=class e extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.array)return se(n,{code:X.invalid_type,expected:ce.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),be;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,p)=>{let m=this._def.items[p]||this._def.rest;return m?m._parse(new Rr(n,a,n.path,p)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>qt.mergeArray(r,a)):qt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};nn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nn({items:e,typeName:we.ZodTuple,rest:null,...Ne(t)})};var Cp=class e extends Ve{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!==ce.object)return se(n,{code:X.invalid_type,expected:ce.object,received:n.parsedType}),be;let o=[],i=this._def.keyType,a=this._def.valueType;for(let p in n.data)o.push({key:i._parse(new Rr(n,p,n.path,p)),value:a._parse(new Rr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?qt.mergeObjectAsync(r,o):qt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ve?new e({keyType:t,valueType:r,typeName:we.ZodRecord,...Ne(n)}):new e({keyType:go.create(),valueType:t,typeName:we.ZodRecord,...Ne(r)})}},ts=class extends Ve{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!==ce.map)return se(n,{code:X.invalid_type,expected:ce.map,received:n.parsedType}),be;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([p,m],f)=>({key:o._parse(new Rr(n,p,n.path,[f,"key"])),value:i._parse(new Rr(n,m,n.path,[f,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let m of a){let f=yield m.key,g=yield m.value;if(f.status==="aborted"||g.status==="aborted")return be;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let m of a){let f=m.key,g=m.value;if(f.status==="aborted"||g.status==="aborted")return be;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}}};ts.create=(e,t,r)=>new ts({valueType:t,keyType:e,typeName:we.ZodMap,...Ne(r)});var rs=class e extends Ve{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.set)return se(n,{code:X.invalid_type,expected:ce.set,received:n.parsedType}),be;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.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&&(se(n,{code:X.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(m){let f=new Set;for(let g of m){if(g.status==="aborted")return be;g.status==="dirty"&&r.dirty(),f.add(g.value)}return{status:r.value,value:f}}let p=[...n.data.values()].map((m,f)=>i._parse(new Rr(n,m,n.path,f)));return n.common.async?Promise.all(p).then(m=>a(m)):a(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};rs.create=(e,t)=>new rs({valueType:e,minSize:null,maxSize:null,typeName:we.ZodSet,...Ne(t)});var bp=class e extends Ve{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.function)return se(r,{code:X.invalid_type,expected:ce.function,received:r.parsedType}),be;function n(p,m){return tu({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ka(),Dn].filter(f=>!!f),issueData:{code:X.invalid_arguments,argumentsError:m}})}function o(p,m){return tu({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ka(),Dn].filter(f=>!!f),issueData:{code:X.invalid_return_type,returnTypeError:m}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof yo){let p=this;return Bt(/*#__PURE__*/_asyncToGenerator(function*(...m){let f=new tr([]),g=yield p._def.args.parseAsync(m,i).catch(h=>{throw f.addIssue(n(m,h)),f}),S=yield Reflect.apply(a,this,g);return yield p._def.returns._def.type.parseAsync(S,i).catch(h=>{throw f.addIssue(o(S,h)),f})}))}else{let p=this;return Bt(function(...m){let f=p._def.args.safeParse(m,i);if(!f.success)throw new tr([n(m,f.error)]);let g=Reflect.apply(a,this,f.data),S=p._def.returns.safeParse(g,i);if(!S.success)throw new tr([o(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:nn.create(t).rest(Mn.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||nn.create([]).rest(Mn.create()),returns:r||Mn.create(),typeName:we.ZodFunction,...Ne(n)})}},bi=class extends Ve{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})}};bi.create=(e,t)=>new bi({getter:e,typeName:we.ZodLazy,...Ne(t)});var xi=class extends Ve{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),be}return{status:"valid",value:t.data}}get value(){return this._def.value}};xi.create=(e,t)=>new xi({value:e,typeName:we.ZodLiteral,...Ne(t)});function kw(e,t){return new Ri({values:e,typeName:we.ZodEnum,...Ne(t)})}var Ri=class e extends Ve{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Ue.joinValues(n),received:r.parsedType,code:X.invalid_type}),be}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 se(r,{received:r.data,code:X.invalid_enum_value,options:n}),be}return Bt(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})}};Ri.create=kw;var wi=class extends Ve{_parse(t){let r=Ue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ce.string&&n.parsedType!==ce.number){let o=Ue.objectValues(r);return se(n,{expected:Ue.joinValues(o),received:n.parsedType,code:X.invalid_type}),be}if(this._cache||(this._cache=new Set(Ue.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ue.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),be}return Bt(t.data)}get enum(){return this._def.values}};wi.create=(e,t)=>new wi({values:e,typeName:we.ZodNativeEnum,...Ne(t)});var yo=class extends Ve{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ce.promise,received:r.parsedType}),be;let n=r.parsedType===ce.promise?r.data:Promise.resolve(r.data);return Bt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};yo.create=(e,t)=>new yo({type:e,typeName:we.ZodPromise,...Ne(t)});var wr=class extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{se(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 _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return be;let m=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return m.status==="aborted"?be:m.status==="dirty"?fi(m.value):r.value==="dirty"?fi(m.value):m});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return be;let p=this._def.schema._parseSync({data:a,path:n.path,parent:n});return p.status==="aborted"?be:p.status==="dirty"?fi(p.value):r.value==="dirty"?fi(p.value):p}}if(o.type==="refinement"){let a=p=>{let m=o.refinement(p,i);if(n.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),a(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?be:(p.status==="dirty"&&r.dirty(),a(p.value).then(()=>({status:r.value,value:p.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(!mo(a))return be;let p=o.transform(a.value,i);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>mo(a)?Promise.resolve(o.transform(a.value,i)).then(p=>({status:r.value,value:p})):be);Ue.assertNever(o)}};wr.create=(e,t,r)=>new wr({schema:e,typeName:we.ZodEffects,effect:t,...Ne(r)});wr.createWithPreprocess=(e,t,r)=>new wr({schema:t,effect:{type:"preprocess",transform:e},typeName:we.ZodEffects,...Ne(r)});var xr=class extends Ve{_parse(t){return this._getType(t)===ce.undefined?Bt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xr.create=(e,t)=>new xr({innerType:e,typeName:we.ZodOptional,...Ne(t)});var on=class extends Ve{_parse(t){return this._getType(t)===ce.null?Bt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};on.create=(e,t)=>new on({innerType:e,typeName:we.ZodNullable,...Ne(t)});var Ii=class extends Ve{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ii.create=(e,t)=>new Ii({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ne(t)});var Ei=class extends Ve{_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 Xa(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ei.create=(e,t)=>new Ei({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ne(t)});var ns=class extends Ve{_parse(t){if(this._getType(t)!==ce.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ce.nan,received:n.parsedType}),be}return{status:"valid",value:t.data}}};ns.create=e=>new ns({typeName:we.ZodNaN,...Ne(e)});var tj=Symbol("zod_brand"),ru=class extends Ve{_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}},nu=class e extends Ve{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?be:i.status==="dirty"?(r.dirty(),fi(i.value)):_this34._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"?be: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:we.ZodPipeline})}},Fi=class extends Ve{_parse(t){let r=this._def.innerType._parse(t),n=o=>(mo(o)&&(o.value=Object.freeze(o.value)),o);return Xa(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Fi.create=(e,t)=>new Fi({innerType:e,typeName:we.ZodReadonly,...Ne(t)});function Ew(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Ow(e,t={},r){return e?ho.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let p=Ew(t,n),m=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:m})}});if(!i){let a=Ew(t,n),p=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:p})}}):ho.create()}var rj={object:rr.lazycreate},we;(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"})(we||(we={}));var nj=(e,t={message:`Input not instance of ${e.name}`})=>Ow(r=>r instanceof e,t),_w=go.create,Nw=mi.create,oj=ns.create,ij=gi.create,Dw=hi.create,aj=yi.create,sj=Ja.create,cj=Si.create,uj=vi.create,lj=ho.create,dj=Mn.create,pj=Dr.create,fj=es.create,mj=Vn.create,gj=rr.create,hj=rr.strictCreate,yj=Ai.create,Sj=Ap.create,vj=Ci.create,Aj=nn.create,Cj=Cp.create,bj=ts.create,xj=rs.create,Rj=bp.create,wj=bi.create,Ij=xi.create,Ej=Ri.create,Fj=wi.create,Tj=yo.create,Pj=wr.create,kj=xr.create,Oj=on.create,_j=wr.createWithPreprocess,Nj=nu.create,Dj=()=>_w().optional(),qj=()=>Nw().optional(),Mj=()=>Dw().optional(),Vj={string:e=>go.create({...e,coerce:!0}),number:e=>mi.create({...e,coerce:!0}),boolean:e=>hi.create({...e,coerce:!0}),bigint:e=>gi.create({...e,coerce:!0}),date:e=>yi.create({...e,coerce:!0})};var jj=be;var Lj=R.record(R.any()),Ti=Lj.optional();function qw(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Uj=R.object({name:R.string(),arguments:R.string()}),Qj=R.object({id:R.string(),type:R.literal("function"),function:Uj,encryptedValue:R.string().optional(),metadata:Ti}),xp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ti}),Bj=R.object({type:R.literal("text"),text:R.string()}),Gj=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),$j=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),Rp=R.discriminatedUnion("type",[Gj,$j]),Hj=R.object({type:R.literal("image"),source:Rp,metadata:R.unknown().optional()}),zj=R.object({type:R.literal("audio"),source:Rp,metadata:R.unknown().optional()}),Wj=R.object({type:R.literal("video"),source:Rp,metadata:R.unknown().optional()}),Yj=R.object({type:R.literal("document"),source:Rp,metadata:R.unknown().optional()});var Mw=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),Vw=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},mpe=Mw.superRefine((e,t)=>{Vw(e,t)}),Kj=R.discriminatedUnion("type",[Bj,Hj,zj,Wj,Yj,Mw]),Xj=Kj.superRefine((e,t)=>{e.type==="binary"&&Vw(e,t)}),Zj=xp.extend({role:R.literal("developer"),content:R.string()}),Jj=xp.extend({role:R.literal("system"),content:R.string()}),eL=xp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(Qj).optional()}),tL=xp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(Xj)])}),rL=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ti}),nL=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any()),subagentRunId:R.string().optional(),metadata:Ti}),oL=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional(),subagentRunId:R.string().optional(),metadata:Ti}),jw=R.discriminatedUnion("role",[Zj,Jj,eL,tL,rL,nL,oL]),gpe=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),iL=R.object({description:R.string(),value:R.string()}),Lw=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),aL=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional(),subagentRunId:R.string().optional()}),sL=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional(),metadata:Ti}),cL=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any().transform(e=>e??void 0),messages:R.array(jw),tools:R.array(Lw),context:R.array(iL),forwardedProps:R.any(),resume:R.array(sL).optional()}),uL=R.any(),Ee=class extends Error{constructor(e){super(e)}},BS=class extends Ee{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},lL=R.object({name:R.string(),description:R.string().optional()}),dL=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),pL=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),fL=R.object({supported:R.boolean().optional(),items:R.array(Lw).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),mL=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),gL=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),hL=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(lL).optional()}),yL=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),SL=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),vL=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),AL=R.object({input:SL.optional(),output:vL.optional()}),CL=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),bL=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),hpe=R.object({identity:dL.optional(),transport:pL.optional(),tools:fL.optional(),output:mL.optional(),state:gL.optional(),multiAgent:hL.optional(),reasoning:yL.optional(),multimodal:AL.optional(),execution:CL.optional(),humanInTheLoop:bL.optional(),custom:R.record(R.unknown()).optional()}),Uw=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.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.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Qe=R.object({type:R.nativeEnum(M),timestamp:R.number().optional(),rawEvent:R.any().optional(),metadata:Ti}).passthrough(),xL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_START),messageId:R.string(),role:Uw.default("assistant"),name:R.string().optional(),subagentRunId:R.string().optional()}),Qw=Qe.extend({type:R.literal(M.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),RL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_END),messageId:R.string(),subagentRunId:R.string().optional()}),wL=Qe.extend({type:R.literal(M.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:Uw.optional(),delta:R.string().optional(),name:R.string().optional(),subagentRunId:R.string().optional()}),IL=Qe.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_START)}),EL=Qw.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:R.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),FL=Qe.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_END)}),TL=Qe.extend({type:R.literal(M.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0),subagentRunId:R.string().optional()}),PL=Qe.extend({type:R.literal(M.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),kL=Qe.extend({type:R.literal(M.TOOL_CALL_END),toolCallId:R.string(),subagentRunId:R.string().optional()}),OL=Qe.extend({messageId:R.string(),type:R.literal(M.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional(),subagentRunId:R.string().optional()}),_L=Qe.extend({type:R.literal(M.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0),delta:R.string().optional(),subagentRunId:R.string().optional()}),NL=Qe.extend({type:R.literal(M.THINKING_START),title:R.string().optional()}),DL=Qe.extend({type:R.literal(M.THINKING_END)}),qL=Qe.extend({type:R.literal(M.STATE_SNAPSHOT),snapshot:uL,subagentRunId:R.string().optional()}),ML=Qe.extend({type:R.literal(M.STATE_DELTA),delta:R.array(R.any()),subagentRunId:R.string().optional()}),VL=Qe.extend({type:R.literal(M.MESSAGES_SNAPSHOT),messages:R.array(jw)}),jL=Qe.extend({type:R.literal(M.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0),subagentRunId:R.string().optional()}),LL=Qe.extend({type:R.literal(M.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any()),subagentRunId:R.string().optional()}),UL=Qe.extend({type:R.literal(M.RAW),event:R.any(),source:R.string().optional(),subagentRunId:R.string().optional()}),QL=Qe.extend({type:R.literal(M.CUSTOM),name:R.string(),value:R.any(),subagentRunId:R.string().optional()}),BL=Qe.extend({type:R.literal(M.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:cL.optional()}),GL=R.object({type:R.literal("success")}).strict(),$L=R.object({type:R.literal("interrupt"),interrupts:R.array(aL).min(1)}).strict(),HL=R.discriminatedUnion("type",[GL,$L]),Bw=R.object({provider:R.string().optional(),model:R.string().optional(),inputTokens:R.number().int().nonnegative().optional(),outputTokens:R.number().int().nonnegative().optional(),totalTokens:R.number().int().nonnegative().optional(),reasoningTokens:R.number().int().nonnegative().optional(),cachedInputTokens:R.number().int().nonnegative().optional()}),zL=Qe.extend({type:R.literal(M.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:HL.nullable().optional().transform(e=>e??void 0),usage:R.array(Bw).optional()}),WL=Qe.extend({type:R.literal(M.RUN_ERROR),message:R.string(),code:R.string().optional(),usage:R.array(Bw).optional()}),YL=Qe.extend({type:R.literal(M.STEP_STARTED),stepName:R.string(),subagentRunId:R.string().optional()}),KL=Qe.extend({type:R.literal(M.STEP_FINISHED),stepName:R.string(),subagentRunId:R.string().optional()}),XL=R.union([R.literal("tool-call"),R.literal("message")]),ZL=Qe.extend({type:R.literal(M.REASONING_START),messageId:R.string(),subagentRunId:R.string().optional()}),JL=Qe.extend({type:R.literal(M.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning"),subagentRunId:R.string().optional()}),eU=Qe.extend({type:R.literal(M.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string(),subagentRunId:R.string().optional()}),tU=Qe.extend({type:R.literal(M.REASONING_MESSAGE_END),messageId:R.string(),subagentRunId:R.string().optional()}),rU=Qe.extend({type:R.literal(M.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional(),subagentRunId:R.string().optional()}),nU=Qe.extend({type:R.literal(M.REASONING_END),messageId:R.string(),subagentRunId:R.string().optional()}),oU=Qe.extend({type:R.literal(M.REASONING_ENCRYPTED_VALUE),subtype:XL,entityId:R.string(),encryptedValue:R.string(),subagentRunId:R.string().optional()}),iU=Qe.extend({type:R.literal(M.SUBAGENT_STARTED),subagentRunId:R.string(),name:R.string(),description:R.string().optional(),parentSubagentRunId:R.string().optional(),parentToolCallId:R.string().optional(),parentMessageId:R.string().optional()}),aU=R.object({type:R.literal("success")}).strict(),sU=R.object({type:R.literal("suspended"),interruptIds:R.array(R.string()).optional()}).strict(),cU=R.discriminatedUnion("type",[aU,sU]),uU=Qe.extend({type:R.literal(M.SUBAGENT_FINISHED),subagentRunId:R.string(),result:R.any().optional(),outcome:cU.optional()}),lU=Qe.extend({type:R.literal(M.SUBAGENT_ERROR),subagentRunId:R.string(),message:R.string(),code:R.string().optional()}),wp=R.discriminatedUnion("type",[xL,Qw,RL,wL,NL,DL,IL,EL,FL,TL,PL,kL,_L,OL,qL,ML,VL,jL,LL,UL,QL,BL,zL,WL,YL,KL,ZL,JL,eU,tU,rU,nU,oU,iU,uU,lU]);d();c();l();u();var GS={};oc(GS,{JsonPatchError:()=>dt,_areEquals:()=>au,applyOperation:()=>Pi,applyPatch:()=>Op,applyReducer:()=>gU,deepClone:()=>fU,getValueByPointer:()=>Pp,validate:()=>$w,validator:()=>kp});d();c();l();u();d();c();l();u();var dU=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)}}(),pU=Object.prototype.hasOwnProperty;function Ep(e,t){return pU.call(e,t)}function Fp(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)Ep(e,o)&&n.push(o);return n}function Mt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Tp(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 an(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ou(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ip(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ip(e[t]))return!0}else if(typeof e=="object"){for(var n=Fp(e),o=n.length,i=0;i<o;i++)if(Ip(e[n[i]]))return!0}}return!1}function Gw(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 iu=function(e){dU(t,e);function t(r,n,o,i,a){var p=this.constructor,m=e.call(this,Gw(r,{name:n,index:o,operation:i,tree:a}))||this;return m.name=n,m.index=o,m.operation=i,m.tree=a,Object.setPrototypeOf(m,p.prototype),m.message=Gw(r,{name:n,index:o,operation:i,tree:a}),m}return t}(Error);var dt=iu,fU=Mt,os={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=Pp(r,this.path);n&&(n=Mt(n));var o=Pi(r,{op:"remove",path:this.from}).removed;return Pi(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Pp(r,this.from);return Pi(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:au(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},mU={add:function(e,t,r){return Tp(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:os.move,copy:os.copy,test:os.test,_get:os._get};function Pp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Pi(e,r),r.value}function Pi(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):kp(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=Pp(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=au(e,t.value),a.test===!1)throw new dt("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 dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=Mt(e));var p=t.path||"",m=p.split("/"),f=e,g=1,S=m.length,b=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=kp;;){if(h=m[g],h&&h.indexOf("~")!=-1&&(h=ou(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&m[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&&b===void 0&&(f[h]===void 0?b=m.slice(0,g).join("/"):g==S-1&&(b=t.path),b!==void 0&&y(t,0,e,b)),g++,Array.isArray(f)){if(h==="-")h=f.length;else{if(r&&!Tp(h))throw new dt("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);Tp(h)&&(h=~~h)}if(g>=S){if(r&&t.op==="add"&&h>f.length)throw new dt("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=mU[t.op].call(t,f,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=S){var a=os[t.op].call(t,f,h,e);if(a.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(f=f[h],r&&g<S&&(!f||typeof f!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Op(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Mt(e));for(var i=new Array(t.length),a=0,p=t.length;a<p;a++)i[a]=Pi(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function gU(e,t,r){var n=Pi(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function kp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(os[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("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 dt("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 dt("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")&&Ip(e.value))throw new dt("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 dt("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 dt("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},p=$w([a],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function $w(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Op(Mt(t),Mt(e),r||!0);else{r=r||kp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function au(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(!au(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(i=p.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=i;o--!==0;)if(a=p[o],!au(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var WS={};oc(WS,{compare:()=>xU,generate:()=>$S,observe:()=>bU,unobserve:()=>CU});d();c();l();u();var HS=new WeakMap,hU=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),yU=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function SU(e){return HS.get(e)}function vU(e,t){return e.observers.get(t)}function AU(e,t){e.observers.delete(t.callback)}function CU(e,t){t.unobserve()}function bU(e,t){var r=[],n,o=SU(e);if(!o)o=new hU(e),HS.set(e,o);else{var i=vU(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var a=function(){$S(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){$S(n),clearTimeout(n.next),AU(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new yU(t,n)),n}function $S(e,t){t===void 0&&(t=!1);var r=HS.get(e.object);zS(r.value,e.object,e.patches,"",t),e.patches.length&&Op(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function zS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Fp(t),a=Fp(e),p=!1,m=!1,f=a.length-1;f>=0;f--){var g=a[f],S=e[g];if(Ep(t,g)&&!(t[g]===void 0&&S!==void 0&&Array.isArray(t)===!1)){var b=t[g];typeof S=="object"&&S!=null&&typeof b=="object"&&b!=null&&Array.isArray(S)===Array.isArray(b)?zS(S,b,r,n+"/"+an(g),o):S!==b&&(p=!0,o&&r.push({op:"test",path:n+"/"+an(g),value:Mt(S)}),r.push({op:"replace",path:n+"/"+an(g),value:Mt(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+an(g),value:Mt(S)}),r.push({op:"remove",path:n+"/"+an(g)}),m=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!m&&i.length==a.length))for(var f=0;f<i.length;f++){var g=i[f];!Ep(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+an(g),value:Mt(t[g])})}}}function xU(e,t,r){r===void 0&&(r=!1);var n=[];return zS(e,t,n,"",r),n}var _p=Object.assign({},GS,WS,{JsonPatchError:iu,deepClone:Mt,escapePathComponent:an,unescapePathComponent:ou});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var YS=function(e,t){return YS=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])},YS(e,t)};function sn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");YS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Hw(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 p(g){try{f(n.next(g))}catch(S){a(S)}}function m(g){try{f(n.throw(g))}catch(S){a(S)}}function f(g){g.done?i(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})}function Np(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=p(0),a.throw=p(1),a.return=p(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function p(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(r=0)),r;)try{if(n=1,o&&(i=f[0]&2?o.return:f[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,f[1])).done)return i;switch(o=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function jn(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 is(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(p){a={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function as(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 ki(e){return this instanceof ki?(this.v=e,this):new ki(e)}function zw(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),p("next"),p("throw"),p("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,S)}}function p(h,y){n[h]&&(o[h]=function(x){return new Promise(function(w,E){i.push([h,x,w,E])>1||m(h,x)})},y&&(o[h]=y(o[h])))}function m(h,y){try{f(n[h](y))}catch(x){b(i[0][3],x)}}function f(h){h.value instanceof ki?Promise.resolve(h.value.v).then(g,S):b(i[0][2],h)}function g(h){m("next",h)}function S(h){m("throw",h)}function b(h,y){h(y),i.shift(),i.length&&m(i[0][0],i[0][1])}}function Ww(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 jn=="function"?jn(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(p,m){a=e[i](a),o(p,m,a.done,a.value)})}}function o(i,a,p,m){Promise.resolve(m).then(function(f){i({value:f,done:p})},a)}}d();c();l();u();function Le(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function ss(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 Dp=ss(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}});d();c();l();u();function lu(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var cs=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,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var p=Ln(i),m=p.next();!m.done;m=p.next()){var f=m.value;f.remove(this)}}catch(x){t={error:x}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(Le(g))try{g()}catch(x){a=x instanceof Vp?x.errors:[x]}var S=this._finalizers;if(S){this._finalizers=null;try{for(var C=Ln(S),h=C.next();!h.done;h=C.next()){var y=h.value;try{zw(y)}catch(x){a=a??[],x instanceof Vp?a=is(is([],as(a)),as(x.errors)):a.push(x)}}}catch(x){n={error:x}}finally{try{h&&!h.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(a)throw new Vp(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)zw(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)&&lu(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&lu(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var YS=cs.EMPTY;function jp(e){return e instanceof cs||e&&"closed"in e&&Le(e.remove)&&Le(e.add)&&Le(e.unsubscribe)}function zw(e){Le(e)?e():e.unsubscribe()}d();c();l();u();var qr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var us={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=us.delegate;return o?.setTimeout?o.setTimeout.apply(o,is([e,t],as(r))):setTimeout.apply(void 0,is([e,t],as(r)))},clearTimeout:function(e){var t=us.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Lp(e){us.setTimeout(function(){var t=qr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function du(){}d();c();l();u();var Ww=function(){return KS("C",void 0,void 0)}();function Yw(e){return KS("E",void 0,e)}function Kw(e){return KS("N",e,void 0)}function KS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var Oa=null;function ls(e){if(qr.useDeprecatedSynchronousErrorHandling){var t=!Oa;if(t&&(Oa={errorThrown:!1,error:null}),e(),t){var r=Oa,n=r.errorThrown,o=r.error;if(Oa=null,n)throw o}}else e()}function Xw(e){qr.useDeprecatedSynchronousErrorHandling&&Oa&&(Oa.errorThrown=!0,Oa.error=e)}var pu=function(e){cn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,jp(r)&&r.add(n)):n.destination=IU,n}return t.create=function(r,n,o){return new Qp(r,n,o)},t.prototype.next=function(r){this.isStopped?ZS(Kw(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ZS(Yw(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ZS(Ww,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}(cs);var xU=Function.prototype.bind;function XS(e,t){return xU.call(e,t)}var RU=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){Up(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Up(n)}else Up(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Up(r)}},e}(),Qp=function(e){cn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(Le(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&qr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&XS(r.next,p),error:r.error&&XS(r.error,p),complete:r.complete&&XS(r.complete,p)}):i=r}return a.destination=new RU(i),a}return t}(pu);function Up(e){qr.useDeprecatedSynchronousErrorHandling?Xw(e):Lp(e)}function wU(e){throw e}function ZS(e,t){var r=qr.onStoppedNotification;r&&us.setTimeout(function(){return r(e,t)})}var IU={closed:!0,next:du,error:wU,complete:du};d();c();l();u();var ds=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function ps(e){return e}function Bp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return JS(e)}function JS(e){return e.length===0?ps:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var ct=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,a=FU(t)?t:new Qp(t,r,n);return ls(function(){var i=o,p=i.operator,m=i.source;a.add(p?p.call(a,m):m?o._subscribe(a):o._trySubscribe(a))}),a},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=Zw(r),new r(function(o,a){var i=new Qp({next:function(p){try{t(p)}catch(m){a(m),i.unsubscribe()}},error:a,complete:o});n.subscribe(i)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[ds]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return JS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Zw(t),new t(function(n,o){var a;r.subscribe(function(i){return a=i},function(i){return o(i)},function(){return n(a)})})},e.create=function(t){return new e(t)},e}();function Zw(e){var t;return(t=e??qr.Promise)!==null&&t!==void 0?t:Promise}function EU(e){return e&&Le(e.next)&&Le(e.error)&&Le(e.complete)}function FU(e){return e&&e instanceof pu||EU(e)&&jp(e)}d();c();l();u();function TU(e){return Le(e?.lift)}function pt(e){return function(t){if(TU(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")}}d();c();l();u();function St(e,t,r,n,o){return new PU(e,t,r,n,o)}var PU=function(e){cn(t,e);function t(r,n,o,a,i,p){var m=e.call(this,r)||this;return m.onFinalize=i,m.shouldUnsubscribe=p,m._next=n?function(f){try{n(f)}catch(g){r.error(g)}}:e.prototype._next,m._error=a?function(f){try{a(f)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,m._complete=o?function(){try{o()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,m}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}(pu);d();c();l();u();d();c();l();u();var Jw=ss(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var un=function(e){cn(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 eI(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Jw},t.prototype.next=function(r){var n=this;ls(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=Ln(n.currentObservers),p=i.next();!p.done;p=i.next()){var m=p.value;m.next(r)}}catch(f){o={error:f}}finally{try{p&&!p.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;ls(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;ls(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,a=o.hasError,i=o.isStopped,p=o.observers;return a||i?YS:(this.currentObservers=null,p.push(r),new cs(function(){n.currentObservers=null,lu(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,a=n.thrownError,i=n.isStopped;o?r.error(a):i&&r.complete()},t.prototype.asObservable=function(){var r=new ct;return r.source=this,r},t.create=function(r,n){return new eI(r,n)},t}(ct);var eI=function(e){cn(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:YS},t}(un);d();c();l();u();d();c();l();u();var ev={now:function(){return(ev.delegate||Date).now()},delegate:void 0};var Gp=function(e){cn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=ev);var a=e.call(this)||this;return a._bufferSize=r,a._windowTime=n,a._timestampProvider=o,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,r),a._windowTime=Math.max(1,n),a}return t.prototype.next=function(r){var n=this,o=n.isStopped,a=n._buffer,i=n._infiniteTimeWindow,p=n._timestampProvider,m=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+m)),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,a=o._infiniteTimeWindow,i=o._buffer,p=i.slice(),m=0;m<p.length&&!r.closed;m+=a?1:2)r.next(p[m]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,a=r._buffer,i=r._infiniteTimeWindow,p=(i?1:2)*n;if(n<1/0&&p<a.length&&a.splice(0,a.length-p),!i){for(var m=o.now(),f=0,g=1;g<a.length&&a[g]<=m;g+=2)f=g;f&&a.splice(0,f+1)}},t}(un);d();c();l();u();var $p=new ct(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function tI(e){return e&&Le(e.schedule)}function kU(e){return e[e.length-1]}function rI(e){return tI(kU(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Hp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function zp(e){return Le(e?.then)}d();c();l();u();function Wp(e){return Le(e[ds])}d();c();l();u();function Yp(e){return Symbol.asyncIterator&&Le(e?.[Symbol.asyncIterator])}d();c();l();u();function Kp(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.")}d();c();l();u();d();c();l();u();function OU(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xp=OU();function Zp(e){return Le(e?.[Xp])}d();c();l();u();function Jp(e){return $w(this,arguments,function(){var r,n,o,a;return Mp(this,function(i){switch(i.label){case 0:r=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,ka(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ka(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ka(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ef(e){return Le(e?.getReader)}function It(e){if(e instanceof ct)return e;if(e!=null){if(Wp(e))return _U(e);if(Hp(e))return NU(e);if(zp(e))return DU(e);if(Yp(e))return nI(e);if(Zp(e))return qU(e);if(ef(e))return MU(e)}throw Kp(e)}function _U(e){return new ct(function(t){var r=e[ds]();if(Le(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function NU(e){return new ct(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function DU(e){return new ct(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Lp)})}function qU(e){return new ct(function(t){var r,n;try{for(var o=Ln(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(p){r={error:p}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function nI(e){return new ct(function(t){VU(e,t).catch(function(r){return t.error(r)})})}function MU(e){return nI(Jp(e))}function VU(e,t){var r,n,o,a;return Gw(this,void 0,void 0,function(){var i,p;return Mp(this,function(m){switch(m.label){case 0:m.trys.push([0,5,6,11]),r=Hw(e),m.label=1;case 1:return[4,r.next()];case 2:if(n=m.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];m.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=m.sent(),o={error:p},[3,11];case 6:return m.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:m.sent(),m.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]}})})}d();c();l();u();d();c();l();u();function wr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var a=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!o)return a}function tf(e,t){return t===void 0&&(t=0),pt(function(r,n){r.subscribe(St(n,function(o){return wr(n,e,function(){return n.next(o)},t)},function(){return wr(n,e,function(){return n.complete()},t)},function(o){return wr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function rf(e,t){return t===void 0&&(t=0),pt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function oI(e,t){return It(e).pipe(rf(t),tf(t))}d();c();l();u();function aI(e,t){return It(e).pipe(rf(t),tf(t))}d();c();l();u();function iI(e,t){return new ct(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function sI(e,t){return new ct(function(r){var n;return wr(r,t,function(){n=e[Xp](),wr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(p){r.error(p);return}i?r.complete():r.next(a)},0,!0)}),function(){return Le(n?.return)&&n.return()}})}d();c();l();u();function nf(e,t){if(!e)throw new Error("Iterable cannot be null");return new ct(function(r){wr(r,t,function(){var n=e[Symbol.asyncIterator]();wr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function cI(e,t){return nf(Jp(e),t)}function uI(e,t){if(e!=null){if(Wp(e))return oI(e,t);if(Hp(e))return iI(e,t);if(zp(e))return aI(e,t);if(Yp(e))return nf(e,t);if(Zp(e))return sI(e,t);if(ef(e))return cI(e,t)}throw Kp(e)}function _a(e,t){return t?uI(e,t):It(e)}function He(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=rI(e);return _a(e,r)}d();c();l();u();function be(e,t){var r=Le(e)?e:function(){return e},n=function(o){return o.error(r())};return new ct(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var lI=ss(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function of(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(p){i=p,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new lI)}})})}d();c();l();u();function vo(e,t){return pt(function(r,n){var o=0;r.subscribe(St(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function dI(e,t,r,n,o,a,i,p){var m=[],f=0,g=0,S=!1,C=function(){S&&!m.length&&!f&&t.complete()},h=function(x){return f<n?y(x):m.push(x)},y=function(x){a&&t.next(x),f++;var w=!1;It(r(x,g++)).subscribe(St(t,function(E){o?.(E),a?h(E):t.next(E)},function(){w=!0},void 0,function(){if(w)try{f--;for(var E=function(){var T=m.shift();i?wr(t,i,function(){return y(T)}):y(T)};m.length&&f<n;)E();C()}catch(T){t.error(T)}}))};return e.subscribe(St(t,h,function(){S=!0,C()})),function(){p?.()}}function nr(e,t,r){return r===void 0&&(r=1/0),Le(t)?nr(function(n,o){return vo(function(a,i){return t(n,a,o,i)})(It(e(n,o)))},r):(typeof t=="number"&&(r=t),pt(function(n,o){return dI(n,o,e,r)}))}function tv(e){return e===void 0&&(e=1/0),nr(ps,e)}d();c();l();u();function af(e){return new ct(function(t){It(e()).subscribe(t)})}d();c();l();u();function rv(e,t){return pt(function(r,n){var o=0;r.subscribe(St(n,function(a){return e.call(t,a,o++)&&n.next(a)}))})}d();c();l();u();function fu(e){return pt(function(t,r){var n=null,o=!1,a;n=t.subscribe(St(r,void 0,void 0,function(i){a=It(e(i,fu(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}d();c();l();u();function sf(e,t){return Le(t)?nr(e,t,1):nr(e,1)}d();c();l();u();function nv(e){return pt(function(t,r){var n=!1;t.subscribe(St(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Na(e){return pt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function ov(e,t){return pt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(St(n,function(m){o?.unsubscribe();var f=0,g=a++;It(e(m,g)).subscribe(o=St(n,function(S){return n.next(t?t(m,S,g,f++):S)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function cf(e){return pt(function(t,r){It(e).subscribe(St(r,function(){return r.complete()},du)),!r.closed&&t.subscribe(r)})}d();c();l();u();function uf(e,t,r){var n=Le(e)||t||r?{next:e,error:t,complete:r}:e;return n?pt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(St(a,function(m){var f;(f=n.next)===null||f===void 0||f.call(n,m),a.next(m)},function(){var m;p=!1,(m=n.complete)===null||m===void 0||m.call(n),a.complete()},function(m){var f;p=!1,(f=n.error)===null||f===void 0||f.call(n,m),a.error(m)},function(){var m,f;p&&((m=n.unsubscribe)===null||m===void 0||m.call(n)),(f=n.finalize)===null||f===void 0||f.call(n)}))}):ps}d();c();l();u();d();c();l();u();function pI(e){return` \r
36
- `.indexOf(e)>=0}function lf(e){for(var t=["topLevel"],r=0,n,o,a,i=function(T){return t.push(T)},p=function(T){return t[t.length-1]=T},m=function(T){n==null&&(n=r,o=t.length,a=T)},f=function(T){T===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},S=function(){return r--},C=function(T){if("0"<=T&&T<="9"){i("number");return}switch(T){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":C(y);break;case"string":switch(y){case"\"":g();break;case"\\":m("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":y==="u"?i("stringUnicode"):(f("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(f("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(S(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(S(),g());break;case"arrayNeedsValue":y==="]"?g():pI(y)||(f("collectionItem"),p("arrayNeedsComma"),C(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(m("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(m("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":pI(y)||(f("collectionItem"),p("objectNeedsComma"),C(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(m("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(T){return x.push(T.slice(e.length-e.lastIndexOf(T[0])))},E=t.length-1;E>=0;E--)switch(t[E]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function mI(){let e=this.buf,t=this.pos,r=0,n=0;for(let a=0;a<28;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var df=4294967296;function av(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let m=Number(e.slice(i,p));o*=r,n=n*r+m,n>=df&&(o=o+(n/df|0),n=n%df)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?hI(n,o):sv(n,o)}function gI(e,t){let r=sv(e,t),n=r.hi&2147483648;n&&(r=hI(r.lo,r.hi));let o=iv(r.lo,r.hi);return n?"-"+o:o}function iv(e,t){if({lo:e,hi:t}=jU(e,t),t<=2097151)return String(df*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,m=1e7;return a>=m&&(i+=Math.floor(a/m),a%=m),i>=m&&(p+=Math.floor(i/m),i%=m),p.toString()+fI(i)+fI(a)}function jU(e,t){return{lo:e>>>0,hi:t>>>0}}function sv(e,t){return{lo:e|0,hi:t|0}}function hI(e,t){return t=~t,e?e=~e+1:t+=1,sv(e,t)}var fI=e=>{let t=String(e);return"0000000".slice(t.length)+t};function yI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var Mr=LU();function LU(){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"&&(!!v.Deno||!!v.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),SI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),vI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),SI(r),av(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),vI(r),av(r)},dec(r,n){return gI(r,n)},uDec(r,n){return iv(r,n)}}}function SI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function vI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var cv;function UU(e){var t;cv=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:lv(e.encodeUtf8.bind(e))})}function uv(){if(!cv){let e=v;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(i)):r.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),UU(o)}return cv}function lv(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Ao;(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"})(Ao||(Ao={}));var QU=4294967295,BU=2147483647,GU=-2147483648,Te=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?lv(t):uv().encodeUtf8Into,this.buffer=bI,this.viewCache=HU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||$U;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(mu),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-mu,n=dv(r);return n>mu&&(this.ensureCapacity(n-mu),this.buffer.copyWithin(t+n,t+mu,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(AI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(pv(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=CI){this.ensureCapacity(r+1);let m=this.buffer,f=this.pos;m[f++]=r;let g=0;for(;g<r;g++){let S=t.charCodeAt(g);if(S>127)break;m[f++]=S}if(g==r)return this.pos=f,this}this.ensureCapacity(r*3+5);let n=dv(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=dv(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return zU(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return AI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return pv(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return pv(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Mr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Mr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Mr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Mr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,a)}uint64(t){let r=Mr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let m=t>>>p,f=!(!(m>>>7)&&r==0);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}let a=t>>>28&15|(r&7)<<4,i=r>>3!=0;if(n[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let p=3;p<31;p=p+7){let m=r>>>p,f=!!(m>>>7);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},$U=128,mu=1,bI=new Uint8Array(0),HU=new DataView(bI.buffer),CI=32;function dv(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var te=class{constructor(t,r=uv().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=mI,this.uint32=yI,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,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case Ao.Varint:for(;this.buf[this.pos++]&128;);break;case Ao.Bit64:this.pos+=4;case Ao.Bit32:this.pos+=4;break;case Ao.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Ao.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===Ao.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Mr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Mr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Mr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Mr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Mr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=CI){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function pv(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>BU||e<GU)throw new Error("invalid int32: "+e)}function AI(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>QU||e<0)throw new Error("invalid uint32: "+e)}function zU(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var WU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function fv(){return{fields:{}}}var Vt={encode(e,t=new Te){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&hv.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=fv();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=hv.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vt.fromPartial(e??{})},fromPartial(e){let t=fv();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=fv();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 xI(){return{key:"",value:void 0}}var hv={encode(e,t=new Te){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hv.fromPartial(e??{})},fromPartial(e){let t=xI();return t.key=e.key??"",t.value=e.value??void 0,t}};function mv(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ye={encode(e,t=new Te){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&&Vt.encode(Vt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&gu.encode(gu.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=mv();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=gu.unwrap(gu.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=mv();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=mv();if(e===null)t.nullValue=WU.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(v.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new v.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 gv(){return{values:[]}}var gu={encode(e,t=new Te){for(let r of e.values)ye.encode(ye.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=gv();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(ye.unwrap(ye.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=gv();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=gv();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&v.Array.isArray(e.values)?e.values:e}},YU=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 RI(){return{op:0,path:"",from:void 0,value:void 0}}var ff={encode(e,t=new Te){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&&ye.encode(ye.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=RI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function wI(){return{id:"",type:"",function:void 0,metadata:void 0}}var mf={encode(e,t=new Te){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&gf.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=gf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=wI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?gf.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function II(){return{name:"",arguments:""}}var gf={encode(e,t=new Te){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=II();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function EI(){return{value:"",mimeType:""}}var hf={encode(e,t=new Te){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function FI(){return{value:"",mimeType:void 0}}var yf={encode(e,t=new Te){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function TI(){return{data:void 0,url:void 0}}var pr={encode(e,t=new Te){return e.data!==void 0&&hf.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&yf.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=hf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=yf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=TI();return t.data=e.data!==void 0&&e.data!==null?hf.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?yf.fromPartial(e.url):void 0,t}};function PI(){return{text:""}}var Sf={encode(e,t=new Te){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=PI();return t.text=e.text??"",t}};function kI(){return{source:void 0,metadata:void 0}}var vf={encode(e,t=new Te){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function OI(){return{source:void 0,metadata:void 0}}var Af={encode(e,t=new Te){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=OI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function _I(){return{source:void 0,metadata:void 0}}var bf={encode(e,t=new Te){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function NI(){return{source:void 0,metadata:void 0}}var Cf={encode(e,t=new Te){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function DI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var xf={encode(e,t=new Te){return e.text!==void 0&&Sf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&vf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Af.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&bf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Cf.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=Sf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=vf.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Af.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=bf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Cf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=DI();return t.text=e.text!==void 0&&e.text!==null?Sf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?vf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Af.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?bf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Cf.fromPartial(e.document):void 0,t}};function qI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Rf={encode(e,t=new Te){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)mf.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)xf.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=qI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(mf.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(xf.decode(r,r.uint32()));continue;case 9:if(a!==74)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 10:if(a!==82)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=qI();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=>mf.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>xf.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function MI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var wf={encode(e,t=new Te){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ye.encode(ye.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=MI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.reason=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.toolCallId=r.string();continue;case 5:if(a!==42)break;o.responseSchema=ye.unwrap(ye.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue;case 8:if(a!==66)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=MI();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},KU=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function VI(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ge={encode(e,t=new Te){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ye.encode(ye.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=fs(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=VI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function jI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var If={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=jI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function LI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Ef={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=LI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function UI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Ff={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=UI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function QI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Tf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=QI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function BI(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Pf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=BI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function GI(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var kf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=GI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function $I(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Of={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ye.encode(ye.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Of.fromPartial(e??{})},fromPartial(e){let t=$I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function HI(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var _f={encode(e,t=new Te){e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)ff.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=HI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(ff.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _f.fromPartial(e??{})},fromPartial(e){let t=HI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>ff.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function zI(){return{baseEvent:void 0,messages:[]}}var Nf={encode(e,t=new Te){e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Rf.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=zI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(Rf.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Nf.fromPartial(e??{})},fromPartial(e){let t=zI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Rf.fromPartial(r))||[],t}};function WI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Df={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ye.encode(ye.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=WI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Df.fromPartial(e??{})},fromPartial(e){let t=WI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function YI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var qf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=YI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return qf.fromPartial(e??{})},fromPartial(e){let t=YI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function KI(){return{baseEvent:void 0,threadId:"",runId:""}}var Mf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=KI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Mf.fromPartial(e??{})},fromPartial(e){let t=KI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function XI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Da={encode(e,t=new Te){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=XI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=fs(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=fs(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=fs(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=fs(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=fs(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Da.fromPartial(e??{})},fromPartial(e){let t=XI();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function ZI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Vf={encode(e,t=new Te){e.baseEvent!==void 0&&ge.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&&ye.encode(ye.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)wf.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Da.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=ZI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=ye.unwrap(ye.decode(r,r.uint32()));continue;case 5:if(a!==42)break;o.outcome=r.string();continue;case 6:if(a!==50)break;o.interrupts.push(wf.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(Da.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vf.fromPartial(e??{})},fromPartial(e){let t=ZI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>wf.fromPartial(r))||[],t.usage=e.usage?.map(r=>Da.fromPartial(r))||[],t}};function JI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var jf={encode(e,t=new Te){e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)Da.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=JI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.usage.push(Da.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return jf.fromPartial(e??{})},fromPartial(e){let t=JI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Da.fromPartial(r))||[],t}};function eE(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Lf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=eE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Lf.fromPartial(e??{})},fromPartial(e){let t=eE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function tE(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Uf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=tE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Uf.fromPartial(e??{})},fromPartial(e){let t=tE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function rE(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Qf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=rE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qf.fromPartial(e??{})},fromPartial(e){let t=rE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function nE(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Bf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=nE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bf.fromPartial(e??{})},fromPartial(e){let t=nE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function oE(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Gf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=oE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.name=r.string();continue;case 4:if(a!==34)break;o.description=r.string();continue;case 5:if(a!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(a!==50)break;o.parentToolCallId=r.string();continue;case 7:if(a!==58)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gf.fromPartial(e??{})},fromPartial(e){let t=oE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function aE(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var $f={encode(e,t=new Te){e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ye.encode(ye.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=aE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.result=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.outcome=r.string();continue;case 5:if(a!==42)break;o.interruptIds.push(r.string());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $f.fromPartial(e??{})},fromPartial(e){let t=aE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function iE(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Hf={encode(e,t=new Te){return e.baseEvent!==void 0&&ge.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=iE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ge.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.code=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hf.fromPartial(e??{})},fromPartial(e){let t=iE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ge.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function sE(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var cE={encode(e,t=new Te){return e.textMessageStart!==void 0&&If.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Ef.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Ff.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Tf.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Pf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&kf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Of.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&_f.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Nf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Df.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&qf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Mf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Vf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&jf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Lf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Uf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Qf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Bf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Gf.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&$f.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Hf.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=sE();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=If.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Ef.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Ff.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Tf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=Pf.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=kf.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Of.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=_f.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Nf.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Df.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=qf.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=Mf.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=Vf.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=jf.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Lf.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=Uf.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Qf.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=Bf.decode(r,r.uint32());continue;case 19:if(a!==154)break;o.subagentStarted=Gf.decode(r,r.uint32());continue;case 20:if(a!==162)break;o.subagentFinished=$f.decode(r,r.uint32());continue;case 21:if(a!==170)break;o.subagentError=Hf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cE.fromPartial(e??{})},fromPartial(e){let t=sE();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?If.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Ef.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Ff.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Tf.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Pf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?kf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Of.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?_f.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Nf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Df.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?qf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Mf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Vf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?jf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Lf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Uf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Qf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Bf.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Gf.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?$f.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Hf.fromPartial(e.subagentError):void 0,t}};function fs(e){let t=v.Number(e.toString());if(t>v.Number.MAX_SAFE_INTEGER)throw new v.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<v.Number.MIN_SAFE_INTEGER)throw new v.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var uE=e=>e&&typeof e=="object"?e:void 0;var pf=e=>{let t=uE(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},XU=e=>{let t=uE(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:pf(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:pf(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:pf(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:pf(r.source),metadata:r.metadata}}}};function lE(e){let t=cE.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=KU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===M.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>XU(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===M.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:a}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===M.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(a.length>0&&{interruptIds:a})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=YU[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]}),Fp.parse(r)}var yv="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var JU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Sv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(JU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},dE=e=>e==="*"||e==="x"||e==="X",pE=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},eQ=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],tQ=(e,t)=>{if(dE(e)||dE(t))return 0;let[r,n]=eQ(pE(e),pE(t));return r>n?1:r<n?-1:0},vv=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=tQ(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ms=(e,t)=>{let r=Sv(e),n=Sv(t),o=r.pop(),a=n.pop(),i=vv(r,n);return i!==0?i:o&&a?vv(o.split("."),a.split(".")):o||a?o?-1:1:0};var Be=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function hu(){return mo()}function Cv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Cv(t);return e}var fE=512*1024;function mE(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let p=0;p<i.length;p++)o.push(i[p]);else{let p=Object.keys(i);for(let m=0;m<p.length;m++){let f=p[m];if(n+=f.length,n>r)return!0;o.push(i[f])}}}}return!1}function ze(_x197,_x198,_x199,_x200){return _ze.apply(this,arguments)}function _ze(){_ze=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=i&&!mE(t,r,fE),m=p?Be(t):t,f=p?Be(r):r,g=!1,S=!1,C;for(let h of e)try{p&&(Cv(m),Cv(f));let y=yield n(h,m,f);if(y===void 0)continue;let x=!1;if(y.messages!==void 0&&y.messages!==m&&(m=Be(y.messages),g=!0,x=!0),y.state!==void 0&&y.state!==f&&(f=Be(y.state),S=!0,x=!0),p&&x&&mE(m,f,fE)&&(p=!1),C=y.stopPropagation,C===!0)break}catch(y){if(i&&y instanceof TypeError){if(a)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else a||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(m)?Be(m):m}:{}),...(S?{state:Object.isFrozen(f)?Be(f):f}:{}),...(C===void 0?{}:{stopPropagation:C})}});return _ze.apply(this,arguments)}function zf(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 yu(e){if(e instanceof xv)return e;if(e===!0)return new xv(zf(!0))}var xv=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 Av(e){return e.enabled?new xv(e):void 0}function rQ(e,t,r){if(t){let o=e.find(i=>i.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 a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}function fr(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Nw(e.metadata,Be(t.metadata)),!0)}var RE=(e,t,r,n,o)=>{let a=yu(o),i=Be(r.messages),p=Be(e.state),m={},f=S=>{S.messages!==void 0&&(i=S.messages,m.messages=S.messages),S.state!==void 0&&(p=S.state,m.state=S.state)},g=()=>{let S=Be(m);return m={},S.messages!==void 0||S.state!==void 0?He(S):$p};return t.pipe(sf(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(S){let C=yield ze(n,i,p,(h,y,x)=>h.onEvent?.({event:S,agent:r,input:e,messages:y,state:x}));if(f(C),C.stopPropagation===!0?a?.event("APPLY","Event dropped:",S,{type:S.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",S,{type:S.type,subscribers:n.length}),C.stopPropagation===!0)return g();switch(S.type){case M.TEXT_MESSAGE_START:{let h=yield ze(n,i,p,(y,x,w)=>y.onTextMessageStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,role:x="assistant",name:w,subagentRunId:E}=S,T=i.find(I=>I.id===y);if(T?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${y}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let F=T;if(!F){let I={id:y,role:x,content:"",...(w!==void 0&&{name:w}),...(E!=null&&{subagentRunId:E})};i.push(I),F=I}let O=fr(F,S);(!T||O)&&f({messages:i})}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=S,x=i.find(E=>E.id===h);if(!x)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(x.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let w=yield ze(n,i,p,(E,T,F)=>E.onTextMessageContentEvent?.({event:S,messages:T,state:F,agent:r,input:e,textMessageBuffer:typeof x.content=="string"?x.content:""}));return f(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,fr(x,S),f({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=S,y=i.find(w=>w.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield ze(n,i,p,(w,E,T)=>w.onTextMessageEndEvent?.({event:S,messages:E,state:T,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return f(x),x.stopPropagation!==!0&&fr(y,S)&&f({messages:i}),yield Promise.all(n.map(w=>{w.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_START:{let h=yield ze(n,i,p,(y,x,w)=>y.onToolCallStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:x,parentMessageId:w,subagentRunId:E}=S,T=i.find(k=>k.toolCalls?.some(P=>P.id===y))?.toolCalls?.find(k=>k.id===y);if(T){let k=T.function.name!==x;return k&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${T.function.name}' \u2014 updating it to '${x}'`),T.function.name=x),(fr(T,S)||k)&&f({messages:i}),g()}let F=new Set(i.map(k=>k.id)),O=rQ(i,w,y);!F.has(O.id)&&E!=null&&O.subagentRunId===void 0&&(O.subagentRunId=E),O.toolCalls??(O.toolCalls=[]);let I={id:y,type:"function",function:{name:x,arguments:""}};O.toolCalls.push(I),fr(I,S),f({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=S,x=i.find(T=>T.toolCalls?.some(F=>F.id===h));if(!x)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=x.toolCalls?.find(T=>T.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let E=yield ze(n,i,p,(T,F,O)=>{let I=w.function.arguments,k=w.function.name,P={};try{P=lf(I)}catch{}return T.onToolCallArgsEvent?.({event:S,messages:F,state:O,agent:r,input:e,toolCallBuffer:I,toolCallName:k,partialToolCallArgs:P})});return f(E),E.stopPropagation!==!0&&(w.function.arguments+=y,fr(w,S),f({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=S,y=i.find(E=>E.toolCalls?.some(T=>T.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let x=y.toolCalls?.find(E=>E.id===h);if(!x)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let w=yield ze(n,i,p,(E,T,F)=>{let O=x.function.arguments,I=x.function.name,k={};try{k=JSON.parse(O)}catch{}return E.onToolCallEndEvent?.({event:S,messages:T,state:F,agent:r,input:e,toolCallName:I,toolCallArgs:k})});return f(w),w.stopPropagation!==!0&&fr(x,S)&&f({messages:i}),yield Promise.all(n.map(E=>{E.onNewToolCall?.({toolCall:x,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_RESULT:{let h=yield ze(n,i,p,(y,x,w)=>y.onToolCallResultEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:x,content:w,role:E,subagentRunId:T}=S,F={id:y,toolCallId:x,role:E||"tool",content:w,...(T!=null&&{subagentRunId:T})};fr(F,S);let O=i.findIndex(I=>I.role==="assistant"&&I.toolCalls?.some(k=>k.id===x));if(O===-1)i.push(F);else{let I=O+1;for(;I<i.length&&i[I].role==="tool";)I++;i.splice(I,0,F)}yield Promise.all(n.map(I=>{I.onNewMessage?.({message:F,messages:i,state:p,agent:r,input:e})})),f({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield ze(n,i,p,(y,x,w)=>y.onStateSnapshotEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{snapshot:y}=S;p=y,f({state:p})}return g()}case M.STATE_DELTA:{let h=yield ze(n,i,p,(y,x,w)=>y.onStateDeltaEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{delta:y}=S;try{p=qp.applyPatch(p,y,!0,!1).newDocument,f({state:p})}catch(x){let w=x instanceof Error?x.message:String(x);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function su(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var cs=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 p=jn(a),m=p.next();!m.done;m=p.next()){var f=m.value;f.remove(this)}}catch(x){t={error:x}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Le(g))try{g()}catch(x){i=x instanceof Dp?x.errors:[x]}var S=this._finalizers;if(S){this._finalizers=null;try{for(var b=jn(S),h=b.next();!h.done;h=b.next()){var y=h.value;try{Yw(y)}catch(x){i=i??[],x instanceof Dp?i=as(as([],is(i)),is(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{h&&!h.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new Dp(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Yw(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)&&su(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&su(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var KS=cs.EMPTY;function qp(e){return e instanceof cs||e&&"closed"in e&&Le(e.remove)&&Le(e.add)&&Le(e.unsubscribe)}function Yw(e){Le(e)?e():e.unsubscribe()}d();c();l();u();var qr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var us={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=us.delegate;return o?.setTimeout?o.setTimeout.apply(o,as([e,t],is(r))):setTimeout.apply(void 0,as([e,t],is(r)))},clearTimeout:function(e){var t=us.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Mp(e){us.setTimeout(function(){var t=qr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function cu(){}d();c();l();u();var Kw=function(){return XS("C",void 0,void 0)}();function Xw(e){return XS("E",void 0,e)}function Zw(e){return XS("N",e,void 0)}function XS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var Oi=null;function ls(e){if(qr.useDeprecatedSynchronousErrorHandling){var t=!Oi;if(t&&(Oi={errorThrown:!1,error:null}),e(),t){var r=Oi,n=r.errorThrown,o=r.error;if(Oi=null,n)throw o}}else e()}function Jw(e){qr.useDeprecatedSynchronousErrorHandling&&Oi&&(Oi.errorThrown=!0,Oi.error=e)}var uu=function(e){sn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,qp(r)&&r.add(n)):n.destination=EU,n}return t.create=function(r,n,o){return new jp(r,n,o)},t.prototype.next=function(r){this.isStopped?JS(Zw(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?JS(Xw(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?JS(Kw,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}(cs);var RU=Function.prototype.bind;function ZS(e,t){return RU.call(e,t)}var wU=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){Vp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Vp(n)}else Vp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Vp(r)}},e}(),jp=function(e){sn(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Le(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;i&&qr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&ZS(r.next,p),error:r.error&&ZS(r.error,p),complete:r.complete&&ZS(r.complete,p)}):a=r}return i.destination=new wU(a),i}return t}(uu);function Vp(e){qr.useDeprecatedSynchronousErrorHandling?Jw(e):Mp(e)}function IU(e){throw e}function JS(e,t){var r=qr.onStoppedNotification;r&&us.setTimeout(function(){return r(e,t)})}var EU={closed:!0,next:cu,error:IU,complete:cu};d();c();l();u();var ds=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function ps(e){return e}function Lp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(e)}function ev(e){return e.length===0?ps:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var st=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=TU(t)?t:new jp(t,r,n);return ls(function(){var a=o,p=a.operator,m=a.source;i.add(p?p.call(i,m):m?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=eI(r),new r(function(o,i){var a=new jp({next:function(p){try{t(p)}catch(m){i(m),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[ds]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ev(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=eI(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 eI(e){var t;return(t=e??qr.Promise)!==null&&t!==void 0?t:Promise}function FU(e){return e&&Le(e.next)&&Le(e.error)&&Le(e.complete)}function TU(e){return e&&e instanceof uu||FU(e)&&qp(e)}d();c();l();u();function PU(e){return Le(e?.lift)}function pt(e){return function(t){if(PU(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")}}d();c();l();u();function St(e,t,r,n,o){return new kU(e,t,r,n,o)}var kU=function(e){sn(t,e);function t(r,n,o,i,a,p){var m=e.call(this,r)||this;return m.onFinalize=a,m.shouldUnsubscribe=p,m._next=n?function(f){try{n(f)}catch(g){r.error(g)}}:e.prototype._next,m._error=i?function(f){try{i(f)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,m._complete=o?function(){try{o()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,m}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}(uu);d();c();l();u();d();c();l();u();var tI=ss(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var cn=function(e){sn(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 rI(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new tI},t.prototype.next=function(r){var n=this;ls(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=jn(n.currentObservers),p=a.next();!p.done;p=a.next()){var m=p.value;m.next(r)}}catch(f){o={error:f}}finally{try{p&&!p.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;ls(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;ls(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,p=o.observers;return i||a?KS:(this.currentObservers=null,p.push(r),new cs(function(){n.currentObservers=null,su(p,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 st;return r.source=this,r},t.create=function(r,n){return new rI(r,n)},t}(st);var rI=function(e){sn(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:KS},t}(cn);d();c();l();u();d();c();l();u();var tv={now:function(){return(tv.delegate||Date).now()},delegate:void 0};var Up=function(e){sn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=tv);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,p=n._timestampProvider,m=n._windowTime;o||(i.push(r),!a&&i.push(p.now()+m)),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,p=a.slice(),m=0;m<p.length&&!r.closed;m+=i?1:2)r.next(p[m]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,p=(a?1:2)*n;if(n<1/0&&p<i.length&&i.splice(0,i.length-p),!a){for(var m=o.now(),f=0,g=1;g<i.length&&i[g]<=m;g+=2)f=g;f&&i.splice(0,f+1)}},t}(cn);d();c();l();u();var Qp=new st(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function nI(e){return e&&Le(e.schedule)}function OU(e){return e[e.length-1]}function oI(e){return nI(OU(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Bp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Gp(e){return Le(e?.then)}d();c();l();u();function $p(e){return Le(e[ds])}d();c();l();u();function Hp(e){return Symbol.asyncIterator&&Le(e?.[Symbol.asyncIterator])}d();c();l();u();function zp(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.")}d();c();l();u();d();c();l();u();function _U(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Wp=_U();function Yp(e){return Le(e?.[Wp])}d();c();l();u();function Kp(e){return zw(this,arguments,function(){var r,n,o,i;return Np(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,ki(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,ki(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,ki(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 Xp(e){return Le(e?.getReader)}function It(e){if(e instanceof st)return e;if(e!=null){if($p(e))return NU(e);if(Bp(e))return DU(e);if(Gp(e))return qU(e);if(Hp(e))return iI(e);if(Yp(e))return MU(e);if(Xp(e))return VU(e)}throw zp(e)}function NU(e){return new st(function(t){var r=e[ds]();if(Le(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function DU(e){return new st(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function qU(e){return new st(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Mp)})}function MU(e){return new st(function(t){var r,n;try{for(var o=jn(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(p){r={error:p}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function iI(e){return new st(function(t){jU(e,t).catch(function(r){return t.error(r)})})}function VU(e){return iI(Kp(e))}function jU(e,t){var r,n,o,i;return Hw(this,void 0,void 0,function(){var a,p;return Np(this,function(m){switch(m.label){case 0:m.trys.push([0,5,6,11]),r=Ww(e),m.label=1;case 1:return[4,r.next()];case 2:if(n=m.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];m.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=m.sent(),o={error:p},[3,11];case 6:return m.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:m.sent(),m.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]}})})}d();c();l();u();d();c();l();u();function Ir(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 Zp(e,t){return t===void 0&&(t=0),pt(function(r,n){r.subscribe(St(n,function(o){return Ir(n,e,function(){return n.next(o)},t)},function(){return Ir(n,e,function(){return n.complete()},t)},function(o){return Ir(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Jp(e,t){return t===void 0&&(t=0),pt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function aI(e,t){return It(e).pipe(Jp(t),Zp(t))}d();c();l();u();function sI(e,t){return It(e).pipe(Jp(t),Zp(t))}d();c();l();u();function cI(e,t){return new st(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function uI(e,t){return new st(function(r){var n;return Ir(r,t,function(){n=e[Wp](),Ir(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(p){r.error(p);return}a?r.complete():r.next(i)},0,!0)}),function(){return Le(n?.return)&&n.return()}})}d();c();l();u();function ef(e,t){if(!e)throw new Error("Iterable cannot be null");return new st(function(r){Ir(r,t,function(){var n=e[Symbol.asyncIterator]();Ir(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function lI(e,t){return ef(Kp(e),t)}function dI(e,t){if(e!=null){if($p(e))return aI(e,t);if(Bp(e))return cI(e,t);if(Gp(e))return sI(e,t);if(Hp(e))return ef(e,t);if(Yp(e))return uI(e,t);if(Xp(e))return lI(e,t)}throw zp(e)}function _i(e,t){return t?dI(e,t):It(e)}function He(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=oI(e);return _i(e,r)}d();c();l();u();function Ae(e,t){var r=Le(e)?e:function(){return e},n=function(o){return o.error(r())};return new st(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var pI=ss(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function tf(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(p){a=p,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new pI)}})})}d();c();l();u();function So(e,t){return pt(function(r,n){var o=0;r.subscribe(St(n,function(i){n.next(e.call(t,i,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function fI(e,t,r,n,o,i,a,p){var m=[],f=0,g=0,S=!1,b=function(){S&&!m.length&&!f&&t.complete()},h=function(x){return f<n?y(x):m.push(x)},y=function(x){i&&t.next(x),f++;var w=!1;It(r(x,g++)).subscribe(St(t,function(E){o?.(E),i?h(E):t.next(E)},function(){w=!0},void 0,function(){if(w)try{f--;for(var E=function(){var k=m.shift();a?Ir(t,a,function(){return y(k)}):y(k)};m.length&&f<n;)E();b()}catch(k){t.error(k)}}))};return e.subscribe(St(t,h,function(){S=!0,b()})),function(){p?.()}}function nr(e,t,r){return r===void 0&&(r=1/0),Le(t)?nr(function(n,o){return So(function(i,a){return t(n,i,o,a)})(It(e(n,o)))},r):(typeof t=="number"&&(r=t),pt(function(n,o){return fI(n,o,e,r)}))}function rv(e){return e===void 0&&(e=1/0),nr(ps,e)}d();c();l();u();function rf(e){return new st(function(t){It(e()).subscribe(t)})}d();c();l();u();function nv(e,t){return pt(function(r,n){var o=0;r.subscribe(St(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}d();c();l();u();function lu(e){return pt(function(t,r){var n=null,o=!1,i;n=t.subscribe(St(r,void 0,void 0,function(a){i=It(e(a,lu(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}d();c();l();u();function nf(e,t){return Le(t)?nr(e,t,1):nr(e,1)}d();c();l();u();function ov(e){return pt(function(t,r){var n=!1;t.subscribe(St(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Ni(e){return pt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function iv(e,t){return pt(function(r,n){var o=null,i=0,a=!1,p=function(){return a&&!o&&n.complete()};r.subscribe(St(n,function(m){o?.unsubscribe();var f=0,g=i++;It(e(m,g)).subscribe(o=St(n,function(S){return n.next(t?t(m,S,g,f++):S)},function(){o=null,p()}))},function(){a=!0,p()}))})}d();c();l();u();function of(e){return pt(function(t,r){It(e).subscribe(St(r,function(){return r.complete()},cu)),!r.closed&&t.subscribe(r)})}d();c();l();u();function af(e,t,r){var n=Le(e)||t||r?{next:e,error:t,complete:r}:e;return n?pt(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var p=!0;o.subscribe(St(i,function(m){var f;(f=n.next)===null||f===void 0||f.call(n,m),i.next(m)},function(){var m;p=!1,(m=n.complete)===null||m===void 0||m.call(n),i.complete()},function(m){var f;p=!1,(f=n.error)===null||f===void 0||f.call(n,m),i.error(m)},function(){var m,f;p&&((m=n.unsubscribe)===null||m===void 0||m.call(n)),(f=n.finalize)===null||f===void 0||f.call(n)}))}):ps}d();c();l();u();d();c();l();u();function mI(e){return` \r
36
+ `.indexOf(e)>=0}function sf(e){for(var t=["topLevel"],r=0,n,o,i,a=function(k){return t.push(k)},p=function(k){return t[t.length-1]=k},m=function(k){n==null&&(n=r,o=t.length,i=k)},f=function(k){k===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},S=function(){return r--},b=function(k){if("0"<=k&&k<="9"){a("number");return}switch(k){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":b(y);break;case"string":switch(y){case"\"":g();break;case"\\":m("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(f("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(f("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(S(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(S(),g());break;case"arrayNeedsValue":y==="]"?g():mI(y)||(f("collectionItem"),p("arrayNeedsComma"),b(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(m("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(m("collectionItem"),p("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":mI(y)||(f("collectionItem"),p("objectNeedsComma"),b(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(m("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],w=function(k){return x.push(k.slice(e.length-e.lastIndexOf(k[0])))},E=t.length-1;E>=0;E--)switch(t[E]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function hI(){let e=this.buf,t=this.pos,r=0,n=0;for(let i=0;i<28;i+=7){let a=e[t++];if(r|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(n|=(a&127)<<i,(a&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var cf=4294967296;function av(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,p){let m=Number(e.slice(a,p));o*=r,n=n*r+m,n>=cf&&(o=o+(n/cf|0),n=n%cf)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?SI(n,o):cv(n,o)}function yI(e,t){let r=cv(e,t),n=r.hi&2147483648;n&&(r=SI(r.lo,r.hi));let o=sv(r.lo,r.hi);return n?"-"+o:o}function sv(e,t){if({lo:e,hi:t}=LU(e,t),t<=2097151)return String(cf*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,p=o*2,m=1e7;return i>=m&&(a+=Math.floor(i/m),i%=m),a>=m&&(p+=Math.floor(a/m),a%=m),p.toString()+gI(a)+gI(i)}function LU(e,t){return{lo:e>>>0,hi:t>>>0}}function cv(e,t){return{lo:e|0,hi:t|0}}function SI(e,t){return t=~t,e?e=~e+1:t+=1,cv(e,t)}var gI=e=>{let t=String(e);return"0000000".slice(t.length)+t};function vI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var Mr=UU();function UU(){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"&&(!!v.Deno||!!v.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>n||p<r)throw new Error(`invalid int64: ${a}`);return p},uParse(a){let p=typeof a=="bigint"?a:BigInt(a);if(p>i||p<o)throw new Error(`invalid uint64: ${a}`);return p},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,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(a,p){return e.setInt32(0,a,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),AI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),CI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),AI(r),av(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),CI(r),av(r)},dec(r,n){return yI(r,n)},uDec(r,n){return sv(r,n)}}}function AI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function CI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var uv;function QU(e){var t;uv=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:dv(e.encodeUtf8.bind(e))})}function lv(){if(!uv){let e=v;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),QU(o)}return uv}function dv(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var vo;(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"})(vo||(vo={}));var BU=4294967295,GU=2147483647,$U=-2147483648,Fe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?dv(t):lv().encodeUtf8Into,this.buffer=xI,this.viewCache=zU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||HU;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(du),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-du,n=pv(r);return n>du&&(this.ensureCapacity(n-du),this.buffer.copyWithin(t+n,t+du,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(bI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(fv(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=RI){this.ensureCapacity(r+1);let m=this.buffer,f=this.pos;m[f++]=r;let g=0;for(;g<r;g++){let S=t.charCodeAt(g);if(S>127)break;m[f++]=S}if(g==r)return this.pos=f,this}this.ensureCapacity(r*3+5);let n=pv(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),p=pv(a);return p!=n&&o.copyWithin(i+p,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return WU(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return bI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return fv(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return fv(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Mr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Mr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Mr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Mr.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=Mr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let m=t>>>p,f=!(!(m>>>7)&&r==0);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let p=3;p<31;p=p+7){let m=r>>>p,f=!!(m>>>7);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},HU=128,du=1,xI=new Uint8Array(0),zU=new DataView(xI.buffer),RI=32;function pv(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var re=class{constructor(t,r=lv().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=hI,this.uint32=vI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,i=r&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,r,n=100){let o=this.pos;switch(t){case vo.Varint:for(;this.buf[this.pos++]&128;);break;case vo.Bit64:this.pos+=4;case vo.Bit32:this.pos+=4;break;case vo.LengthDelimited:let i=this.uint32();this.pos+=i;break;case vo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,p]=this.tag();if(p===vo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(p,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Mr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Mr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Mr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Mr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Mr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=RI){let o=new Array(n);for(let i=0;i<n;i++){let a=r[i];if(a>127)return this.decodeUtf8(r,t);o[i]=a}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function fv(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>GU||e<$U)throw new Error("invalid int32: "+e)}function bI(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>BU||e<0)throw new Error("invalid uint32: "+e)}function WU(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var YU=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function mv(){return{fields:{}}}var Vt={encode(e,t=new Fe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&yv.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=mv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=yv.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 Vt.fromPartial(e??{})},fromPartial(e){let t=mv();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=mv();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 wI(){return{key:"",value:void 0}}var yv={encode(e,t=new Fe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&he.encode(he.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=wI();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=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yv.fromPartial(e??{})},fromPartial(e){let t=wI();return t.key=e.key??"",t.value=e.value??void 0,t}};function gv(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var he={encode(e,t=new Fe){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&&Vt.encode(Vt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&pu.encode(pu.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=gv();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=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=pu.unwrap(pu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=gv();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=gv();if(e===null)t.nullValue=YU.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(v.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new v.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 hv(){return{values:[]}}var pu={encode(e,t=new Fe){for(let r of e.values)he.encode(he.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=hv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(he.unwrap(he.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pu.fromPartial(e??{})},fromPartial(e){let t=hv();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=hv();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&v.Array.isArray(e.values)?e.values:e}},KU=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 II(){return{op:0,path:"",from:void 0,value:void 0}}var lf={encode(e,t=new Fe){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&&he.encode(he.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=II();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=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=II();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function EI(){return{id:"",type:"",function:void 0,metadata:void 0}}var df={encode(e,t=new Fe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&pf.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=EI();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=pf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=EI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?pf.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function FI(){return{name:"",arguments:""}}var pf={encode(e,t=new Fe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=FI();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 pf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function TI(){return{value:"",mimeType:""}}var ff={encode(e,t=new Fe){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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=TI();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 ff.fromPartial(e??{})},fromPartial(e){let t=TI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function PI(){return{value:"",mimeType:void 0}}var mf={encode(e,t=new Fe){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 re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=PI();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 mf.fromPartial(e??{})},fromPartial(e){let t=PI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function kI(){return{data:void 0,url:void 0}}var pr={encode(e,t=new Fe){return e.data!==void 0&&ff.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&mf.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=ff.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=mf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=kI();return t.data=e.data!==void 0&&e.data!==null?ff.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?mf.fromPartial(e.url):void 0,t}};function OI(){return{text:""}}var gf={encode(e,t=new Fe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=OI();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 gf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.text=e.text??"",t}};function _I(){return{source:void 0,metadata:void 0}}var hf={encode(e,t=new Fe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function NI(){return{source:void 0,metadata:void 0}}var yf={encode(e,t=new Fe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function DI(){return{source:void 0,metadata:void 0}}var Sf={encode(e,t=new Fe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=DI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function qI(){return{source:void 0,metadata:void 0}}var vf={encode(e,t=new Fe){return e.source!==void 0&&pr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=qI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=pr.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=qI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function MI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Af={encode(e,t=new Fe){return e.text!==void 0&&gf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&hf.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&yf.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Sf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&vf.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=MI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=gf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=hf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=yf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Sf.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=vf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=MI();return t.text=e.text!==void 0&&e.text!==null?gf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?hf.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?yf.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Sf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?vf.fromPartial(e.document):void 0,t}};function VI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Cf={encode(e,t=new Fe){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)df.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)Af.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=VI();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(df.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(Af.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=VI();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=>df.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Af.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function jI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var bf={encode(e,t=new Fe){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&he.encode(he.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=jI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=he.unwrap(he.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=jI();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},XU=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function LI(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var me={encode(e,t=new Fe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&he.encode(he.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=LI();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=fs(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=LI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function UI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var xf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=UI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function QI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Rf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=QI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function BI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var wf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=BI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function GI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var If={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=GI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function $I(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Ef={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=$I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function HI(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Ff={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=HI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=HI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function zI(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Tf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&he.encode(he.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=zI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=he.unwrap(he.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=zI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function WI(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Pf={encode(e,t=new Fe){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)lf.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=WI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(lf.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pf.fromPartial(e??{})},fromPartial(e){let t=WI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>lf.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function YI(){return{baseEvent:void 0,messages:[]}}var kf={encode(e,t=new Fe){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Cf.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=YI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Cf.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kf.fromPartial(e??{})},fromPartial(e){let t=YI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Cf.fromPartial(r))||[],t}};function KI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Of={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&he.encode(he.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=KI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=he.unwrap(he.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Of.fromPartial(e??{})},fromPartial(e){let t=KI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function XI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var _f={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&he.encode(he.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=XI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _f.fromPartial(e??{})},fromPartial(e){let t=XI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ZI(){return{baseEvent:void 0,threadId:"",runId:""}}var Nf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=ZI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.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 Nf.fromPartial(e??{})},fromPartial(e){let t=ZI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function JI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Di={encode(e,t=new Fe){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=JI();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=r.string();continue;case 2:if(i!==18)break;o.model=r.string();continue;case 3:if(i!==24)break;o.inputTokens=fs(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=fs(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=fs(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=fs(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=fs(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Di.fromPartial(e??{})},fromPartial(e){let t=JI();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function eE(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Df={encode(e,t=new Fe){e.baseEvent!==void 0&&me.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&&he.encode(he.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)bf.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Di.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=eE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.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=he.unwrap(he.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(bf.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Di.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Df.fromPartial(e??{})},fromPartial(e){let t=eE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>bf.fromPartial(r))||[],t.usage=e.usage?.map(r=>Di.fromPartial(r))||[],t}};function tE(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var qf={encode(e,t=new Fe){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message);for(let r of e.usage)Di.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=tE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.usage.push(Di.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return qf.fromPartial(e??{})},fromPartial(e){let t=tE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Di.fromPartial(r))||[],t}};function rE(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Mf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=rE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mf.fromPartial(e??{})},fromPartial(e){let t=rE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function nE(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Vf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=nE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue;case 3:if(i!==26)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vf.fromPartial(e??{})},fromPartial(e){let t=nE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function oE(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var jf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=oE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue;case 5:if(i!==42)break;o.name=r.string();continue;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return jf.fromPartial(e??{})},fromPartial(e){let t=oE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function iE(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Lf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=iE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue;case 6:if(i!==50)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Lf.fromPartial(e??{})},fromPartial(e){let t=iE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function aE(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Uf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=aE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.name=r.string();continue;case 4:if(i!==34)break;o.description=r.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(i!==50)break;o.parentToolCallId=r.string();continue;case 7:if(i!==58)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Uf.fromPartial(e??{})},fromPartial(e){let t=aE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function sE(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Qf={encode(e,t=new Fe){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&he.encode(he.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=sE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.outcome=r.string();continue;case 5:if(i!==42)break;o.interruptIds.push(r.string());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Qf.fromPartial(e??{})},fromPartial(e){let t=sE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function cE(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Bf={encode(e,t=new Fe){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=cE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=me.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.code=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Bf.fromPartial(e??{})},fromPartial(e){let t=cE();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function uE(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var lE={encode(e,t=new Fe){return e.textMessageStart!==void 0&&xf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Rf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&wf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&If.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Ef.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Ff.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Tf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Pf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&kf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Of.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&_f.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Nf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Df.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&qf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Mf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Vf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&jf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Lf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Uf.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Qf.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Bf.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof re?e:new re(e),n=t===void 0?r.len:r.pos+t,o=uE();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=xf.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Rf.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=wf.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=If.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Ef.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Ff.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Tf.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Pf.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=kf.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Of.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=_f.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Nf.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Df.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=qf.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Mf.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Vf.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=jf.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Lf.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=Uf.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Qf.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Bf.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lE.fromPartial(e??{})},fromPartial(e){let t=uE();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?xf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Rf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?wf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?If.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Ef.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Ff.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Tf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Pf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?kf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Of.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?_f.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Nf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Df.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?qf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Mf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Vf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?jf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Lf.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Uf.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Qf.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Bf.fromPartial(e.subagentError):void 0,t}};function fs(e){let t=v.Number(e.toString());if(t>v.Number.MAX_SAFE_INTEGER)throw new v.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<v.Number.MIN_SAFE_INTEGER)throw new v.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var dE=e=>e&&typeof e=="object"?e:void 0;var uf=e=>{let t=dE(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},ZU=e=>{let t=dE(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:uf(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:uf(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:uf(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:uf(r.source),metadata:r.metadata}}}};function pE(e){let t=lE.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=XU[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===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=>ZU(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===M.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===M.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=KU[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]}),wp.parse(r)}var Sv="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var eQ=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,vv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(eQ);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},fE=e=>e==="*"||e==="x"||e==="X",mE=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},tQ=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],rQ=(e,t)=>{if(fE(e)||fE(t))return 0;let[r,n]=tQ(mE(e),mE(t));return r>n?1:r<n?-1:0},Av=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=rQ(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ms=(e,t)=>{let r=vv(e),n=vv(t),o=r.pop(),i=n.pop(),a=Av(r,n);return a!==0?a:o&&i?Av(o.split("."),i.split(".")):o||i?o?-1:1:0};var Be=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function fu(){return fo()}function xv(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&xv(t);return e}var gE=512*1024;function hE(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let p=0;p<a.length;p++)o.push(a[p]);else{let p=Object.keys(a);for(let m=0;m<p.length;m++){let f=p[m];if(n+=f.length,n>r)return!0;o.push(a[f])}}}}return!1}function ze(_x197,_x198,_x199,_x200){return _ze.apply(this,arguments)}function _ze(){_ze=_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,p=a&&!hE(t,r,gE),m=p?Be(t):t,f=p?Be(r):r,g=!1,S=!1,b;for(let h of e)try{p&&(xv(m),xv(f));let y=yield n(h,m,f);if(y===void 0)continue;let x=!1;if(y.messages!==void 0&&y.messages!==m&&(m=Be(y.messages),g=!0,x=!0),y.state!==void 0&&y.state!==f&&(f=Be(y.state),S=!0,x=!0),p&&x&&hE(m,f,gE)&&(p=!1),b=y.stopPropagation,b===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(m)?Be(m):m}:{}),...(S?{state:Object.isFrozen(f)?Be(f):f}:{}),...(b===void 0?{}:{stopPropagation:b})}});return _ze.apply(this,arguments)}function Gf(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 mu(e){if(e instanceof Rv)return e;if(e===!0)return new Rv(Gf(!0))}var Rv=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 Cv(e){return e.enabled?new Rv(e):void 0}function nQ(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}function fr(e,t){return!e||t.metadata===void 0?!1:(e.metadata=qw(e.metadata,Be(t.metadata)),!0)}var IE=(e,t,r,n,o)=>{let i=mu(o),a=Be(r.messages),p=Be(e.state),m={},f=S=>{S.messages!==void 0&&(a=S.messages,m.messages=S.messages),S.state!==void 0&&(p=S.state,m.state=S.state)},g=()=>{let S=Be(m);return m={},S.messages!==void 0||S.state!==void 0?He(S):Qp};return t.pipe(nf(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(S){let b=yield ze(n,a,p,(h,y,x)=>h.onEvent?.({event:S,agent:r,input:e,messages:y,state:x}));if(f(b),b.stopPropagation===!0?i?.event("APPLY","Event dropped:",S,{type:S.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",S,{type:S.type,subscribers:n.length}),b.stopPropagation===!0)return g();switch(S.type){case M.TEXT_MESSAGE_START:{let h=yield ze(n,a,p,(y,x,w)=>y.onTextMessageStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,role:x="assistant",name:w,subagentRunId:E}=S,k=a.find(I=>I.id===y);if(k?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${y}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let F=k;if(!F){let I={id:y,role:x,content:"",...(w!==void 0&&{name:w}),...(E!=null&&{subagentRunId:E})};a.push(I),F=I}let _=fr(F,S);(!k||_)&&f({messages:a})}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=S,x=a.find(E=>E.id===h);if(!x)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(x.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let w=yield ze(n,a,p,(E,k,F)=>E.onTextMessageContentEvent?.({event:S,messages:k,state:F,agent:r,input:e,textMessageBuffer:typeof x.content=="string"?x.content:""}));return f(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,fr(x,S),f({messages:a})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=S,y=a.find(w=>w.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield ze(n,a,p,(w,E,k)=>w.onTextMessageEndEvent?.({event:S,messages:E,state:k,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return f(x),x.stopPropagation!==!0&&fr(y,S)&&f({messages:a}),yield Promise.all(n.map(w=>{w.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_START:{let h=yield ze(n,a,p,(y,x,w)=>y.onToolCallStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:x,parentMessageId:w,subagentRunId:E}=S,k=a.find(O=>O.toolCalls?.some(P=>P.id===y))?.toolCalls?.find(O=>O.id===y);if(k){let O=k.function.name!==x;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${k.function.name}' \u2014 updating it to '${x}'`),k.function.name=x),(fr(k,S)||O)&&f({messages:a}),g()}let F=new Set(a.map(O=>O.id)),_=nQ(a,w,y);!F.has(_.id)&&E!=null&&_.subagentRunId===void 0&&(_.subagentRunId=E),_.toolCalls??(_.toolCalls=[]);let I={id:y,type:"function",function:{name:x,arguments:""}};_.toolCalls.push(I),fr(I,S),f({messages:a})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=S,x=a.find(k=>k.toolCalls?.some(F=>F.id===h));if(!x)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=x.toolCalls?.find(k=>k.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let E=yield ze(n,a,p,(k,F,_)=>{let I=w.function.arguments,O=w.function.name,P={};try{P=sf(I)}catch{}return k.onToolCallArgsEvent?.({event:S,messages:F,state:_,agent:r,input:e,toolCallBuffer:I,toolCallName:O,partialToolCallArgs:P})});return f(E),E.stopPropagation!==!0&&(w.function.arguments+=y,fr(w,S),f({messages:a})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=S,y=a.find(E=>E.toolCalls?.some(k=>k.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let x=y.toolCalls?.find(E=>E.id===h);if(!x)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let w=yield ze(n,a,p,(E,k,F)=>{let _=x.function.arguments,I=x.function.name,O={};try{O=JSON.parse(_)}catch{}return E.onToolCallEndEvent?.({event:S,messages:k,state:F,agent:r,input:e,toolCallName:I,toolCallArgs:O})});return f(w),w.stopPropagation!==!0&&fr(x,S)&&f({messages:a}),yield Promise.all(n.map(E=>{E.onNewToolCall?.({toolCall:x,messages:a,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_RESULT:{let h=yield ze(n,a,p,(y,x,w)=>y.onToolCallResultEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:x,content:w,role:E,subagentRunId:k}=S,F={id:y,toolCallId:x,role:E||"tool",content:w,...(k!=null&&{subagentRunId:k})};fr(F,S);let _=a.findIndex(I=>I.role==="assistant"&&I.toolCalls?.some(O=>O.id===x));if(_===-1)a.push(F);else{let I=_+1;for(;I<a.length&&a[I].role==="tool";)I++;a.splice(I,0,F)}yield Promise.all(n.map(I=>{I.onNewMessage?.({message:F,messages:a,state:p,agent:r,input:e})})),f({messages:a})}return g()}case M.STATE_SNAPSHOT:{let h=yield ze(n,a,p,(y,x,w)=>y.onStateSnapshotEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{snapshot:y}=S;p=y,f({state:p})}return g()}case M.STATE_DELTA:{let h=yield ze(n,a,p,(y,x,w)=>y.onStateDeltaEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{delta:y}=S;try{p=_p.applyPatch(p,y,!0,!1).newDocument,f({state:p})}catch(x){let w=x instanceof Error?x.message:String(x);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
38
  Patch operations: ${JSON.stringify(y,null,2)}
39
- Error: ${w}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield ze(n,i,p,(y,x,w)=>y.onMessagesSnapshotEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messages:y}=S,x=y.map(I=>{if(I.subagentRunId!==null)return I;let k={...I};return delete k.subagentRunId,k}),w=new Map(x.map(I=>[I.id,I])),E=x.some(I=>I.role==="activity"),T=x.some(I=>I.role==="reasoning"),F=I=>I.role==="activity"&&!E||I.role==="reasoning"&&!T;i=i.filter(I=>F(I)||w.has(I.id)).map(I=>F(I)?I:w.get(I.id));let O=new Set(i.map(I=>I.id));for(let I of x)O.has(I.id)||i.push(I);f({messages:i})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=S,y=i.findIndex(F=>F.id===h.messageId),x=y>=0?i[y]:void 0,w=x?.role==="activity"?x:void 0,E=h.replace??!0,T=yield ze(n,i,p,(F,O,I)=>F.onActivitySnapshotEvent?.({event:h,messages:O,state:I,agent:r,input:e,activityMessage:w,existingMessage:x}));if(f(T),T.stopPropagation!==!0){let F={id:h.messageId,role:"activity",activityType:h.activityType,content:Be(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},O,I;y===-1?(i.push(F),O=F,I=F):w?(E&&(i[y]={...w,activityType:h.activityType,content:Be(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete i[y].subagentRunId),I=i[y]):E&&(i[y]=F,O=F,I=F),fr(I,h),f({messages:i}),O&&(yield Promise.all(n.map(k=>k.onNewMessage?.({message:O,messages:i,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=S,y=i.findIndex(T=>T.id===h.messageId);if(y===-1)return g();let x=i[y];if(x.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=x,E=yield ze(n,i,p,(T,F,O)=>T.onActivityDeltaEvent?.({event:h,messages:F,state:O,agent:r,input:e,activityMessage:w}));if(f(E),E.stopPropagation!==!0)try{fr(w,h)&&f({messages:i});let T=Be(w.content??{}),F=qp.applyPatch(T,h.patch??[],!0,!1).newDocument;i[y]={...w,content:Be(F),activityType:h.activityType},f({messages:i})}catch(T){let F=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${F}`)}return g()}case M.RAW:return f(yield ze(n,i,p,(h,y,x)=>h.onRawEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.CUSTOM:return f(yield ze(n,i,p,(h,y,x)=>h.onCustomEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield ze(n,i,p,(y,x,w)=>y.onRunStartedEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let y=S;if(y.input?.messages){for(let x of y.input.messages){let w=x;if(x.subagentRunId===null){let E={...x};delete E.subagentRunId,w=E}i.find(E=>E.id===w.id)||i.push(w)}f({messages:i})}}return g()}case M.RUN_FINISHED:{let h=S,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},x=yield ze(n,i,p,(w,E,T)=>w.onRunFinishedEvent?.({...y,messages:E,state:T,agent:r,input:e}));return f(x),x.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(w=>{if(w.subagentRunId!==null)return w;let E={...w};return delete E.subagentRunId,E}):[]),g()}case M.RUN_ERROR:return f(yield ze(n,i,p,(h,y,x)=>h.onRunErrorEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.STEP_STARTED:return f(yield ze(n,i,p,(h,y,x)=>h.onStepStartedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.STEP_FINISHED:return f(yield ze(n,i,p,(h,y,x)=>h.onStepFinishedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed 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 f(yield ze(n,i,p,(h,y,x)=>h.onReasoningStartEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield ze(n,i,p,(y,x,w)=>y.onReasoningMessageStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:x}=S,w=i.find(F=>F.id===y),E=w;if(!E){let F={id:y,role:"reasoning",content:"",...(x!=null&&{subagentRunId:x})};i.push(F),E=F}let T=fr(E,S);(!w||T)&&f({messages:i})}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=S,x=i.find(E=>E.id===h);if(!x)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield ze(n,i,p,(E,T,F)=>E.onReasoningMessageContentEvent?.({event:S,messages:T,state:F,agent:r,input:e,reasoningMessageBuffer:typeof x.content=="string"?x.content:""}));return f(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,fr(x,S),f({messages:i})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=S,y=i.find(w=>w.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let x=yield ze(n,i,p,(w,E,T)=>w.onReasoningMessageEndEvent?.({event:S,messages:E,state:T,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return f(x),x.stopPropagation!==!0&&fr(y,S)&&f({messages:i}),yield Promise.all(n.map(w=>{w.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return f(yield ze(n,i,p,(h,y,x)=>h.onReasoningEndEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:x}=S,w=yield ze(n,i,p,(E,T,F)=>E.onReasoningEncryptedValueEvent?.({event:S,messages:T,state:F,agent:r,input:e}));if(f(w),w.stopPropagation!==!0){let E=!1;if(h==="tool-call"){for(let T of i)if(T.role==="assistant"&&T.toolCalls){let F=T.toolCalls.find(O=>O.id===y);if(F){F.encryptedValue=x,E=!0;break}}}else{let T=i.find(F=>F.id===y);T?.role!=="activity"&&T&&(T.encryptedValue=x,E=!0)}E&&(m.messages=i)}return g()}case M.SUBAGENT_STARTED:return f(yield ze(n,i,p,(h,y,x)=>h.onSubagentStartedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.SUBAGENT_FINISHED:return f(yield ze(n,i,p,(h,y,x)=>h.onSubagentFinishedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.SUBAGENT_ERROR:return f(yield ze(n,i,p,(h,y,x)=>h.onSubagentErrorEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g()}return S.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),tv(),n.length>0?nv({}):S=>S)},bv=e=>t=>{let r=yu(e),n=new Set,o=new Set,a=new Set,i={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},p=!1,m=!1,f=!1,g=new Map,S=I=>{let k=g.get(I);return k||(k=new Map,g.set(I,k)),k},C=()=>{for(let I of g.values())if(I.size>0)return!0;return!1},h=new Map,y=new Set,x=!1,w=!1,E=!1,T=()=>{n.clear(),o.clear(),a.clear(),i.message.clear(),i.toolCall.clear(),i.activity.clear(),i.reasoning.clear(),g.clear(),h.clear(),y.clear(),x=!1,w=!1,p=!1,m=!1,E=!0},F=(I,k)=>{let P=I??[];if(Array.isArray(P))for(let _ of P){if(!_||typeof _.id!="string")continue;if(_.subagentRunId===null)return new Fe(`Cannot send a message (id '${_.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let j=_.role==="reasoning"?i.reasoning:_.role==="activity"?i.activity:i.message;(k||!j.has(_.id))&&j.set(_.id,{subagentRunId:_.subagentRunId});for(let B of _.toolCalls??[])B&&typeof B.id=="string"&&(k||!i.toolCall.has(B.id))&&i.toolCall.set(B.id,{subagentRunId:_.subagentRunId??void 0})}},O=(I,k,P,_,j)=>{if(k!==void 0&&P&&P.subagentRunId!==k)return new Fe(`Cannot send '${I}': subagentRunId '${k}' does not match the ${_} '${j}' opener's subagent '${P.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(nr(I=>{let k=I.type;if(r?.event("VERIFY","Event:",I,{type:I.type}),m&&k!==M.RUN_STARTED)return be(()=>new Fe(`Cannot send event type '${k}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(p&&k!==M.RUN_ERROR&&k!==M.RUN_STARTED)return be(()=>new Fe(`Cannot send event type '${k}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(f){if(k===M.RUN_STARTED){if(E&&!p&&!m)return be(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(p||m)&&T()}}else if(f=!0,k!==M.RUN_STARTED&&k!==M.RUN_ERROR)return be(()=>new Fe("First event must be 'RUN_STARTED'"));if(I.subagentRunId===null)return be(()=>new Fe(`Cannot send '${k}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(k===M.SUBAGENT_STARTED||k===M.SUBAGENT_FINISHED||k===M.SUBAGENT_ERROR){let P=k===M.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:k===M.SUBAGENT_FINISHED?["outcome"]:["code"];for(let j of P)if(I[j]===null)return be(()=>new Fe(`Cannot send '${k}' with '${j}: null'. The field is optional \u2014 omit it entirely.`));let _=I.outcome;if(_!=null&&_.type!=="success"&&_.type!=="suspended")return be(()=>new Fe(`Cannot send '${k}' with outcome type '${String(_.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(_&&_.interruptIds===null)return be(()=>new Fe(`Cannot send '${k}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(_&&Array.isArray(_.interruptIds)&&_.interruptIds.some(j=>typeof j!="string"))return be(()=>new Fe(`Cannot send '${k}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(k===M.RUN_FINISHED){let P=I.outcome;if(P?.type==="interrupt"&&Array.isArray(P.interrupts)){for(let _ of P.interrupts)if(_&&_.subagentRunId===null)return be(()=>new Fe(`Cannot send 'RUN_FINISHED' with an interrupt (id '${_.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(k){case M.TEXT_MESSAGE_START:{let P=I.messageId;if(n.has(P))return be(()=>new Fe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${P}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let _=i.message.get(P);if(_){let j=O(k,I.subagentRunId,_,"message",P);if(j)return be(()=>j)}return n.add(P),_||i.message.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.TEXT_MESSAGE_CONTENT:{let P=I.messageId;if(!n.has(P))return be(()=>new Fe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${P}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let _=O(k,I.subagentRunId,i.message.get(P),"message",P);return _?be(()=>_):He(I)}case M.TEXT_MESSAGE_END:{let P=I.messageId;if(!n.has(P))return be(()=>new Fe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${P}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let _=O(k,I.subagentRunId,i.message.get(P),"message",P);return _?be(()=>_):(n.delete(P),He(I))}case M.TOOL_CALL_START:{let P=I.toolCallId;if(o.has(P))return be(()=>new Fe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${P}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let _=I.parentMessageId,j=I.subagentRunId,B;if(_!==void 0){let V=i.message.get(_);if(V){if(j!==void 0&&j!==V.subagentRunId)return be(()=>new Fe(`Cannot send 'TOOL_CALL_START': subagentRunId '${j}' does not match its parent message '${_}' owner '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));B=V}}let U=i.toolCall.get(P);if(U){let V=O(k,j,U,"tool call",P);if(V)return be(()=>V);if(j===void 0&&B&&B.subagentRunId!==U.subagentRunId)return be(()=>new Fe(`Cannot send 'TOOL_CALL_START': tool call '${P}' is owned by '${U.subagentRunId??"(the parent agent)"}' but its parent message '${_}' is owned by '${B.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(P),U||i.toolCall.set(P,j===void 0?B??{subagentRunId:void 0}:{subagentRunId:j}),He(I)}case M.TOOL_CALL_ARGS:{let P=I.toolCallId;if(!o.has(P))return be(()=>new Fe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${P}'. Start a tool call with 'TOOL_CALL_START' first.`));let _=O(k,I.subagentRunId,i.toolCall.get(P),"tool call",P);return _?be(()=>_):He(I)}case M.TOOL_CALL_END:{let P=I.toolCallId;if(!o.has(P))return be(()=>new Fe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${P}'. A 'TOOL_CALL_START' event must be sent first.`));let _=O(k,I.subagentRunId,i.toolCall.get(P),"tool call",P);return _?be(()=>_):(o.delete(P),He(I))}case M.STEP_STARTED:{let P=I.stepName,_=I.subagentRunId;return S(_).has(P)?be(()=>new Fe(`Step "${P}" is already active for 'STEP_STARTED'${_===void 0?"":` in subagent '${_}'`}`)):(S(_).set(P,!0),He(I))}case M.STEP_FINISHED:{let P=I.stepName,_=I.subagentRunId;if(!S(_).has(P)){let j,B=!1;for(let[U,V]of g)if(U!==_&&V.has(P)){j=U,B=!0;break}return be(B?()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${P}" attributed to ${_===void 0?"the parent agent":`subagent '${_}'`}: that step is open under ${j===void 0?"the parent agent":`subagent '${j}'`}. A step must be finished by whoever started it.`):()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${P}" that was not started`))}return S(_).delete(P),He(I)}case M.ACTIVITY_SNAPSHOT:{let P=I.messageId;return(!i.activity.has(P)||I.replace!==!1)&&i.activity.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.TOOL_CALL_RESULT:{let P=I.messageId;return typeof P=="string"&&i.message.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.REASONING_START:case M.REASONING_MESSAGE_START:{let P=I.messageId,_=i.reasoning.get(P);if(_){let j=O(k,I.subagentRunId,_,"reasoning message",P);if(j)return be(()=>j)}return a.add(P),_||i.reasoning.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:{let P=I.messageId,_=O(k,I.subagentRunId,i.reasoning.get(P),"reasoning message",P);return _?be(()=>_):(k===M.REASONING_END&&a.delete(P),He(I))}case M.REASONING_ENCRYPTED_VALUE:{let P=I.entityId,_=I.subtype,j=_==="tool-call"?i.toolCall.get(P):_==="message"?i.message.get(P)??i.reasoning.get(P):i.reasoning.get(P),B=_==="tool-call"?"tool call":_==="message"?"message":"reasoning message",U=O(k,I.subagentRunId,j,B,P);return U?be(()=>U):He(I)}case M.ACTIVITY_DELTA:{let P=I.messageId,_=O(k,I.subagentRunId,i.activity.get(P),"activity",P);return _?be(()=>_):He(I)}case M.SUBAGENT_STARTED:{if(typeof I.subagentRunId!="string")return be(()=>new Fe("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof I.name!="string")return be(()=>new Fe("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let P=I.subagentRunId,_=I.parentSubagentRunId;return h.has(P)?be(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': subagent '${P}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(P)?be(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': subagent '${P}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):_!==void 0&&!h.has(_)&&!y.has(_)?be(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${_}' has not been started in this run.`)):(h.set(P,!0),He(I))}case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{if(typeof I.subagentRunId!="string")return be(()=>new Fe(`Cannot send '${k}' without a 'subagentRunId'.`));if(k===M.SUBAGENT_ERROR&&typeof I.message!="string")return be(()=>new Fe("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let P=I.subagentRunId;return h.has(P)?(h.delete(P),y.add(P),He(I)):be(()=>new Fe(`Cannot send '${k}': no active subagent found with ID '${P}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case M.MESSAGES_SNAPSHOT:{let P=F(I.messages,!0);if(P)return be(()=>P)}return He(I);case M.RUN_STARTED:E=!0;{let P=F((I.input??{}).messages,!1);if(P)return be(()=>P)}return He(I);case M.RUN_FINISHED:if(C()){let P=[];for(let[j,B]of g)for(let U of B.keys())P.push(j===void 0?U:`${U} (subagent '${j}')`);let _=P.join(", ");return be(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${_}`))}if(n.size>0){let P=Array.from(n.keys()).join(", ");return be(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${P}`))}if(o.size>0){let P=Array.from(o.keys()).join(", ");return be(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${P}`))}if(h.size>0){let P=Array.from(h.keys()).join(", ");return be(()=>new Fe(`Cannot send 'RUN_FINISHED' while subagents are still active: ${P}`))}return p=!0,He(I);case M.RUN_ERROR:return m=!0,He(I);case M.CUSTOM:return He(I);case M.THINKING_TEXT_MESSAGE_START:return x?w?be(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(w=!0,He(I)):be(()=>new Fe("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 w?He(I):be(()=>new Fe("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 w?(w=!1,He(I)):be(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return x?be(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(x=!0,He(I));case M.THINKING_END:return x?(x=!1,He(I)):be(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return He(I)}}))},qa=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),nQ=e=>af(()=>_a(e())).pipe(ov(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return _a(t.text()).pipe(nr(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let p=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return p.status=t.status,p.payload=i,be(()=>p)}))}let r={type:qa.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new ct(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:qa.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):be(()=>Error("Failed to getReader() from response"))})),oQ=(e,t)=>{let r=yu(t),n=new un,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==qa.HEADERS&&p.type===qa.DATA&&p.data){let m=o.decode(p.data,{stream:!0});a+=m;let f=a.split(/\n\n/);a=f.pop()||"";for(let g of f)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let m=p.split(`
39
+ Error: ${w}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield ze(n,a,p,(y,x,w)=>y.onMessagesSnapshotEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messages:y}=S,x=y.map(I=>{if(I.subagentRunId!==null)return I;let O={...I};return delete O.subagentRunId,O}),w=new Map(x.map(I=>[I.id,I])),E=x.some(I=>I.role==="activity"),k=x.some(I=>I.role==="reasoning"),F=I=>I.role==="activity"&&!E||I.role==="reasoning"&&!k;a=a.filter(I=>F(I)||w.has(I.id)).map(I=>F(I)?I:w.get(I.id));let _=new Set(a.map(I=>I.id));for(let I of x)_.has(I.id)||a.push(I);f({messages:a})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=S,y=a.findIndex(F=>F.id===h.messageId),x=y>=0?a[y]:void 0,w=x?.role==="activity"?x:void 0,E=h.replace??!0,k=yield ze(n,a,p,(F,_,I)=>F.onActivitySnapshotEvent?.({event:h,messages:_,state:I,agent:r,input:e,activityMessage:w,existingMessage:x}));if(f(k),k.stopPropagation!==!0){let F={id:h.messageId,role:"activity",activityType:h.activityType,content:Be(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},_,I;y===-1?(a.push(F),_=F,I=F):w?(E&&(a[y]={...w,activityType:h.activityType,content:Be(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),I=a[y]):E&&(a[y]=F,_=F,I=F),fr(I,h),f({messages:a}),_&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:_,messages:a,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=S,y=a.findIndex(k=>k.id===h.messageId);if(y===-1)return g();let x=a[y];if(x.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=x,E=yield ze(n,a,p,(k,F,_)=>k.onActivityDeltaEvent?.({event:h,messages:F,state:_,agent:r,input:e,activityMessage:w}));if(f(E),E.stopPropagation!==!0)try{fr(w,h)&&f({messages:a});let k=Be(w.content??{}),F=_p.applyPatch(k,h.patch??[],!0,!1).newDocument;a[y]={...w,content:Be(F),activityType:h.activityType},f({messages:a})}catch(k){let F=k instanceof Error?k.message:String(k);console.warn(`Failed to apply activity patch for '${h.messageId}': ${F}`)}return g()}case M.RAW:return f(yield ze(n,a,p,(h,y,x)=>h.onRawEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.CUSTOM:return f(yield ze(n,a,p,(h,y,x)=>h.onCustomEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield ze(n,a,p,(y,x,w)=>y.onRunStartedEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let y=S;if(y.input?.messages){for(let x of y.input.messages){let w=x;if(x.subagentRunId===null){let E={...x};delete E.subagentRunId,w=E}a.find(E=>E.id===w.id)||a.push(w)}f({messages:a})}}return g()}case M.RUN_FINISHED:{let h=S,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},x=yield ze(n,a,p,(w,E,k)=>w.onRunFinishedEvent?.({...y,messages:E,state:k,agent:r,input:e}));return f(x),x.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(w=>{if(w.subagentRunId!==null)return w;let E={...w};return delete E.subagentRunId,E}):[]),g()}case M.RUN_ERROR:return f(yield ze(n,a,p,(h,y,x)=>h.onRunErrorEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.STEP_STARTED:return f(yield ze(n,a,p,(h,y,x)=>h.onStepStartedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.STEP_FINISHED:return f(yield ze(n,a,p,(h,y,x)=>h.onStepFinishedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed 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 f(yield ze(n,a,p,(h,y,x)=>h.onReasoningStartEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield ze(n,a,p,(y,x,w)=>y.onReasoningMessageStartEvent?.({event:S,messages:x,state:w,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:x}=S,w=a.find(F=>F.id===y),E=w;if(!E){let F={id:y,role:"reasoning",content:"",...(x!=null&&{subagentRunId:x})};a.push(F),E=F}let k=fr(E,S);(!w||k)&&f({messages:a})}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=S,x=a.find(E=>E.id===h);if(!x)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield ze(n,a,p,(E,k,F)=>E.onReasoningMessageContentEvent?.({event:S,messages:k,state:F,agent:r,input:e,reasoningMessageBuffer:typeof x.content=="string"?x.content:""}));return f(w),w.stopPropagation!==!0&&(x.content=`${typeof x.content=="string"?x.content:""}${y}`,fr(x,S),f({messages:a})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=S,y=a.find(w=>w.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let x=yield ze(n,a,p,(w,E,k)=>w.onReasoningMessageEndEvent?.({event:S,messages:E,state:k,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return f(x),x.stopPropagation!==!0&&fr(y,S)&&f({messages:a}),yield Promise.all(n.map(w=>{w.onNewMessage?.({message:y,messages:a,state:p,agent:r,input:e})})),g()}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return f(yield ze(n,a,p,(h,y,x)=>h.onReasoningEndEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:x}=S,w=yield ze(n,a,p,(E,k,F)=>E.onReasoningEncryptedValueEvent?.({event:S,messages:k,state:F,agent:r,input:e}));if(f(w),w.stopPropagation!==!0){let E=!1;if(h==="tool-call"){for(let k of a)if(k.role==="assistant"&&k.toolCalls){let F=k.toolCalls.find(_=>_.id===y);if(F){F.encryptedValue=x,E=!0;break}}}else{let k=a.find(F=>F.id===y);k?.role!=="activity"&&k&&(k.encryptedValue=x,E=!0)}E&&(m.messages=a)}return g()}case M.SUBAGENT_STARTED:return f(yield ze(n,a,p,(h,y,x)=>h.onSubagentStartedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.SUBAGENT_FINISHED:return f(yield ze(n,a,p,(h,y,x)=>h.onSubagentFinishedEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g();case M.SUBAGENT_ERROR:return f(yield ze(n,a,p,(h,y,x)=>h.onSubagentErrorEvent?.({event:S,messages:y,state:x,agent:r,input:e}))),g()}return S.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),rv(),n.length>0?ov({}):S=>S)},bv=e=>t=>{let r=mu(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},p=!1,m=!1,f=!1,g=new Map,S=I=>{let O=g.get(I);return O||(O=new Map,g.set(I,O)),O},b=()=>{for(let I of g.values())if(I.size>0)return!0;return!1},h=new Map,y=new Set,x=!1,w=!1,E=!1,k=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),y.clear(),x=!1,w=!1,p=!1,m=!1,E=!0},F=(I,O)=>{let P=I??[];if(Array.isArray(P))for(let T of P){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new Ee(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let V=T.role==="reasoning"?a.reasoning:T.role==="activity"?a.activity:a.message;(O||!V.has(T.id))&&V.set(T.id,{subagentRunId:T.subagentRunId});for(let G of T.toolCalls??[])G&&typeof G.id=="string"&&(O||!a.toolCall.has(G.id))&&a.toolCall.set(G.id,{subagentRunId:T.subagentRunId??void 0})}},_=(I,O,P,T,V)=>{if(O!==void 0&&P&&P.subagentRunId!==O)return new Ee(`Cannot send '${I}': subagentRunId '${O}' does not match the ${T} '${V}' opener's subagent '${P.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(nr(I=>{let O=I.type;if(r?.event("VERIFY","Event:",I,{type:I.type}),m&&O!==M.RUN_STARTED)return Ae(()=>new Ee(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(p&&O!==M.RUN_ERROR&&O!==M.RUN_STARTED)return Ae(()=>new Ee(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(f){if(O===M.RUN_STARTED){if(E&&!p&&!m)return Ae(()=>new Ee("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(p||m)&&k()}}else if(f=!0,O!==M.RUN_STARTED&&O!==M.RUN_ERROR)return Ae(()=>new Ee("First event must be 'RUN_STARTED'"));if(I.subagentRunId===null)return Ae(()=>new Ee(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===M.SUBAGENT_STARTED||O===M.SUBAGENT_FINISHED||O===M.SUBAGENT_ERROR){let P=O===M.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===M.SUBAGENT_FINISHED?["outcome"]:["code"];for(let V of P)if(I[V]===null)return Ae(()=>new Ee(`Cannot send '${O}' with '${V}: null'. The field is optional \u2014 omit it entirely.`));let T=I.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return Ae(()=>new Ee(`Cannot send '${O}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return Ae(()=>new Ee(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(T&&Array.isArray(T.interruptIds)&&T.interruptIds.some(V=>typeof V!="string"))return Ae(()=>new Ee(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===M.RUN_FINISHED){let P=I.outcome;if(P?.type==="interrupt"&&Array.isArray(P.interrupts)){for(let T of P.interrupts)if(T&&T.subagentRunId===null)return Ae(()=>new Ee(`Cannot send 'RUN_FINISHED' with an interrupt (id '${T.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case M.TEXT_MESSAGE_START:{let P=I.messageId;if(n.has(P))return Ae(()=>new Ee(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${P}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=a.message.get(P);if(T){let V=_(O,I.subagentRunId,T,"message",P);if(V)return Ae(()=>V)}return n.add(P),T||a.message.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.TEXT_MESSAGE_CONTENT:{let P=I.messageId;if(!n.has(P))return Ae(()=>new Ee(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${P}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=_(O,I.subagentRunId,a.message.get(P),"message",P);return T?Ae(()=>T):He(I)}case M.TEXT_MESSAGE_END:{let P=I.messageId;if(!n.has(P))return Ae(()=>new Ee(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${P}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=_(O,I.subagentRunId,a.message.get(P),"message",P);return T?Ae(()=>T):(n.delete(P),He(I))}case M.TOOL_CALL_START:{let P=I.toolCallId;if(o.has(P))return Ae(()=>new Ee(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${P}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=I.parentMessageId,V=I.subagentRunId,G;if(T!==void 0){let L=a.message.get(T);if(L){if(V!==void 0&&V!==L.subagentRunId)return Ae(()=>new Ee(`Cannot send 'TOOL_CALL_START': subagentRunId '${V}' does not match its parent message '${T}' owner '${L.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));G=L}}let j=a.toolCall.get(P);if(j){let L=_(O,V,j,"tool call",P);if(L)return Ae(()=>L);if(V===void 0&&G&&G.subagentRunId!==j.subagentRunId)return Ae(()=>new Ee(`Cannot send 'TOOL_CALL_START': tool call '${P}' is owned by '${j.subagentRunId??"(the parent agent)"}' but its parent message '${T}' is owned by '${G.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(P),j||a.toolCall.set(P,V===void 0?G??{subagentRunId:void 0}:{subagentRunId:V}),He(I)}case M.TOOL_CALL_ARGS:{let P=I.toolCallId;if(!o.has(P))return Ae(()=>new Ee(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${P}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=_(O,I.subagentRunId,a.toolCall.get(P),"tool call",P);return T?Ae(()=>T):He(I)}case M.TOOL_CALL_END:{let P=I.toolCallId;if(!o.has(P))return Ae(()=>new Ee(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${P}'. A 'TOOL_CALL_START' event must be sent first.`));let T=_(O,I.subagentRunId,a.toolCall.get(P),"tool call",P);return T?Ae(()=>T):(o.delete(P),He(I))}case M.STEP_STARTED:{let P=I.stepName,T=I.subagentRunId;return S(T).has(P)?Ae(()=>new Ee(`Step "${P}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(S(T).set(P,!0),He(I))}case M.STEP_FINISHED:{let P=I.stepName,T=I.subagentRunId;if(!S(T).has(P)){let V,G=!1;for(let[j,L]of g)if(j!==T&&L.has(P)){V=j,G=!0;break}return Ae(G?()=>new Ee(`Cannot send 'STEP_FINISHED' for step "${P}" attributed to ${T===void 0?"the parent agent":`subagent '${T}'`}: that step is open under ${V===void 0?"the parent agent":`subagent '${V}'`}. A step must be finished by whoever started it.`):()=>new Ee(`Cannot send 'STEP_FINISHED' for step "${P}" that was not started`))}return S(T).delete(P),He(I)}case M.ACTIVITY_SNAPSHOT:{let P=I.messageId;return(!a.activity.has(P)||I.replace!==!1)&&a.activity.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.TOOL_CALL_RESULT:{let P=I.messageId;return typeof P=="string"&&a.message.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.REASONING_START:case M.REASONING_MESSAGE_START:{let P=I.messageId,T=a.reasoning.get(P);if(T){let V=_(O,I.subagentRunId,T,"reasoning message",P);if(V)return Ae(()=>V)}return i.add(P),T||a.reasoning.set(P,{subagentRunId:I.subagentRunId}),He(I)}case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:{let P=I.messageId,T=_(O,I.subagentRunId,a.reasoning.get(P),"reasoning message",P);return T?Ae(()=>T):(O===M.REASONING_END&&i.delete(P),He(I))}case M.REASONING_ENCRYPTED_VALUE:{let P=I.entityId,T=I.subtype,V=T==="tool-call"?a.toolCall.get(P):T==="message"?a.message.get(P)??a.reasoning.get(P):a.reasoning.get(P),G=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",j=_(O,I.subagentRunId,V,G,P);return j?Ae(()=>j):He(I)}case M.ACTIVITY_DELTA:{let P=I.messageId,T=_(O,I.subagentRunId,a.activity.get(P),"activity",P);return T?Ae(()=>T):He(I)}case M.SUBAGENT_STARTED:{if(typeof I.subagentRunId!="string")return Ae(()=>new Ee("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof I.name!="string")return Ae(()=>new Ee("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let P=I.subagentRunId,T=I.parentSubagentRunId;return h.has(P)?Ae(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': subagent '${P}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(P)?Ae(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': subagent '${P}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!y.has(T)?Ae(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(P,!0),He(I))}case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{if(typeof I.subagentRunId!="string")return Ae(()=>new Ee(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===M.SUBAGENT_ERROR&&typeof I.message!="string")return Ae(()=>new Ee("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let P=I.subagentRunId;return h.has(P)?(h.delete(P),y.add(P),He(I)):Ae(()=>new Ee(`Cannot send '${O}': no active subagent found with ID '${P}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case M.MESSAGES_SNAPSHOT:{let P=F(I.messages,!0);if(P)return Ae(()=>P)}return He(I);case M.RUN_STARTED:E=!0;{let P=F((I.input??{}).messages,!1);if(P)return Ae(()=>P)}return He(I);case M.RUN_FINISHED:if(b()){let P=[];for(let[V,G]of g)for(let j of G.keys())P.push(V===void 0?j:`${j} (subagent '${V}')`);let T=P.join(", ");return Ae(()=>new Ee(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(n.size>0){let P=Array.from(n.keys()).join(", ");return Ae(()=>new Ee(`Cannot send 'RUN_FINISHED' while text messages are still active: ${P}`))}if(o.size>0){let P=Array.from(o.keys()).join(", ");return Ae(()=>new Ee(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${P}`))}if(h.size>0){let P=Array.from(h.keys()).join(", ");return Ae(()=>new Ee(`Cannot send 'RUN_FINISHED' while subagents are still active: ${P}`))}return p=!0,He(I);case M.RUN_ERROR:return m=!0,He(I);case M.CUSTOM:return He(I);case M.THINKING_TEXT_MESSAGE_START:return x?w?Ae(()=>new Ee("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(w=!0,He(I)):Ae(()=>new Ee("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 w?He(I):Ae(()=>new Ee("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 w?(w=!1,He(I)):Ae(()=>new Ee("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 x?Ae(()=>new Ee("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(x=!0,He(I));case M.THINKING_END:return x?(x=!1,He(I)):Ae(()=>new Ee("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return He(I)}}))},qi=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),oQ=e=>rf(()=>_i(e())).pipe(iv(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return _i(t.text()).pipe(nr(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let p=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return p.status=t.status,p.payload=a,Ae(()=>p)}))}let r={type:qi.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new st(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let p={type:qi.DATA,data:a};o.next(p)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):Ae(()=>Error("Failed to getReader() from response"))})),iQ=(e,t)=>{let r=mu(t),n=new cn,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:p=>{if(p.type!==qi.HEADERS&&p.type===qi.DATA&&p.data){let m=o.decode(p.data,{stream:!0});i+=m;let f=i.split(/\n\n/);i=f.pop()||"";for(let g of f)a(g)}},error:p=>n.error(p),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(p){let m=p.split(`
40
40
  `),f=[];for(let g of m)g.startsWith("data:")&&f.push(g.slice(5).replace(/^ /,""));if(f.length>0)try{let g=f.join(`
41
- `),S=JSON.parse(g);r?.event("SSE","Event received:",S,{type:S.type}),n.next(S)}catch(g){n.error(g)}}return n.asObservable()},aQ=e=>{let t=new un,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==qa.HEADERS&&o.type===qa.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,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 a=r.slice(4,o),i=lE(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},iQ=(e,t)=>{let r=yu(t),n=new un,o=new Gp,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===qa.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===yv?"protobuf":"sse"}),p===yv?aQ(o).subscribe({next:m=>n.next(m),error:m=>n.error(m),complete:()=>n.complete()}):oQ(o,r).subscribe({next:m=>{try{let f=Fp.parse(m);r?.event("HTTP","Event validated:",f,{type:f.type,valid:!0}),n.next(f)}catch(f){r?.event("HTTP","Event invalid:",{json:m,error:String(f)}),n.error(f)}},error:m=>{if(m?.name==="AbortError"){n.next({type:M.RUN_ERROR,message:m.message||"Request aborted",code:"abort",rawEvent:m}),n.complete();return}return n.error(m)},complete:()=>n.complete()})}else a||n.error(Error("No headers event received before data events"))},error:i=>{o.error(i),n.error(i)},complete:()=>{o.complete()}}),n.asObservable()},at=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),sQ=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),cQ=R.object({type:R.literal(at.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),uQ=R.object({type:R.literal(at.enum.TextMessageContent),messageId:R.string(),content:R.string()}),lQ=R.object({type:R.literal(at.enum.TextMessageEnd),messageId:R.string()}),dQ=R.object({type:R.literal(at.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),pQ=R.object({type:R.literal(at.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),fQ=R.object({type:R.literal(at.enum.ActionExecutionEnd),actionExecutionId:R.string()}),mQ=R.object({type:R.literal(at.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),gQ=R.object({type:R.literal(at.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),hQ=R.object({type:R.literal(at.enum.MetaEvent),name:sQ,value:R.any()}),yQ=R.object({type:R.literal(at.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[cQ,uQ,lQ,dQ,pQ,fQ,mQ,gQ,hQ,yQ]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var SQ=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
- `)},vQ=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",m=null,f=null,g=[],S={},C=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(nr(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let y=h;return[{type:at.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:at.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=h;return[{type:at.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:""}}),i=!0,S[y.toolCallId]=y.toolCallName,[{type:at.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=h,x=g.find(E=>E.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let w=!1;if(f){let E=f.find(T=>T.tool==x.function.name);if(E)try{let T=JSON.parse(lf(x.function.arguments));E.tool_argument&&E.tool_argument in T?(C({...o,[E.state_key]:T[E.tool_argument]}),w=!0):E.tool_argument||(C({...o,[E.state_key]:T}),w=!0)}catch{}}return[{type:at.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case M.TOOL_CALL_END:{let y=h;return[{type:at.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=h;return[{type:at.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:S[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=h;switch(y.name){case"Exit":a=!1;break;case"PredictState":f=y.value;break}return[{type:at.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return C(h.snapshot),[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case M.STATE_DELTA:{let y=h,x=qp.applyPatch(o,y.delta,!0,!1);return x?(C(x.newDocument),[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case M.MESSAGES_SNAPSHOT:return m=h.messages,[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(m?{messages:m}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return m&&(o.messages=m),Object.keys(o).length===0?[]:[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(m?{messages:AQ(m)}:{})}),active:!1}];case M.RUN_ERROR:{let y=h;return[{type:at.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return p=h.stepName,g=[],f=null,[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return g=[],f=null,[{type:at.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function AQ(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=SQ(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 a={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(a)}}else if(r.role==="tool"){let n="unknown";for(let a of e)if(a.role==="assistant"&&a.toolCalls?.length){for(let i of a.toolCalls)if(i.id===r.toolCallId){n=i.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var bQ=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,CQ=e=>e==="tool"?"toolCallId":"messageId",gs=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Wf=e=>t=>{let r=yu(e),n=new Map,o=m=>{let f=n.get(m);if(!f)return[];switch(n.delete(m),f.kind){case"text":{let g={type:M.TEXT_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:M.TOOL_CALL_END,toolCallId:f.fields.toolCallId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:M.REASONING_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},a=()=>[...n.keys()].flatMap(m=>o(m)),i=(m,f)=>{for(let[g,S]of n)if(S.kind===m&&bQ(S)===f)return{owner:g}},p=(m,f,g,S,C)=>{if(f!==void 0){let y=i(m,f);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${C} '${f}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===m)return;let h=[...n.entries()].filter(([,y])=>y.kind===m);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${S}: it carries neither a ${CQ(m)} nor a subagentRunId, but ${h.length} lanes have an open ${C}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(nr(m=>{switch(m.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.CUSTOM: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[...o(m.subagentRunId??void 0),m];case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.MESSAGES_SNAPSHOT:return[...a(),m];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:case M.SUBAGENT_STARTED:return[m];case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{let f=m.subagentRunId;return f==null?[m]:[...o(f),m]}case M.TEXT_MESSAGE_CHUNK:{let f=m,g=p("text",f.messageId,f.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),S=n.get(g),C=[],h;if(S?.kind==="text"&&(f.messageId===void 0||f.messageId===S.fields.messageId))h=S.fields;else{if(C.push(...o(g)),f.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,name:f.name,subagentRunId:f.subagentRunId},n.set(g,{kind:"text",fields:h});let y=gs({type:M.TEXT_MESSAGE_START,messageId:f.messageId,role:f.role||"assistant",...(f.name!==void 0&&{name:f.name}),...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:f.messageId})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);C.push(x),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",x,{messageId:h.messageId})}if(C.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;C.push({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return C}case M.TOOL_CALL_CHUNK:{let f=m,g=p("tool",f.toolCallId,f.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),S=n.get(g),C=[],h;if(S?.kind==="tool"&&(f.toolCallId===void 0||f.toolCallId===S.fields.toolCallId))h=S.fields;else{if(C.push(...o(g)),f.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(f.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=gs({type:M.TOOL_CALL_START,toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:f.toolCallId,toolCallName:f.toolCallName})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);C.push(x),r?.event("TRANSFORM","TOOL_CALL_ARGS",x,{toolCallId:h.toolCallId})}if(C.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;C.push({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return C}case M.REASONING_MESSAGE_CHUNK:{let f=m,g=p("reasoning",f.messageId,f.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),S=n.get(g),C=[],h;if(S?.kind==="reasoning"&&(f.messageId===void 0||f.messageId===S.fields.messageId))h=S.fields;else{if(C.push(...o(g)),f.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=gs({type:M.REASONING_MESSAGE_START,messageId:f.messageId,role:"reasoning",...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:f.messageId})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);C.push(x),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",x,{messageId:h.messageId})}if(C.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;C.push({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return C}}return m.type,[]}),Na(()=>{a()}))};function xQ(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Su=class{runNext(e,t){return t.run(e).pipe(Wf(!1))}runNextWithState(e,t){let r=Be(e.messages||[]),n=Be(e.state||{}),o=new Gp;return RE(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(sf(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Be(r),state:Be(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},RQ=class extends Su{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function wQ(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 IQ=class extends Su{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(wQ)};return this.runNext(o,t)}},gE="THINKING_START",hE="THINKING_END",yE="THINKING_TEXT_MESSAGE_START",SE="THINKING_TEXT_MESSAGE_CONTENT",vE="THINKING_TEXT_MESSAGE_END",EQ=class extends Su{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(vo(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case gE:{this.currentReasoningId=hu();let{title:t,...r}=e;return this.warnAboutTransformation(gE,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case yE:return this.currentMessageId=hu(),this.warnAboutTransformation(yE,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case SE:{let{delta:t,...r}=e;return this.warnAboutTransformation(SE,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??hu(),delta:t}}case vE:{let t=this.currentMessageId??hu();return this.warnAboutTransformation(vE,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case hE:{let t=this.currentReasoningId??hu();return this.warnAboutTransformation(hE,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function FQ(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function TQ(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function PQ(e){let t=FQ(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 kQ(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>TQ(n)?PQ(n):n);return{...e,content:r}}var OQ=class extends Su{run(e,t){let r={...e,messages:e.messages.map(kQ)};return this.runNext(r,t)}},AE="SUBAGENT_STARTED",bE="SUBAGENT_FINISHED",CE="SUBAGENT_ERROR";function Yf(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function xE(e){return e.map(t=>Yf(t))}var _Q=class extends Su{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>Yf(n))};return this.runNext(r,t).pipe(uf(n=>{let o=n.type;(o===AE||o===bE||o===CE)&&this.warnDroppedLifecycleEvent(o)}),rv(n=>{let o=n.type;return o!==AE&&o!==bE&&o!==CE}),vo(n=>{let o=Yf(n);if(o.type===M.MESSAGES_SNAPSHOT){let a=o;if(Array.isArray(a.messages))return{...a,messages:xE(a.messages)}}if(o.type===M.RUN_FINISHED){let a=o;if(a.outcome&&Array.isArray(a.outcome.interrupts))return{...a,outcome:{...a.outcome,interrupts:a.outcome.interrupts.map(i=>Yf(i))}}}if(o.type===M.RUN_STARTED){let a=o;if(a.input&&Array.isArray(a.input.messages))return{...a,input:{...a.input,messages:xE(a.input.messages)}}}return o}))}},NQ="0.0.59",DQ=class{get maxVersion(){return NQ}get debug(){return this._debug}set debug(e){this._debug=zf(e),this._debugLogger=Av(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Av(zf(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??mo(),this.messages=Be(n??[]),this.state=Be(o??{}),this._debug=zf(a),this._debugLogger=Av(this._debug),ms(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new IQ),ms(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new EQ),ms(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new OQ),ms(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new _Q)}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 RQ(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??mo();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(m=>m.id)),a=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,a),_this35.activeRunDetach$=new un;let i;_this35.activeRunCompletionPromise=new Promise(m=>{i=m}),yield of(Bp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((m,f)=>({run:g=>f.run(g,m),get messages(){return m.messages},get state(){return m.state}}),_this35).run(r),Wf(_this35.debugLogger),bv(_this35.debugLogger),m=>m.pipe(cf(_this35.activeRunDetach$)),m=>_this35.apply(r,m,a),m=>_this35.processApplyEvents(r,m,a),fu(m=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:m instanceof Error?m.message:String(m)}),_this35.isRunning=!1,_this35.onError(r,m,a))),Na(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,a),i?.(),i=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(He(null)));let p=Be(_this35.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new QS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??mo();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(m=>m.id)),a=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,a),_this36.activeRunDetach$=new un;let i;_this36.activeRunCompletionPromise=new Promise(m=>{i=m}),yield of(Bp(()=>af(()=>_this36.connect(r)),Wf(_this36.debugLogger),bv(_this36.debugLogger),m=>m.pipe(cf(_this36.activeRunDetach$)),m=>_this36.apply(r,m,a),m=>_this36.processApplyEvents(r,m,a),fu(m=>(_this36.isRunning=!1,m instanceof QS?$p:_this36.onError(r,m,a))),Na(()=>{_this36.isRunning=!1,_this36.onFinalize(r,a),i?.(),i=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(He(null)),{defaultValue:void 0});let p=Be(_this36.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return RE(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(uf(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=Be(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||mo(),tools:Be(e?.tools??[]),context:Be(e?.context??[]),forwardedProps:Be(e?.forwardedProps??{}),state:Be(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Be(e.resume)})}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){if(_this38.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=_this38.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new Fe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this38.pendingInterrupts)if(xQ(a))throw new Fe(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield ze(t,_this38.messages,_this38.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this38,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this38.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})}r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})}))}})()}onError(e,t,r){return _a(ze(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(vo(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(a=>{a.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(a=>{a.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let a=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||a==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield ze(t,_this39.messages,_this39.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Be(this.messages),e.state=Be(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Be(this.pendingInterrupts),e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Be(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Be(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??mo();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(Wf(this.debugLogger),bv(this.debugLogger),vQ(this.threadId,t.runId,this.agentId),r=>r.pipe(vo(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function qQ(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var wE=class extends DQ{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(qQ(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Be(e.headers??{}),this.fetch=e.fetch??((t,r)=>A(t,r))}run(e){return iQ(nQ(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Be(this.headers??{}),e.fetch=this.fetch;let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var IE=(e,t,r)=>{let n=gt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let a=`/api/v1/organizations/${t}/agents`;return`${n}${a}/${o}`};var Rv=class extends wE{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},a={...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(a),signal:this.abortController.signal}}},EE=(e,t,r)=>new Rv({url:`${IE(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var MQ=new $({required:!0}),FE=new $({required:!0,constrainTo:Yd}),TE=e=>({...e,name:Kd(e.name)}),PE=N("followUpAnswers/setIsEnabled",e=>q(e,new pe({required:!0}))),kE=N("followUpAnswers/setFollowUpAnswersConversationId",e=>q(e,H)),OE=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>q(e,H)),_E=N("followUpAnswers/clearFollowUpAnswersConversationToken"),jxe=N("followUpAnswers/createFollowUpAnswer",e=>q(e,{question:H})),Lxe=N("followUpAnswers/setActiveFollowUpAnswerId",e=>q(e,H)),Uxe=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>q(e,{contentFormat:Zd,answerId:H})),Qxe=N("followUpAnswers/setFollowUpIsLoading",e=>q(e,{isLoading:new pe({required:!0}),answerId:H})),Bxe=N("followUpAnswers/setFollowUpIsStreaming",e=>q(e,{isStreaming:new pe({required:!0}),answerId:H})),Gxe=N("followUpAnswers/followUpMessageChunkReceived",e=>q(e,{textDelta:MQ,answerId:H})),$xe=N("followUpAnswers/followUpCitationsReceived",e=>q(e,{citations:new ae({required:!0,each:new Y({values:TS})}),answerId:H})),Hxe=N("followUpAnswers/followUpCompleted",e=>q(e,{answerId:H,cannotAnswer:new pe({required:!1})})),zxe=N("followUpAnswers/followUpFailed",e=>q(e,{message:new $,code:new oe({min:0}),answerId:H})),Wxe=N("followUpAnswers/activeFollowUpStartFailed",e=>q(e,{message:new $})),Yxe=N("followUpAnswers/likeFollowUp",e=>q(e,{answerId:H})),Kxe=N("followUpAnswers/dislikeFollowUp",e=>q(e,{answerId:H})),Xxe=N("followUpAnswers/submitFollowUpFeedback",e=>q(e,{answerId:H})),NE=N("followUpAnswers/resetFollowUpAnswers"),Zxe=N("followUpAnswers/stepStarted",e=>q(TE(e),{answerId:H,name:FE,startedAt:new oe({min:0,required:!0})})),Jxe=N("followUpAnswers/stepFinished",e=>q(TE(e),{answerId:H,name:FE,finishedAt:new oe({min:0,required:!0})})),eRe=N("followUpAnswers/startToolCall",e=>q(e,{answerId:H,toolCallName:H,startedAt:new oe({min:0,required:!0}),toolCallId:H})),tRe=N("followUpAnswers/finishToolCall",e=>q(e,{answerId:H,finishedAt:new oe({min:0,required:!0}),toolCallId:H})),rRe=N("followUpAnswers/toolCallArgs",e=>q(e,{answerId:H,toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:Xd})}));d();c();l();u();var VQ={"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 DE(e){return e?VQ[e]??1004:1004}function jQ(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function Kf(e){if(e)return jQ({...e})}var qE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e($i(n.runId)),e(rn(!1)),e(ia(!0)),e(kE(n.threadId)),e(_E())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(cp({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(up({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:a,toolCallId:i,timestamp:p}=n;e(lp({toolCallId:i,toolCallName:a,startedAt:p??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,timestamp:i}=n;e(dp({toolCallId:a,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,delta:i}=n;try{let p=JSON.parse(i);typeof p?.q=="string"?e(Yi({toolCallId:a,args:p,type:"search"})):e(Yi({toolCallId:a,args:{raw:i},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${i}`),e(Yi({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(sa({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:a,value:i}=n;switch(a){case"header":{i?.contentFormat&&e(la(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(PE(i.followUpEnabled)),i?.conversationToken&&e(OE(i.conversationToken));return}case"citations":{e(ca({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=DE(n.code);e(ua({message:n.message,code:a}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=n.result?.completionReason==="ANSWERED",i=a?!r:void 0;e(nu(a)),e(da(!a)),e(ia(!1)),e(Qy(a,t,i)),e(Fi())}}};var ME=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,a){t();let i=Kl(n),p=nx(n),m=ox(n),f=rx(n),g=ax(n),S=EE(i,p,m);e=S;let C=qE(o),h=ow(n,a());try{o(rn(!0)),yield S.runAgent({forwardedProps:{params:h,accessToken:f,recordDebugSession:g}},C)}catch(y){o(rn(!1)),o(ua({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var VE=e=>{let t=sC({extra:e}),r=ME();return t.startListening({actionCreator:qe.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let a=o.getState();if(!Ny(a)||(r.abortRun(),o.dispatch(dr()),o.dispatch(NE()),a.generatedAnswer.isEnabled===!1))return;let i=aa(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var jE=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)},LE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var wv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:a}};d();c();l();u();function UE(e,t){let r={...e},n,o=a=>(i,p)=>{let m=a(i,p);return n?n(m,p):m};return{get combinedReducer(){let a=xA(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(oi({...a,...r}))},containsAll(a){return Object.keys(a).every(p=>p in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}d();c();l();u();d();c();l();u();function LQ(e){if(!e||!UQ(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(a=>`%${`00${a.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function QE(e,t=60){if(!e)return!1;let r=LQ(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function UQ(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function GE(e,t){let r=0,n=null,o=Ku(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(S,C=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!C)throw x;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&S.dispatch(Ii({accessToken:y})),y});return function a(_x208){return _ref85.apply(this,arguments)}}(),i=S=>{let C=GQ(S.getState());return!!C&&QE(C)},p=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(S){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(S))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(C){e.warn(C,"Access token renewal failed. A retry will occur if necessary.")}});return function p(_x209){return _ref87.apply(this,arguments)}}(),m=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(S,C,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),BE(S,C.error),C;!n&&(r++,o());try{yield a(S,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}S.dispatch(h)});return function m(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}(),f=(S,C,h)=>BQ(h)?t?m(S,h,C):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),BE(S,h.error),h):h,g=(S,C,h)=>QQ(h)?Promise.resolve(h).then(y=>f(S,C,y)):f(S,C,h);return S=>C=>h=>{if(!(typeof h=="function"))return C(h);let x=()=>g(S,h,C(h));return typeof t=="function"&&i(S)?p(S).then(x):x()}}function QQ(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BQ(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new ei().name}function BE(e,t){e.dispatch(ji({status:401,statusCode:401,message:t.message,type:t.name}))}function GQ(e){return e.configuration.accessToken}d();c();l();u();function $E({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return zb({reducer:e,preloadedState:t,devTools:{stateSanitizer:a=>a.history?{...a,history:"<<OMIT>>"}:a,name:o,shouldHotReload:!1},middleware:a=>a({thunk:{extraArgument:n}}).prepend(...r).concat(LE(n.logger))})}function $Q(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...a}=r??{},i={...a,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=i.analyticsMode!=="next",m=i.analyticsMode==="legacy"&&o===!0;return p&&ah()&&!m?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):(p&&ah()&&m&&i.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),i)}function HE(e,t){let r={...e.reducers,configuration:we,version:pw},n=HQ({...e,reducers:r},t,we),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(Ii({accessToken:o,environment:a,organizationId:i}));let p=$Q(e.configuration,n.logger);return p&&n.dispatch(ad(p)),n}function HQ(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=UE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return Mc(f.state,o)},get navigatorContext(){return wv(this.relay,o)}},m=zQ(e,p,a),f={addReducers(g){a.containsAll(g)||(a.add(g),m.replaceReducer(a.combinedReducer))},dispatch:m.dispatch,subscribe:m.subscribe,enableAnalytics(){m.dispatch(sd())},disableAnalytics(){m.dispatch(id())},get state(){return m.getState()},get relay(){return Mc(this.state,o)},get navigatorContext(){return wv(this.relay,o)},logger:i,store:m};return f}function zQ(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=WQ(e,t.logger,()=>t.navigatorContext);return $E({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function WQ(e,t,r){let{renewAccessToken:n}=e.configuration,o=GE(t,n),a=VE({getNavigatorContext:r});return[bw,o,jE(t),mw].concat(pa.middleware,a.middleware,e.middlewares||[])}var YQ=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
41
+ `),S=JSON.parse(g);r?.event("SSE","Event received:",S,{type:S.type}),n.next(S)}catch(g){n.error(g)}}return n.asObservable()},aQ=e=>{let t=new cn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==qi.HEADERS&&o.type===qi.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=pE(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()},sQ=(e,t)=>{let r=mu(t),n=new cn,o=new Up,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===qi.HEADERS&&!i){i=!0;let p=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===Sv?"protobuf":"sse"}),p===Sv?aQ(o).subscribe({next:m=>n.next(m),error:m=>n.error(m),complete:()=>n.complete()}):iQ(o,r).subscribe({next:m=>{try{let f=wp.parse(m);r?.event("HTTP","Event validated:",f,{type:f.type,valid:!0}),n.next(f)}catch(f){r?.event("HTTP","Event invalid:",{json:m,error:String(f)}),n.error(f)}},error:m=>{if(m?.name==="AbortError"){n.next({type:M.RUN_ERROR,message:m.message||"Request aborted",code:"abort",rawEvent:m}),n.complete();return}return n.error(m)},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()},it=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),cQ=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),uQ=R.object({type:R.literal(it.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),lQ=R.object({type:R.literal(it.enum.TextMessageContent),messageId:R.string(),content:R.string()}),dQ=R.object({type:R.literal(it.enum.TextMessageEnd),messageId:R.string()}),pQ=R.object({type:R.literal(it.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),fQ=R.object({type:R.literal(it.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),mQ=R.object({type:R.literal(it.enum.ActionExecutionEnd),actionExecutionId:R.string()}),gQ=R.object({type:R.literal(it.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),hQ=R.object({type:R.literal(it.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),yQ=R.object({type:R.literal(it.enum.MetaEvent),name:cQ,value:R.any()}),SQ=R.object({type:R.literal(it.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[uQ,lQ,dQ,pQ,fQ,mQ,gQ,hQ,yQ,SQ]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var vQ=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
+ `)},AQ=(e,t,r)=>n=>{let o={},i=!0,a=!0,p="",m=null,f=null,g=[],S={},b=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(nr(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let y=h;return[{type:it.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:it.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=h;return[{type:it.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,S[y.toolCallId]=y.toolCallName,[{type:it.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=h,x=g.find(E=>E.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let w=!1;if(f){let E=f.find(k=>k.tool==x.function.name);if(E)try{let k=JSON.parse(sf(x.function.arguments));E.tool_argument&&E.tool_argument in k?(b({...o,[E.state_key]:k[E.tool_argument]}),w=!0):E.tool_argument||(b({...o,[E.state_key]:k}),w=!0)}catch{}}return[{type:it.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case M.TOOL_CALL_END:{let y=h;return[{type:it.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=h;return[{type:it.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:S[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":f=y.value;break}return[{type:it.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return b(h.snapshot),[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case M.STATE_DELTA:{let y=h,x=_p.applyPatch(o,y.delta,!0,!1);return x?(b(x.newDocument),[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case M.MESSAGES_SNAPSHOT:return m=h.messages,[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(m?{messages:m}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return m&&(o.messages=m),Object.keys(o).length===0?[]:[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(m?{messages:CQ(m)}:{})}),active:!1}];case M.RUN_ERROR:{let y=h;return[{type:it.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return p=h.stepName,g=[],f=null,[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return g=[],f=null,[{type:it.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function CQ(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=vQ(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 bQ=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,xQ=e=>e==="tool"?"toolCallId":"messageId",gs=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},$f=e=>t=>{let r=mu(e),n=new Map,o=m=>{let f=n.get(m);if(!f)return[];switch(n.delete(m),f.kind){case"text":{let g={type:M.TEXT_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:M.TOOL_CALL_END,toolCallId:f.fields.toolCallId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:M.REASONING_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(m=>o(m)),a=(m,f)=>{for(let[g,S]of n)if(S.kind===m&&bQ(S)===f)return{owner:g}},p=(m,f,g,S,b)=>{if(f!==void 0){let y=a(m,f);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${b} '${f}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===m)return;let h=[...n.entries()].filter(([,y])=>y.kind===m);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${S}: it carries neither a ${xQ(m)} nor a subagentRunId, but ${h.length} lanes have an open ${b}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(nr(m=>{switch(m.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.CUSTOM: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[...o(m.subagentRunId??void 0),m];case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.MESSAGES_SNAPSHOT:return[...i(),m];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:case M.SUBAGENT_STARTED:return[m];case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{let f=m.subagentRunId;return f==null?[m]:[...o(f),m]}case M.TEXT_MESSAGE_CHUNK:{let f=m,g=p("text",f.messageId,f.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),S=n.get(g),b=[],h;if(S?.kind==="text"&&(f.messageId===void 0||f.messageId===S.fields.messageId))h=S.fields;else{if(b.push(...o(g)),f.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,name:f.name,subagentRunId:f.subagentRunId},n.set(g,{kind:"text",fields:h});let y=gs({type:M.TEXT_MESSAGE_START,messageId:f.messageId,role:f.role||"assistant",...(f.name!==void 0&&{name:f.name}),...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);b.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:f.messageId})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);b.push(x),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",x,{messageId:h.messageId})}if(b.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;b.push({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return b}case M.TOOL_CALL_CHUNK:{let f=m,g=p("tool",f.toolCallId,f.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),S=n.get(g),b=[],h;if(S?.kind==="tool"&&(f.toolCallId===void 0||f.toolCallId===S.fields.toolCallId))h=S.fields;else{if(b.push(...o(g)),f.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(f.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=gs({type:M.TOOL_CALL_START,toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);b.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:f.toolCallId,toolCallName:f.toolCallName})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);b.push(x),r?.event("TRANSFORM","TOOL_CALL_ARGS",x,{toolCallId:h.toolCallId})}if(b.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;b.push({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return b}case M.REASONING_MESSAGE_CHUNK:{let f=m,g=p("reasoning",f.messageId,f.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),S=n.get(g),b=[],h;if(S?.kind==="reasoning"&&(f.messageId===void 0||f.messageId===S.fields.messageId))h=S.fields;else{if(b.push(...o(g)),f.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=gs({type:M.REASONING_MESSAGE_START,messageId:f.messageId,role:"reasoning",...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);b.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:f.messageId})}if(f.delta!==void 0){let y=f.subagentRunId??h.subagentRunId,x=gs({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(y!=null&&{subagentRunId:y})},f);b.push(x),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",x,{messageId:h.messageId})}if(b.length===0&&f.metadata!==void 0){let y=f.subagentRunId??h.subagentRunId;b.push({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(y!=null&&{subagentRunId:y})})}return b}}return m.type,[]}),Ni(()=>{i()}))};function RQ(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var gu=class{runNext(e,t){return t.run(e).pipe($f(!1))}runNextWithState(e,t){let r=Be(e.messages||[]),n=Be(e.state||{}),o=new Up;return IE(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(nf(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Be(r),state:Be(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},wQ=class extends gu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function IQ(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 EQ=class extends gu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(IQ)};return this.runNext(o,t)}},yE="THINKING_START",SE="THINKING_END",vE="THINKING_TEXT_MESSAGE_START",AE="THINKING_TEXT_MESSAGE_CONTENT",CE="THINKING_TEXT_MESSAGE_END",FQ=class extends gu{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(So(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case yE:{this.currentReasoningId=fu();let{title:t,...r}=e;return this.warnAboutTransformation(yE,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case vE:return this.currentMessageId=fu(),this.warnAboutTransformation(vE,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case AE:{let{delta:t,...r}=e;return this.warnAboutTransformation(AE,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??fu(),delta:t}}case CE:{let t=this.currentMessageId??fu();return this.warnAboutTransformation(CE,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case SE:{let t=this.currentReasoningId??fu();return this.warnAboutTransformation(SE,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function TQ(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function PQ(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function kQ(e){let t=TQ(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 OQ(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>PQ(n)?kQ(n):n);return{...e,content:r}}var _Q=class extends gu{run(e,t){let r={...e,messages:e.messages.map(OQ)};return this.runNext(r,t)}},bE="SUBAGENT_STARTED",xE="SUBAGENT_FINISHED",RE="SUBAGENT_ERROR";function Hf(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function wE(e){return e.map(t=>Hf(t))}var NQ=class extends gu{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>Hf(n))};return this.runNext(r,t).pipe(af(n=>{let o=n.type;(o===bE||o===xE||o===RE)&&this.warnDroppedLifecycleEvent(o)}),nv(n=>{let o=n.type;return o!==bE&&o!==xE&&o!==RE}),So(n=>{let o=Hf(n);if(o.type===M.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:wE(i.messages)}}if(o.type===M.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>Hf(a))}}}if(o.type===M.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:wE(i.input.messages)}}}return o}))}},DQ="0.0.59",qQ=class{get maxVersion(){return DQ}get debug(){return this._debug}set debug(e){this._debug=Gf(e),this._debugLogger=Cv(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Cv(Gf(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??fo(),this.messages=Be(n??[]),this.state=Be(o??{}),this._debug=Gf(i),this._debugLogger=Cv(this._debug),ms(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new EQ),ms(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new FQ),ms(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new _Q),ms(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new NQ)}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 wQ(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??fo();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(m=>m.id)),i=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,i),_this35.activeRunDetach$=new cn;let a;_this35.activeRunCompletionPromise=new Promise(m=>{a=m}),yield tf(Lp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((m,f)=>({run:g=>f.run(g,m),get messages(){return m.messages},get state(){return m.state}}),_this35).run(r),$f(_this35.debugLogger),bv(_this35.debugLogger),m=>m.pipe(of(_this35.activeRunDetach$)),m=>_this35.apply(r,m,i),m=>_this35.processApplyEvents(r,m,i),lu(m=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:m instanceof Error?m.message:String(m)}),_this35.isRunning=!1,_this35.onError(r,m,i))),Ni(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,i),a?.(),a=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(He(null)));let p=Be(_this35.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new BS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??fo();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(m=>m.id)),i=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,i),_this36.activeRunDetach$=new cn;let a;_this36.activeRunCompletionPromise=new Promise(m=>{a=m}),yield tf(Lp(()=>rf(()=>_this36.connect(r)),$f(_this36.debugLogger),bv(_this36.debugLogger),m=>m.pipe(of(_this36.activeRunDetach$)),m=>_this36.apply(r,m,i),m=>_this36.processApplyEvents(r,m,i),lu(m=>(_this36.isRunning=!1,m instanceof BS?Qp:_this36.onError(r,m,i))),Ni(()=>{_this36.isRunning=!1,_this36.onFinalize(r,i),a?.(),a=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(He(null)),{defaultValue:void 0});let p=Be(_this36.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return IE(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(af(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=Be(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||fo(),tools:Be(e?.tools??[]),context:Be(e?.context??[]),forwardedProps:Be(e?.forwardedProps??{}),state:Be(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Be(e.resume)})}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){if(_this38.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this38.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new Ee(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this38.pendingInterrupts)if(RQ(i))throw new Ee(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield ze(t,_this38.messages,_this38.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this38,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this38.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})}r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})}))}})()}onError(e,t,r){return _i(ze(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(So(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 _this39=this;return _asyncToGenerator(function*(){let r=yield ze(t,_this39.messages,_this39.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Be(this.messages),e.state=Be(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Be(this.pendingInterrupts),e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Be(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Be(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??fo();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($f(this.debugLogger),bv(this.debugLogger),AQ(this.threadId,t.runId,this.agentId),r=>r.pipe(So(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function MQ(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var EE=class extends qQ{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(MQ(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Be(e.headers??{}),this.fetch=e.fetch??((t,r)=>A(t,r))}run(e){return sQ(oQ(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Be(this.headers??{}),e.fetch=this.fetch;let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var FE=(e,t,r)=>{let n=gt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${n}${i}/${o}`};var wv=class extends EE{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}}},TE=(e,t,r)=>new wv({url:`${FE(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var VQ=new B({required:!0}),PE=new B({required:!0,constrainTo:Hd}),kE=e=>({...e,name:zd(e.name)}),OE=N("followUpAnswers/setIsEnabled",e=>q(e,new de({required:!0}))),_E=N("followUpAnswers/setFollowUpAnswersConversationId",e=>q(e,H)),NE=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>q(e,H)),DE=N("followUpAnswers/clearFollowUpAnswersConversationToken"),Nxe=N("followUpAnswers/createFollowUpAnswer",e=>q(e,{question:H})),Dxe=N("followUpAnswers/setActiveFollowUpAnswerId",e=>q(e,H)),qxe=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>q(e,{contentFormat:Yd,answerId:H})),Mxe=N("followUpAnswers/setFollowUpIsLoading",e=>q(e,{isLoading:new de({required:!0}),answerId:H})),Vxe=N("followUpAnswers/setFollowUpIsStreaming",e=>q(e,{isStreaming:new de({required:!0}),answerId:H})),jxe=N("followUpAnswers/followUpMessageChunkReceived",e=>q(e,{textDelta:VQ,answerId:H})),Lxe=N("followUpAnswers/followUpCitationsReceived",e=>q(e,{citations:new ie({required:!0,each:new W({values:PS})}),answerId:H})),Uxe=N("followUpAnswers/followUpCompleted",e=>q(e,{answerId:H,cannotAnswer:new de({required:!1})})),Qxe=N("followUpAnswers/followUpFailed",e=>q(e,{message:new B,code:new oe({min:0}),answerId:H})),Bxe=N("followUpAnswers/activeFollowUpStartFailed",e=>q(e,{message:new B})),Gxe=N("followUpAnswers/likeFollowUp",e=>q(e,{answerId:H})),$xe=N("followUpAnswers/dislikeFollowUp",e=>q(e,{answerId:H})),Hxe=N("followUpAnswers/submitFollowUpFeedback",e=>q(e,{answerId:H})),qE=N("followUpAnswers/resetFollowUpAnswers"),zxe=N("followUpAnswers/stepStarted",e=>q(kE(e),{answerId:H,name:PE,startedAt:new oe({min:0,required:!0})})),Wxe=N("followUpAnswers/stepFinished",e=>q(kE(e),{answerId:H,name:PE,finishedAt:new oe({min:0,required:!0})})),Yxe=N("followUpAnswers/startToolCall",e=>q(e,{answerId:H,toolCallName:H,startedAt:new oe({min:0,required:!0}),toolCallId:H})),Kxe=N("followUpAnswers/finishToolCall",e=>q(e,{answerId:H,finishedAt:new oe({min:0,required:!0}),toolCallId:H})),Xxe=N("followUpAnswers/toolCallArgs",e=>q(e,{answerId:H,toolCallId:H,args:new W({options:{required:!0}}),type:new B({required:!0,constrainTo:Wd})}));d();c();l();u();var jQ={"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 ME(e){return e?jQ[e]??1004:1004}function LQ(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function zf(e){if(e)return LQ({...e})}var VE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e($a(n.runId)),e(tn(!1)),e(ai(!0)),e(_E(n.threadId)),e(DE())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ip({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ap({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:p}=n;e(sp({toolCallId:a,toolCallName:i,startedAt:p??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(cp({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let p=JSON.parse(a);typeof p?.q=="string"?e(Ya({toolCallId:i,args:p,type:"search"})):e(Ya({toolCallId:i,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(Ya({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(si({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:a}=n;switch(i){case"header":{a?.contentFormat&&e(li(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(OE(a.followUpEnabled)),a?.conversationToken&&e(NE(a.conversationToken));return}case"citations":{e(ci({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=ME(n.code);e(ui({message:n.message,code:i}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=n.result?.completionReason==="ANSWERED",a=i?!r:void 0;e(eu(i)),e(di(!i)),e(ai(!1)),e(Ly(i,t,a)),e(Fa())}}};var jE=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,i){t();let a=zl(n),p=ax(n),m=sx(n),f=ix(n),g=cx(n),S=TE(a,p,m);e=S;let b=VE(o),h=aw(n,i());try{o(tn(!0)),yield S.runAgent({forwardedProps:{params:h,accessToken:f,recordDebugSession:g}},b)}catch(y){o(tn(!1)),o(ui({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var LE=e=>{let t=lb({extra:e}),r=jE();return t.startListening({actionCreator:qe.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Oy(i)||(r.abortRun(),o.dispatch(dr()),o.dispatch(qE()),i.generatedAnswer.isEnabled===!1))return;let a=ii(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var UE=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)},QE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var Iv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};d();c();l();u();function BE(e,t){let r={...e},n,o=i=>(a,p)=>{let m=i(a,p);return n?n(m,p):m};return{get combinedReducer(){let i=EA(Object.entries(t).filter(([a])=>!(a in r)).map(([a,p])=>[a,()=>p]));return o(Lo({...i,...r}))},containsAll(i){return Object.keys(i).every(p=>p in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}d();c();l();u();d();c();l();u();function UQ(e){if(!e||!QQ(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 GE(e,t=60){if(!e)return!1;let r=UQ(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function QQ(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function HE(e,t){let r=0,n=null,o=Hu(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(S,b=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!b)throw x;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&S.dispatch(Ia({accessToken:y})),y});return function i(_x208){return _ref85.apply(this,arguments)}}(),a=S=>{let b=$Q(S.getState());return!!b&&GE(b)},p=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(S){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(S))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(b){e.warn(b,"Access token renewal failed. A retry will occur if necessary.")}});return function p(_x209){return _ref87.apply(this,arguments)}}(),m=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(S,b,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),$E(S,b.error),b;!n&&(r++,o());try{yield i(S,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}S.dispatch(h)});return function m(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}(),f=(S,b,h)=>GQ(h)?t?m(S,h,b):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),$E(S,h.error),h):h,g=(S,b,h)=>BQ(h)?Promise.resolve(h).then(y=>f(S,b,y)):f(S,b,h);return S=>b=>h=>{if(!(typeof h=="function"))return b(h);let x=()=>g(S,h,b(h));return typeof t=="function"&&a(S)?p(S).then(x):x()}}function BQ(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function GQ(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new ea().name}function $E(e,t){e.dispatch(ja({status:401,statusCode:401,message:t.message,type:t.name}))}function $Q(e){return e.configuration.accessToken}d();c();l();u();function zE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return KC({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(QE(n.logger))})}function HQ(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=a.analyticsMode!=="next",m=a.analyticsMode==="legacy"&&o===!0;return p&&nh()&&!m?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(p&&nh()&&m&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function WE(e,t){let r={...e.reducers,configuration:Re,version:mw},n=zQ({...e,reducers:r},t,Re),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Ia({accessToken:o,environment:i,organizationId:a}));let p=HQ(e.configuration,n.logger);return p&&n.dispatch(rd(p)),n}function zQ(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=BE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,p={...t,get relay(){return Dc(f.state,o)},get navigatorContext(){return Iv(this.relay,o)}},m=WQ(e,p,i),f={addReducers(g){i.containsAll(g)||(i.add(g),m.replaceReducer(i.combinedReducer))},dispatch:m.dispatch,subscribe:m.subscribe,enableAnalytics(){m.dispatch(od())},disableAnalytics(){m.dispatch(nd())},get state(){return m.getState()},get relay(){return Dc(this.state,o)},get navigatorContext(){return Iv(this.relay,o)},logger:a,store:m};return f}function WQ(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=YQ(e,t.logger,()=>t.navigatorContext);return zE({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function YQ(e,t,r){let{renewAccessToken:n}=e.configuration,o=HE(t,n),i=LE({getNavigatorContext:r});return[xw,o,UE(t),hw].concat(pi.middleware,i.middleware,e.middlewares||[])}var KQ=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Xf(e){e==="next"&&console.warn(YQ)}d();c();l();u();var rF=Pr(tF(),1);function nF(e){return(0,rF.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function oF(e,t){let r=fB(e),n=hr,o=mB(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function fB(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function mB(e){return e.preprocessRequest||al}d();c();l();u();d();c();l();u();var aF={organizationId:H,accessToken:H,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new pe({required:!1}),originContext:new $({required:!1}),originLevel2:new $({required:!1}),originLevel3:new $({required:!1}),analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new $({required:!1,url:!0}),trackingId:new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new pe({required:!1})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function iF(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var sF=new De({...aF,insightId:H,search:new Y({options:{required:!1},values:{locale:Ze}})}),gB="2729db39-d7fd-4504-a06e-668c64968c95";function kv(){return{...iF(),insightId:gB}}var hB={insightConfiguration:ud,search:Pe,insightInterface:ro,searchHub:Ld,resultPreview:Vi};function yB(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function cF(e){let t=nF(e.loggerOptions);SB(e.configuration,t);let r=vB(e.configuration,t),n=AB(t),o={...oF(e.configuration,t),apiClient:r,streamingClient:n,generatedAnswerAnalyticsClient:Ti},a={...e,reducers:hB},i=HE(a,o);Xf(i.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,m=yB(e.configuration);return i.dispatch(cd({insightId:p})),i.dispatch(Yr()),m&&i.dispatch(Ei(m)),{...i,get state(){return i.state},executeFirstSearch(f=vd()){jd(i.state)||i.dispatch(Re({legacy:f,next:wx()}))}}}function SB(e,t){try{sF.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function vB(e,t){return new il({logger:t,preprocessRequest:e.preprocessRequest||al})}function AB(e){return new ol({logger:e})}d();c();l();u();function Se(e){let t,r=new Map,n=()=>r.size===0,o,a=i=>{try{let p=JSON.stringify(i),m=t!==p;return t=p,m}catch(p){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",p),!0}};return{subscribe(i){i();let p=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{a(this.state)&&r.forEach(m=>m())})),r.set(p,i),()=>{r.delete(p),n()&&(o?.(),o=void 0)}},get state(){return{}}}}d();c();l();u();d();c();l();u();var uF={articleLanguage:Ze,articlePublishStatus:Ze,articleVersionNumber:Ze,caseId:H,knowledgeArticleId:Ze,name:Ze,permanentId:Ze,resultUrl:Ze,source:Ze,title:H,uriHash:Ze,isAttachedFromCitation:new pe({required:!1,default:!1})},bB=new Y({options:{required:!0},values:uF}),em=N("insight/attachToCase/setAttachedResults",e=>q(e,{results:new ae({each:bB}),loading:new pe({required:!1,default:!1})})),Co=N("insight/attachToCase/attach",e=>lF(e)),xo=N("insight/attachToCase/detach",e=>lF(e)),lF=e=>J(e.permanentId)&&J(e.uriHash)?{payload:e,error:kr(new Vo("Either permanentId or uriHash is required"))}:q(e,uF);d();c();l();u();d();c();l();u();var Vr=e=>{let t=ee(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var ys=e=>re("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCaseAttach(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Vr(t)}}}),Ss=e=>re("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,ee(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:_r(e,t),context:Vr(t)})});d();c();l();u();d();c();l();u();function dF(){return{results:[],loading:!1}}var Ro=fe(dF(),e=>{e.addCase(em,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(Co,(t,r)=>{(!J(r.payload.permanentId)||!J(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(xo,(t,r)=>{t.results=t.results.filter(n=>CB(n,r.payload))})}),CB=(e,t)=>{let r=!J(e.permanentId)&&e?.permanentId===t?.permanentId,n=!J(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var tm=(e,t)=>Ka(e.raw[t])?String(e.raw[t]):void 0,vs=(e,t)=>({articleLanguage:tm(e,"sflanguage"),articleVersionNumber:tm(e,"sflanguage"),articlePublishStatus:tm(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:tm(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function pF(e,t){if(!xB(e))throw ie;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=Se(e),{result:a,caseId:i}=t.options,p=()=>J(i)||J(a.raw.permanentid)&&J(a.raw.urihash)?!1:e.state.attachedResults.results.some(m=>{let f=i===m.caseId,g=!J(m.permanentId)&&m.permanentId===a.raw.permanentid,S=!J(m.uriHash)&&m.uriHash===a.raw.urihash;return f&&(g||S)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(Co(vs(a,i))),r(ys(a))},detach(){r(xo(vs(a,i))),r(Ss(a))}}}function xB(e){return e.addReducers({configuration:we,attachedResults:Ro}),!0}d();c();l();u();function fF(e,t){if(!RB(e))throw ie;let{dispatch:r}=e,n=Se(e),{caseId:o}=t.options,a=p=>J(o)||J(p.raw.permanentid)&&J(p.raw.urihash)?!1:e.state.attachedResults.results.some(m=>{let f=o===m.caseId,g=!J(m.permanentId)&&m.permanentId===p.raw.permanentid,S=!J(m.uriHash)&&m.uriHash===p.raw.urihash;return f&&(g||S)}),i=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:i(),loading:e.state.attachedResults.loading}},isAttached(p){return a(p)},attach(p){r(Co(vs(p,o))),r(ys(p))},detach(p){r(xo(vs(p,o))),r(Ss(p))}}}function RB(e){return e.addReducers({configuration:we,attachedResults:Ro}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ve=H;d();c();l();u();var wB={state:new Ke({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new ae({required:!0,each:H}),moreValuesAvailable:new pe({required:!1})};function Ov(e){e.children.forEach(t=>{Ov(t)}),hr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},wB)}var As={facetId:ve,field:H,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),basePath:new ae({required:!1,each:H}),filterByBasePath:new pe({required:!1})};var bs=N("categoryFacet/register",e=>q(e,As)),Cs=N("categoryFacet/toggleSelectValue",e=>{try{return hr(e.facetId,H),Ov(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),wo=N("categoryFacet/deselectAll",e=>q(e,As.facetId)),Au=N("categoryFacet/updateNumberOfValues",e=>q(e,{facetId:As.facetId,numberOfValues:As.numberOfValues})),rm=N("categoryFacet/updateSortCriterion",e=>q(e,{facetId:As.facetId,criterion:new Ke})),mF=N("categoryFacet/updateBasePath",e=>q(e,{facetId:As.facetId,basePath:new ae({each:H})}));d();c();l();u();var ZFe={categoryFacetId:ve,categoryFacetPath:new ae({required:!0,each:H})};var gF=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var IB={categoryFacetId:ve,categoryFacetPath:new ae({required:!0,each:H})},EB=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},nm=e=>re("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{q(e,IB);let n={...EB(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var We=N("facetOptions/update",(e={freezeFacetOrder:!0})=>q(e,{freezeFacetOrder:new pe({required:!1})})),or=N("facetOptions/facet/enable",e=>q(e,ve)),ft=N("facetOptions/facet/disable",e=>q(e,ve));d();c();l();u();var ar=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var bu={facetId:ve,captions:new Y({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var FB={path:new ae({required:!0,each:H}),displayValue:Je,rawValue:Je,count:new oe({required:!0,min:0})},om=N("categoryFacet/selectSearchResult",e=>q(e,{facetId:ve,value:new Y({values:FB})})),hF=N("categoryFacetSearch/register",e=>q(e,bu));d();c();l();u();function xs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Rs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function am(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Cu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function im(e,t,r){e.currentValues=TB(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function TB(e,t){if(!e.length)return[];let r=yF(e[0],t),n=r;for(let o of e.splice(1)){let a=yF(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function yF(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var sm=fe(vi(),e=>{e.addCase(bs,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=kB(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(ot.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(st,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(a=>{let i=t[a],p=i.request;if((i.tabs?.included?.length||i.tabs?.excluded?.length)&&!ar(i.tabs,o)){p.currentValues.length&&im(p,[],i.initialNumberOfValues);return}let f=n[a]||[];(f.length||p.currentValues.length)&&im(p,f,i.initialNumberOfValues)})}).addCase(rm,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(mF,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(Cs,(t,r)=>{let{facetId:n,selection:o,retrieveCount:a}=r.payload,i=t[n]?.request;if(!i)return;let{path:p}=o,m=p.slice(0,p.length-1),f=PB(i,m,a);if(f.length){let S=f[0];S.retrieveChildren=!0,S.state="selected",S.previousState="idle",S.children=[];return}let g=vF(o.value,a);g.state="selected",g.previousState="idle",f.push(g),i.numberOfValues=1}).addCase(wo,(t,r)=>{let n=r.payload;Cu(t,n)}).addCase(er,t=>{Object.keys(t).forEach(r=>Cu(t,r))}).addCase(Oi,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(Au,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return am(a,o);OB(t,r.payload)}}).addCase(om,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];im(a.request,i,a.initialNumberOfValues)}).addCase(Mi.fulfilled,(t,r)=>{SF(t,r.payload.response.facets)}).addCase(qe.fulfilled,(t,r)=>{SF(t,r.payload.response.facets)}).addCase(ft,(t,r)=>{Cu(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Cu(t,o)})})}),_v={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function PB(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=vF(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function kB(e){return{..._v,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function vF(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function SF(e,t){t.forEach(r=>{if(!_B(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=NB(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function OB(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function _B(e,t){return t.facetId in e}function NB(e,t){let r=zr(e.currentValues),n=zr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var ln=new $({regex:/^[a-zA-Z0-9-_]+$/}),dn=new $({required:!0}),AF=new ae({each:new $}),bF=new $,CF=new pe,pn=new pe,fn=new oe({min:0}),jr=new oe({min:1}),cm=new pe({required:!0}),DB=new Y,qB=new $,MB={captions:DB,numberOfValues:jr,query:qB},ws=new Y({values:MB}),um=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ae({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),xPe=new pe,lm=new ae({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var Va={value:H,numberOfResults:new oe({min:0}),state:H};var VB={facetId:ve,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),resultsMustMatch:new Ke({required:!1}),allowedValues:um,customSort:lm},Is=N("facet/register",e=>q(e,VB)),Io=N("facet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new Y({values:Va})})),Eo=N("facet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new Y({values:Va})})),bt=N("facet/deselectAll",e=>q(e,ve)),dm=N("facet/updateSortCriterion",e=>q(e,{facetId:ve,criterion:new Ke({required:!0})})),xu=N("facet/updateNumberOfValues",e=>q(e,{facetId:ve,numberOfValues:new oe({required:!0,min:1})})),Ru=N("facet/updateIsFieldExpanded",e=>q(e,{facetId:ve,isFieldExpanded:new pe({required:!0})})),ja=N("facet/updateFreezeCurrentValues",e=>q(e,{facetId:ve,freezeCurrentValues:new pe({required:!0})}));d();c();l();u();var Es=e=>ke("analytics/facet/unexclude",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o=xi(e,n);return t.makeFacetUnexclude(o)});var ir=()=>({actionCause:"facetClearAll"}),mr=()=>({actionCause:"facetSelect"}),pm=()=>({actionCause:"facetExclude"}),Qn=()=>({actionCause:"facetDeselect"});var Nv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var Fs=e=>re("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{q(e,ve);let n={...Ko(e,Zt(r)),...ee(r.insightCaseContext)};return t.logFacetShowMore(n)}),Ts=e=>re("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{q(e,ve);let n={...Ko(e,Zt(r)),...ee(r.insightCaseContext)};return t.logFacetShowLess(n)}),mn=e=>re("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{q(e,{facetId:ve,sortCriterion:new Ke({required:!0})});let{facetId:n,sortCriterion:o}=e,a=Zt(r),p={...Ko(n,a),criteria:o,...ee(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Bt=e=>re("facetClearAll")("analytics/facet/reset",(t,r)=>{q(e,ve);let n=Zt(r),o={...Ko(e,n),...ee(r.insightCaseContext)};return t.logFacetClearAll(o)}),Kt=e=>re("facetSelect")("analytics/facet/select",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o={...xi(e,n),...ee(r.insightCaseContext)};return t.logFacetSelect(o)}),Lr=e=>re("facetDeselect")("analytics/facet/deselect",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o={...xi(e,n),...ee(r.insightCaseContext)};return t.logFacetDeselect(o)}),wu=e=>re("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n={...xi(e,Zt(r)),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var xF={facetId:ve,value:new Y({values:{displayValue:Je,rawValue:Je,count:new oe({required:!0,min:0})}})},RF=N("facetSearch/register",e=>q(e,bu)),fm=N("facetSearch/update",e=>q(e,bu)),mm=N("facetSearch/toggleSelectValue",e=>q(e,xF)),gm=N("facetSearch/toggleExcludeValue",e=>q(e,xF));var Ps=fe(Ci(),e=>{e.addCase(Is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=YC(jB(r.payload),o))}).addCase(ot.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(st,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:p}=t[i],m=n[i]||[],f=o[i]||[],g=m.length+f.length,S=p.currentValues.filter(C=>!m.includes(C.value)&&!f.includes(C.value));p.currentValues=[...m.map(IF),...f.map(EF),...S.map(UB)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(Io,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(m=>m.value===o.value);if(!i){hm(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Eo,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(m=>m.value===o.value);if(!i){hm(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(ja,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(bt,(t,r)=>{Rs(t[r.payload]?.request)}).addCase(er,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Rs(r))}).addCase(wd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Rs(r))}).addCase(Oi,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(dm,(t,r)=>{xs(t,r.payload)}).addCase(xu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;am(t[n]?.request,o)}).addCase(Ru,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(qe.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>wF(t[o.facetId]?.request,o))}).addCase(Mi.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>wF(t[o.facetId]?.request,o))}).addCase(mm,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,m=p.find(g=>g.value===i);if(m){m.state="selected";return}let f=IF(i);hm(a,f),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(gm,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,m=p.find(g=>g.value===i);if(m){m.state="excluded";return}let f=EF(i);hm(a,f),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(ft,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Rs(n)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Rs(a.request)})})});function hm(e,t){let{currentValues:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function wF(e,t){e&&(e.currentValues=t.values.map(LB),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var Dv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function jB(e){return{...Dv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function LB(e){let{value:t,state:r}=e;return{value:t,state:r}}function IF(e){return{value:e,state:"selected"}}function EF(e){return{value:e,state:"excluded"}}function UB(e){return{...e,state:"idle"}}d();c();l();u();var ym=()=>re("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();function ks(e){let t=FF(e.start,e),r=FF(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function FF(e,t){let{dateFormat:r}=t;return WA(e)?(rl(e),$A(e)):typeof e=="string"&&zn(e)?(rl(e),e):(UA(e,r),tl(ti(e,r)))}d();c();l();u();var Os=N("rangeFacet/updateSortCriterion",e=>q(e,{facetId:ve,criterion:new Ke({required:!0})}));d();c();l();u();var La={state:H,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new pe({required:!0}),numberOfResults:new oe({required:!0,min:0})},Ua={start:H,end:H,endInclusive:new pe({required:!0}),state:H,numberOfResults:new oe({required:!0,min:0})},Bn=e=>({facetId:ve,selection:typeof e.start=="string"?new Y({values:Ua}):new Y({values:La})});var QB={start:H,end:H,endInclusive:new pe({required:!0}),state:H},BB={facetId:ve,field:H,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ae({required:!1,each:new Y({values:QB})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),rangeAlgorithm:new Ke({required:!1})};function TF(e){return zn(e)?mc(e):e}function Sm(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=ks(t);if(ti(TF(r)).isAfter(ti(TF(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var gn=N("dateFacet/register",e=>{try{return hr(e,BB),Sm(e),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),hn=N("dateFacet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new Y({values:Ua})})),yn=N("dateFacet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new Y({values:Ua})})),Gn=N("dateFacet/updateFacetValues",e=>{try{return hr(e,{facetId:ve,values:new ae({each:new Y({values:Ua})})}),Sm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),vm=Os,Am=bt;d();c();l();u();d();c();l();u();var bm=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},Cm=()=>({actionCause:"breadcrumbFacet"});var qv=Cm;d();c();l();u();var Iu=e=>re("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{q(e,Bn(e.selection));let n={...bm(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function GB(e,t){return!!t&&t.facetId in e.dateFacetSet}var PF=(e,t)=>{let r=kn(e,t);if(GB(e,r))return r},kF=(e,t)=>(PF(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),OF=(e,t)=>(PF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var Rm={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function wm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=_F(r);r.numberOfValues=o,e[n]=t}function Im(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=_F(n))}function Em(e,t,r){let n=e[t]?.request;if(!n)return;let o=xm(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function Fm(e,t,r){let n=e[t]?.request;if(!n)return;let o=xm(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function Sn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function Tm(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!xm(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let a=o.filter(p=>!xm(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function Pm(e,t,r){t.forEach(n=>{let o=n.facetId,a=e[o]?.request;if(!a)return;let i=r(n.values);a.currentValues=i,a.preventAutoSelect=!1})}function xm(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function _F(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var vn=fe(Ai(),e=>{e.addCase(gn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=$B(n);wm(t,zC(a,o))}).addCase(ot.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(st,(t,r)=>{let n=r.payload.df||{};Tm(t,n)}).addCase(hn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Em(t,n,o)}).addCase(yn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Fm(t,n,o)}).addCase(Gn,(t,r)=>{let{facetId:n,values:o}=r.payload;Im(t,n,o)}).addCase(Am,(t,r)=>{Sn(t,r.payload)}).addCase(er,t=>{Object.keys(t).forEach(r=>{Sn(t,r)})}).addCase(vm,(t,r)=>{xs(t,r.payload)}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.facets;Pm(t,n,HB)}).addCase(ft,(t,r)=>{Sn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Sn(t,o)})})});function $B(e){return{...Rm,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function HB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var zB={state:H,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new pe({required:!0})},WB={facetId:ve,field:H,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ae({required:!1,each:new Y({values:zB})}),generateAutomaticRanges:new pe({required:!0}),filterFacetCount:new pe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),rangeAlgorithm:new Ke({required:!1})};function km(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 An=N("numericFacet/register",e=>{try{return q(e,WB),km(e),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),bn=N("numericFacet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new Y({values:La})})),Cn=N("numericFacet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new Y({values:La})})),$n=N("numericFacet/updateFacetValues",e=>{try{return hr(e,{facetId:ve,values:new ae({each:new Y({values:La})})}),km({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),Om=Os,_m=bt;d();c();l();u();var Mv=Cm;d();c();l();u();d();c();l();u();var NF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var Eu=e=>re("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{q(e,Bn(e.selection));let n={...NF(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function YB(e,t){return!!t&&t.facetId in e.numericFacetSet}var DF=(e,t)=>{let r=kn(e,t);if(YB(e,r))return r},qF=(e,t)=>(DF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),MF=(e,t)=>(DF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Fo=fe(bi(),e=>{e.addCase(An,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=KB(n);wm(t,WC(a,o))}).addCase(ot.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(st,(t,r)=>{let n=r.payload.nf||{};Tm(t,n)}).addCase(bn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Em(t,n,o)}).addCase(Cn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Fm(t,n,o)}).addCase($n,(t,r)=>{let{facetId:n,values:o}=r.payload;Im(t,n,o)}).addCase(_m,(t,r)=>{Sn(t,r.payload)}).addCase(er,t=>{Object.keys(t).forEach(r=>{Sn(t,r)})}).addCase(Om,(t,r)=>{xs(t,r.payload)}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.facets;Pm(t,n,XB)}).addCase(ft,(t,r)=>{Sn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Sn(t,o)})})});function KB(e){return{...Rm,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function XB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Fu=H,Nm=new Y({options:{required:!0},values:{caption:Je,expression:Je,state:new $({constrainTo:["idle","selected","excluded"]})}}),VF=new ae({required:!0,each:Nm});var eNe=N("staticFilter/register",e=>q(e,{id:Fu,values:VF})),jF=N("staticFilter/toggleSelect",e=>q(e,{id:Fu,value:Nm})),LF=N("staticFilter/toggleExclude",e=>q(e,{id:Fu,value:Nm})),tNe=N("staticFilter/deselectAllFilterValues",e=>q(e,Fu));d();c();l();u();var Dm=e=>re("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...ee(r.insightCaseContext)}));d();c();l();u();var qm=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function UF(e){let t=Se(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(er())},deselectBreadcrumb(n){n.deselect()}}}function QF(e){if(!ZB(e))throw ie;let t=UF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:y,selection:x})=>{let w=wu({facetId:y,facetValue:x.value});r(Io({facetId:y,selection:x})),r(ja({facetId:y,freezeCurrentValues:!1})),r(Re({legacy:w,next:Nv()}))},executeToggleExclude:({facetId:y,selection:x})=>{let w=wu({facetId:y,facetValue:x.value});r(Eo({facetId:y,selection:x})),r(ja({facetId:y,freezeCurrentValues:!1})),r(Re({legacy:w,next:Nv()}))},facetValuesSelector:GC};return qm(h)},a=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:y=>{r(bn(y)),r(Re({legacy:Eu(y),next:Mv()}))},executeToggleExclude:y=>{r(Cn(y)),r(Re({legacy:Eu(y),next:Mv()}))},facetValuesSelector:qF};return qm(h)},i=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:y=>{r(hn(y)),r(Re({legacy:Iu(y),next:qv()}))},executeToggleExclude:y=>{r(yn(y)),r(Re({legacy:Iu(y),next:qv()}))},facetValuesSelector:OF};return qm(h)},p=h=>{let y=HC(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:y,deselect:()=>{r(wo(h)),r(Re({legacy:nm({categoryFacetPath:y.map(x=>x.value),categoryFacetId:h}),next:gF()}))}}},m=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),f=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:y,values:x}=h,w=x.filter(E=>E.state!=="idle").map(E=>S(y,E));return{id:y,values:w}},S=(h,y)=>({value:y,deselect:()=>{let{caption:x,expression:w}=y,E=Dm({staticFilterId:h,staticFilterValue:{caption:x,expression:w}});y.state==="selected"?r(jF({id:h,value:y})):y.state==="excluded"&&r(LF({id:h,value:y})),r(Re({legacy:E}))}});function C(){return!![...o(),...a(),...i(),...m(),...f()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:m(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:f(),hasBreadcrumbs:C()}},deselectAll:()=>{t.deselectAll(),r(Re({legacy:ym(),next:{actionCause:"breadcrumbResetAll"}}))}}}function ZB(e){return e.addReducers({configuration:we,search:Pe,facetSet:Ps,numericFacetSet:Fo,dateFacetSet:vn,categoryFacetSet:sm}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var BF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Mm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),GF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function $F(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Mm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var HF=(e,t)=>{let r={...GF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var zF=fe($F(),e=>{e.addCase(pd,t=>{t.enableDidYouMean=!0}).addCase(Vx,t=>{t.enableDidYouMean=!1}).addCase(jx,t=>{t.automaticallyCorrectQuery=!0}).addCase(fd,t=>{t.automaticallyCorrectQuery=!1}).addCase(qe.pending,t=>{t.queryCorrection=Mm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(qe.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:Mm();t.queryCorrection=a}t.queryCorrectionMode==="next"&&HF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Jt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Hc,(t,r)=>{t.queryCorrectionMode=r.payload})});function WF(e,t={}){if(!JB(e))throw ie;let r=Se(e),{dispatch:n}=e;n(pd()),t.options?.automaticallyCorrectQuery===!1&&n(fd()),n(Hc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>BF(o().didYouMean);return{...r,get state(){let i=o();return{originalQuery:i.didYouMean.originalQuery,wasCorrectedTo:i.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:i.didYouMean.wasAutomaticallyCorrected,queryCorrection:i.didYouMean.queryCorrection,hasQueryCorrection:a()}},applyCorrection(){n(Jt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(Hc(i))}}}function JB(e){return e.addReducers({configuration:we,didYouMean:zF}),!0}var YF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function KF(e,t={options:YF}){let r={...YF,...t.options},n=WF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Re({legacy:Hx(),next:eR()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Gt=fe(hd(),e=>{e.addCase(We,(t,r)=>({...t,...r.payload})).addCase(qe.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(qe.rejected,t=>{t.freezeFacetOrder=!1}).addCase(ot.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(bs,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Vm(o,t,n)}).addCase(Is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Vm(o,t,n)}).addCase(gn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Vm(o,t,n)}).addCase(An,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Vm(o,t,n)}).addCase(or,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(ft,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(st,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=Hy()),t.facets[n].enabled=!0})})});function Vm(e,t,r){let n={...Hy(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var jm=fe(Sd(),e=>{e.addCase(yp,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(Nt,(t,r)=>{let n=r.payload;XF(t,n)}).addCase(hp,(t,r)=>{let n=r.payload;XF(t,n)}).addCase(ot.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(st,(t,r)=>{let n=r.payload.tab;J(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function XF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function ZF(e){if(!e1(e))throw ie;let t=Se(e),r=lt(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function e1(e){return e.addReducers({tabSet:jm}),!0}function JF(e,t){if(!t1(e))throw ie;let r=ZF(e),n=y=>e.state.facetOptions.facets[y]?.enabled??!1,o=y=>e.state.facetSet?.[y]?.request?.currentValues??e.state.categoryFacetSet?.[y]?.request?.currentValues??e.state.numericFacetSet?.[y]?.request?.currentValues??e.state.dateFacetSet?.[y]?.request?.currentValues??null,a=y=>y in e.state.facetOptions.facets,i=y=>e.state.facetOptions.facets[y]?.tabs,p=()=>Za({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:y})=>a(y)?{enabled:n(y),values:o(y)}:null),isTabEnabled:ar(i(t.facetId),r.state.activeTab)}),m=()=>{let y=p();return y===C?!1:(C=y,!0)},f=()=>t.conditions.length>0?t.conditions.some(y=>{if(!n(y.parentFacetId))return!1;let x=o(y.parentFacetId);return x===null?!1:y.condition(x)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([y,x])=>x.request.freezeCurrentValues&&e.dispatch(ja({facetId:y,freezeCurrentValues:!1})))},S=()=>{if(!a(t.facetId))return;let y=n(t.facetId),x=f(),w=ar(i(t.facetId),r.state.activeTab),E=x&&w;y!==E&&(e.dispatch(E?or(t.facetId):ft(t.facetId)),g())},C=p(),h=e.subscribe(()=>{m()&&S()});return S(),{stopWatching(){h()}}}function t1(e){return e.addReducers({facetOptions:Gt}),!0}function eT(e,t){return JF(e,t)}d();c();l();u();d();c();l();u();function tT(e){if(!r1(e))throw ie;let t=Se(e),r=()=>e.state;return{...t,sort(n){return Wc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function r1(e){return e.addReducers({search:Pe,facetOptions:Gt}),!0}function rT(e){return tT(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Lm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={..._s,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Um(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Qm(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Bm(e,t){let r=e[t];r&&(r.isLoading=!1)}function Gm(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function Tu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=_s.query)}function $m(e,t){Object.keys(e).forEach(r=>Tu(e,{facetId:r},t))}var _s={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var nT=/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:p,numberOfValues:m}=o,{field:f,delimitingCharacter:g,basePath:S,filterFacetCount:C}=a,h=n1(a),y=h.length?[h]:[],x=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:S,captions:i,numberOfValues:m,query:x,field:f,delimitingCharacter:g,ignorePaths:y,filterFacetCount:C,type:"hierarchical",...(n?{}:{searchContext:(yield br(t,r)).request})}});return function nT(_x213,_x214,_x215,_x216){return _ref89.apply(this,arguments)}}(),n1=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var oT=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:p,currentValues:m,filterFacetCount:f}=t.facetSet[e].request,g=m.filter(C=>C.state!=="idle").map(C=>C.value),S=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:i,query:S,field:p,ignoreValues:g,filterFacetCount:f,type:"specific",...(n?{}:{searchContext:(yield br(t,r)).request})}});return function oT(_x217,_x218,_x219,_x220){return _ref90.apply(this,arguments)}}();var aT=e=>(/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,H),o1(i,t)?p=yield oT(t,i,a,e):p=yield nT(t,i,a,e);let m=yield n.facetSearch(p);return{facetId:t,response:m}});return function(_x221,_x222){return _ref91.apply(this,arguments)}}()),To=me("facetSearch/executeSearch",aT(!1)),_Me=me("facetSearch/executeSearch",aT(!0)),Hm=N("facetSearch/clearResults",e=>q(e,{facetId:ve})),o1=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function iT(){return{}}var sT=fe(iT(),e=>{e.addCase(hF,(t,r)=>{let n=r.payload;Lm(t,n,Vv)}).addCase(fm,(t,r)=>{Um(t,r.payload)}).addCase(To.pending,(t,r)=>{let n=r.meta.arg;Qm(t,n,r.meta.requestId)}).addCase(To.rejected,(t,r)=>{let n=r.meta.arg;Bm(t,n)}).addCase(To.fulfilled,(t,r)=>{Gm(t,r.payload,r.meta.requestId)}).addCase(Hm,(t,{payload:{facetId:r}})=>{Tu(t,{facetId:r},Vv)}).addCase(qe.fulfilled,t=>{$m(t,Vv)})});function Vv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function cT(e,t){let{field:r,state:n}=e;if(!a1(e))return r;let o=`${r}_`,a=i1(o,n);return c1(r,t),`${o}${a}`}function a1(e){let{field:t,state:r}=e;return uT(r).some(o=>o&&t in o)}function i1(e,t){let n=uT(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return s1(n,e)+1}function uT(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function s1(e,t){return e.map(a=>{let i=a.split(t)[1],p=parseInt(i,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function c1(e,t){let r=`A facet with field "${e}" already exists.
46
- To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function Ir(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||cT({field:o,state:r},n)}d();c();l();u();d();c();l();u();var lT=["alphanumeric","occurrences"];var dT=new De({field:dn,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),basePath:AF,delimitingCharacter:bF,facetId:ln,facetSearch:ws,filterByBasePath:CF,filterFacetCount:pn,injectionDepth:fn,numberOfValues:jr,sortCriteria:new $({constrainTo:lT})});function pT(e,t){if(!u1(e))throw ie;let r=Se(e),{dispatch:n}=e,o=Ir(e,t.options),a=t.options.tabs??{},i=Ut(e.state.tabSet),p={..._v,...Yu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},m={facetSearch:{..._s,...t.options.facetSearch},...p};yt(e,dT,m,"buildCategoryFacet");let f=()=>Py(e.state,o),g=()=>Ty(e.state,o),S=()=>Hr(e.state),C=()=>tn(e.state,o);return n(bs(p)),{...r,toggleSelect(h){let y=m.numberOfValues;n(Cs({facetId:o,selection:h,retrieveCount:y})),n(We())},deselectAll(){n(wo(o)),n(We())},sortBy(h){n(rm({facetId:o,criterion:h})),n(We())},isSortedBy(h){return f().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=m,{activeValue:y,valuesAsTrees:x}=this.state,w=(y?.children.length??x.length)+h;n(Au({facetId:o,numberOfValues:w})),n(We())},showLessValues(){let{numberOfValues:h}=m;n(Au({facetId:o,numberOfValues:h})),n(We())},enable(){n(or(o))},disable(){n(ft(o))},get state(){let h=f(),y=g(),x=S(),w=C(),E=y?.values??[],T=E.some(B=>B.children.length>0)??!1,{parents:F,values:O}=$C(y?.values),I=zr(E),k=I.length?I[I.length-1]:void 0,P=!!k,_=k?.moreValuesAvailable??y?.moreValuesAvailable??!1,j=k?k.children.length>m.numberOfValues:E.length>m.numberOfValues;return{facetId:o,parents:F,selectedValueAncestry:I,values:O,isHierarchical:T,valuesAsTrees:E,activeValue:k,isLoading:x,hasActiveValues:P,canShowMoreValues:_,canShowLessValues:j,sortCriteria:h.sortCriteria,enabled:w}}}}function u1(e){return e.addReducers({categoryFacetSet:sm,categoryFacetSearchSet:sT,facetOptions:Gt,configuration:we,search:Pe}),!0}function fT(e,t){let r=pT(e,t),{dispatch:n}=e,o=()=>r.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...m}=i;return{...r,facetSearch:m,toggleSelect(f){r.toggleSelect(f);let g=l1(o(),f);n(Re({legacy:g,next:d1(f)}))},deselectAll(){r.deselectAll(),n(Re({legacy:Bt(o()),next:ir()}))},sortBy(f){r.sortBy(f),n(Re({legacy:mn({facetId:o(),sortCriterion:f})}))},isSortedBy(f){return r.isSortedBy(f)},showMoreValues(){r.showMoreValues(),n(ki({legacy:Fs(o())}))},showLessValues(){r.showLessValues(),n(ki({legacy:Ts(o())}))},get state(){return{...r.state,facetSearch:i.state}}}}function l1(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Lr(r):Kt(r)}function d1(e){return e.state==="selected"?Qn():mr()}d();c();l();u();d();c();l();u();d();c();l();u();function mT(){return{}}var zm=fe(mT(),e=>{e.addCase(RF,(t,r)=>{let n=r.payload;Lm(t,n,jv)}).addCase(fm,(t,r)=>{Um(t,r.payload)}).addCase(To.pending,(t,r)=>{let n=r.meta.arg;Qm(t,n,r.meta.requestId)}).addCase(To.rejected,(t,r)=>{let n=r.meta.arg;Bm(t,n)}).addCase(To.fulfilled,(t,r)=>{Gm(t,r.payload,r.meta.requestId)}).addCase(Hm,(t,{payload:r})=>{Tu(t,r,jv)}).addCase(qe.fulfilled,t=>{$m(t,jv)})});function jv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var p1=e=>e.state==="selected",gT=(e,t)=>{let r={facetId:e,facetValue:t.value};return p1(t)?Lr(r):Kt(r)};d();c();l();u();var Lv=e=>e.state==="selected",vT=e=>e.state==="excluded";var AT=e=>Lv(e)?Qn():mr();d();c();l();u();d();c();l();u();var bT={facetId:ve,selection:new Y({values:Va})},CT=me("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},bT),n(Io({facetId:e,selection:t})),n(We())}),xT=me("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},bT),n(Eo({facetId:e,selection:t})),n(We())});d();c();l();u();d();c();l();u();var Ns=["allValues","atLeastOneValue"];d();c();l();u();var Wm=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var RT=new De({facetId:ln,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),field:dn,filterFacetCount:pn,injectionDepth:fn,numberOfValues:jr,sortCriteria:new $({constrainTo:Wm}),resultsMustMatch:new $({constrainTo:Ns}),facetSearch:ws});function wT(e,t,r=RT){if(!f1(e))throw ie;let{dispatch:n}=e,o=Se(e),a=Ir(e,t.options),i=t.options.tabs??{},p=Ut(e.state.tabSet),m={...Dv,...Yu("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},f={facetSearch:{..._s,...t.options.facetSearch},...m};yt(e,r,f,"buildFacet");let g=()=>BC(e.state,a),S=()=>Fy(e.state,a),C=()=>Hr(e.state),h=()=>tn(e.state,a),y=()=>{let{currentValues:w}=g();return w.filter(E=>E.state!=="idle").length},x=()=>{let{currentValues:w}=g(),E=f.numberOfValues,T=!!w.find(F=>F.state==="idle");return E<w.length&&T};return n(Is(m)),{...o,toggleSelect:w=>n(CT({facetId:f.facetId,selection:w})),toggleExclude:w=>n(xT({facetId:f.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(bt(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(bt(a)),this.toggleExclude(w)},isValueSelected:Lv,isValueExcluded:vT,deselectAll(){n(bt(a)),n(We())},sortBy(w){n(dm({facetId:a,criterion:w})),n(We())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,E=f.numberOfValues,T=E-w%E,F=w+T;n(xu({facetId:a,numberOfValues:F})),n(Ru({facetId:a,isFieldExpanded:!0})),n(We())},showLessValues(){let w=f.numberOfValues,E=Math.max(w,y());n(xu({facetId:a,numberOfValues:E})),n(Ru({facetId:a,isFieldExpanded:!1})),n(We())},enable(){n(or(a))},disable(){n(ft(a))},get state(){let w=g(),E=S(),T=C(),F=h(),O;typeof w.sortCriteria=="object"?O=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":O=w.sortCriteria;let I=E?E.values:[],k=I.some(j=>j.state!=="idle"),P=E?E.moreValuesAvailable:!1,_=w.resultsMustMatch;return{label:E?.label,facetId:a,tabs:i,values:I,sortCriterion:O,resultsMustMatch:_,isLoading:T,hasActiveValues:k,canShowMoreValues:P,canShowLessValues:x(),enabled:F}}}}function f1(e){return e.addReducers({facetSet:Ps,facetOptions:Gt,configuration:we,facetSearchSet:zm}),!0}d();c();l();u();var IT=new De({facetId:ln,field:dn,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),filterFacetCount:pn,injectionDepth:fn,numberOfValues:jr,sortCriteria:new $({constrainTo:Wm}),resultsMustMatch:new $({constrainTo:Ns}),facetSearch:ws,allowedValues:um,customSort:lm});function ET(e,t){if(!m1(e))throw ie;let{dispatch:r}=e,n=wT(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},IT),o=()=>n.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...m}=i;return{...n,facetSearch:m,toggleSelect(f){n.toggleSelect(f),r(Re({legacy:gT(o(),f),next:AT(f)}))},deselectAll(){n.deselectAll(),r(Re({legacy:Bt(o()),next:ir()}))},sortBy(f){n.sortBy(f),r(Re({legacy:mn({facetId:o(),sortCriterion:f})}))},isSortedBy(f){return this.state.sortCriterion===f},showMoreValues(){n.showMoreValues(),r(ki({legacy:Fs(o())}))},showLessValues(){n.showLessValues(),r(ki({legacy:Ts(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function m1(e){return e.addReducers({facetSet:Ps,configuration:we,facetSearchSet:zm,search:Pe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var Pu=e=>e.state==="selected",FT=e=>e.state==="excluded";var Ym=e=>Pu(e)?Qn():mr();var Km=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Pu(t)?Lr(n):Kt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Xm=N("rangeFacet/executeToggleSelect",e=>q(e,Bn(e.selection))),Zm=N("rangeFacet/executeToggleExclude",e=>q(e,Bn(e.selection)));var TT={facetId:ve,selection:new Y({values:Ua})},PT=me("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,TT),t(hn(e)),t(Xm(e)),t(We())}),kT=me("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,TT),t(yn(e)),t(Zm(e)),t(We())});d();c();l();u();function Jm(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function eg(e,t){let{facetId:r,getRequest:n}=t,o=Se(e),a=e.dispatch,i=()=>tn(e.state,r);return{...o,isValueSelected:Pu,isValueExcluded:FT,deselectAll(){a(bt(r)),a(We())},sortBy(p){a(Os({facetId:r,criterion:p})),a(We())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(or(r))},disable(){a(ft(r))},get state(){let p=n(),m=kn(e.state,r),f=p.sortCriteria,g=p.resultsMustMatch,S=m?m.values:[],C=Hr(e.state),h=i(),y=S.some(w=>w.state!=="idle"),x=m?.domain;return{facetId:r,values:S,sortCriterion:f,resultsMustMatch:g,hasActiveValues:y,isLoading:C,enabled:h,domain:x}}}}d();c();l();u();d();c();l();u();var tg=["idle","selected","excluded"];d();c();l();u();var rg=["ascending","descending"],ng=["even","equiprobable"];var g1={start:new $,end:new $,endInclusive:new pe,state:new $({constrainTo:tg})},h1=new De({facetId:ln,field:dn,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),generateAutomaticRanges:cm,filterFacetCount:pn,injectionDepth:fn,numberOfValues:jr,currentValues:new ae({each:new Y({values:g1})}),sortCriteria:new $({constrainTo:rg}),rangeAlgorithm:new $({constrainTo:ng})});function og(e,t){yt(e,h1,t,"buildDateFacet"),Sm(t)}function OT(e,t){if(!y1(e))throw ie;Jm(t.options,"buildDateFacet");let r=e.dispatch,n=Ir(e,t.options),o=t.options.tabs??{},a=Ut(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};og(e,i),r(gn(i));let p=eg(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:m=>r(PT({facetId:n,selection:m})),toggleSingleSelect:function(m){m.state==="idle"&&r(bt(n)),this.toggleSelect(m)},toggleExclude:m=>r(kT({facetId:n,selection:m})),toggleSingleExclude:function(m){m.state==="idle"&&r(bt(n)),this.toggleExclude(m)},get state(){return p.state}}}function y1(e){return e.addReducers({configuration:we,search:Pe,dateFacetSet:vn,facetOptions:Gt}),!0}function _T(e,t){let r=OT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Re({legacy:Bt(o()),next:ir()}))},sortBy(a){r.sortBy(a),n(Re({legacy:mn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Re({legacy:Km(o(),a),next:Ym(a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function NT(e,t){if(!S1(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state,a=Ir(e,t.options),i=t.options.tabs??{},p=Ut(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};og(e,m),n(gn(m));let f=()=>tn(e.state,a);return{...r,clear:()=>{n(Gn({facetId:a,values:[]})),n(We())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=Gn({facetId:a,values:[S]});return C.error?!1:(n(C),n(We()),!0)},enable(){n(or(a))},disable(){n(ft(a))},get state(){let g=Hr(o()),S=f(),C=kF(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:S}}}}function S1(e){return e.addReducers({dateFacetSet:vn,facetOptions:Gt,configuration:we,search:Pe}),!0}function DT(e,t){if(!v1(e))throw ie;let r=NT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Re({legacy:Bt(o()),next:ir()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Re({legacy:Kt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:mr()})),i},get state(){return{...r.state}}}}function v1(e){return e.addReducers({dateFacetSet:vn,configuration:we,search:Pe}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var qT={facetId:ve,selection:new Y({values:La})},MT=me("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,qT),t(bn(e)),t(Xm(e)),t(We())}),MBe=me("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,qT),t(Cn(e)),t(Zm(e)),t(We())});d();c();l();u();var A1={start:new oe,end:new oe,endInclusive:new pe,state:new $({constrainTo:tg})},b1=new De({facetId:ln,tabs:new Y({options:{required:!1},values:{included:new ae({each:new $}),excluded:new ae({each:new $})}}),field:dn,generateAutomaticRanges:cm,filterFacetCount:pn,injectionDepth:fn,numberOfValues:jr,currentValues:new ae({each:new Y({values:A1})}),sortCriteria:new $({constrainTo:rg}),resultsMustMatch:new $({constrainTo:Ns}),rangeAlgorithm:new $({constrainTo:ng})});function ag(e,t){yt(e,b1,t,"buildNumericFacet"),km(t)}d();c();l();u();function ig(e){return{endInclusive:!1,state:"idle",...e}}function VT(e,t){if(!C1(e))throw ie;Jm(t.options,"buildNumericFacet");let r=e.dispatch,n=Ir(e,t.options),o=t.options.tabs??{},a=Ut(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};ag(e,i),r(An(i));let p=eg(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:m=>r(MT({facetId:n,selection:m})),toggleSingleSelect(m){m.state==="idle"&&r(bt(n)),this.toggleSelect(m)},get state(){return p.state}}}function C1(e){return e.addReducers({numericFacetSet:Fo,facetOptions:Gt,configuration:we,search:Pe}),!0}function jT(e,t){let r=VT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Re({legacy:Bt(o()),next:ir()}))},sortBy(a){r.sortBy(a),n(Re({legacy:mn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Re({legacy:Km(o(),a),next:Ym(a)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function LT(e,t){if(!x1(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state,a=Ir(e,t.options),i=t.options.tabs??{},p=Ut(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};ag(e,m),n(An(m));let f=()=>tn(e.state,a);return{...r,clear:()=>{n($n({facetId:a,values:[]})),n(We())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=$n({facetId:a,values:[S]});return C.error?!1:(n(C),n(We()),!0)},enable(){n(or(a))},disable(){n(ft(a))},get state(){let g=Hr(o()),S=f(),C=MF(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:S}}}}function x1(e){return e.addReducers({numericFacetSet:Fo,facetOptions:Gt,configuration:we,search:Pe}),!0}function UT(e,t){let r=LT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Re({legacy:Bt(o()),next:ir()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Re({legacy:Kt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:mr()})),i},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var R1=e=>re("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(_t(e),t.logShowMoreFoldedResults(et(e,r),tt(e),ee(r.insightCaseContext)))),w1=()=>re("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(ee(t.insightCaseContext))),QT={logShowMoreFoldedResults:R1,logShowLessFoldedResults:w1};d();c();l();u();d();c();l();u();var ku={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},Ds=N("folding/register",e=>q(e,ku)),sg=me("folding/loadCollection",/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield io(a):_i(a,o),p=yield n.search({...i,q:I1(a),enableQuerySyntax:!0,cq:`@${a.folding.fields.collection}="${e}"`,filterField:a.folding.fields.collection,childField:a.folding.fields.parent,parentField:a.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return Xe(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x223,_x224){return _ref92.apply(this,arguments)}}());function I1(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var BT=N("folding/register",e=>q(e,ku)),cg=me("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield $x(o,e),p=(yield Xx(n,o,a,{origin:"foldingCollection"})).response;return Xe(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x225,_x226){return _ref93.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var ug=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function E1(e,t){return e.raw[t.collection]}function Uv(e,t){return e.raw[t.parent]}function Ou(e,t){let r=e.raw[t.child];return zu(r)?r[0]:r}function F1(e,t){return(e||t)!==void 0&&e===t}function $T(e,t,r,n=[]){let o=Ou(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=Ou(a,r)===Ou(e,r);return Uv(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:$T(i,t,r,[...n,o])}}):[]}function T1(e,t){return e.find(r=>{let n=Uv(r,t)===void 0,o=F1(Uv(r,t),Ou(r,t));return n||o})}function HT(e){return e.parentResult?HT(e.parentResult):e}function P1(e,t,r,n){let o=nd(e),i={...(n??T1(o,t)??HT(e)),searchUid:r},p=$T(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function lg(e,t,r,n){let o={};return e.forEach(a=>{let i=E1(a,t);i&&(!Ou(a,t)&&!a.parentResult||(o[i]=P1(a,t,r,n)))}),o}function GT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var dg=fe(ug(),e=>e.addCase(qe.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?lg(r.response.results,t.fields,r.response.searchUid):{}}).addCase(en.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?lg(r.response.results,t.fields,r.response.searchUid):{}}).addCase(po.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...lg(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Ds,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(sg.pending,(t,{meta:r})=>{let n=r.arg;GT(t,n).isLoadingMoreResults=!0}).addCase(sg.rejected,(t,{meta:r})=>{let n=r.arg;GT(t,n).isLoadingMoreResults=!1}).addCase(sg.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=lg(n,t.fields,a,o);if(!i||!i[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=i[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var _u={id:H},Po=N("querySuggest/register",e=>q(e,{..._u,count:new oe({min:0})})),zT=N("querySuggest/unregister",e=>q(e,_u)),ko=N("querySuggest/selectSuggestion",e=>q(e,{..._u,expression:Je})),Oo=N("querySuggest/clear",e=>q(e,_u)),qs=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,_u);let i=e.id,p=yield k1(i,t(),a),m=yield n.querySuggest(p);return Xe(m)?r(m.error):{id:i,q:p.q,...m.success}});return function(_x227,_x228){return _ref94.apply(this,arguments)}}()),k1=/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?At.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield no(t.configuration.analytics):ta(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function k1(_x229,_x230,_x231){return _ref95.apply(this,arguments)}}();var _o=fe(ut(),e=>e.addCase(Yt,(t,r)=>({...t,...r.payload})).addCase(Jt,(t,r)=>{t.q=r.payload}).addCase(ko,(t,r)=>{t.q=r.payload.expression}).addCase(ot.fulfilled,(t,r)=>r.payload?.query??t).addCase(st,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var No=N("fields/registerFieldsToInclude",e=>q(e,sl)),pg=N("fields/fetchall/enable"),fg=N("fields/fetchall/disable"),mg=me("fields/fetchDescription",/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:a,environment:i,organizationId:p}=o.configuration,{apiBaseUrl:m}=o.configuration.search,f=yield t.apiClient.fieldDescriptions({accessToken:a,organizationId:p,url:m??Xt(p,i)});return Xe(f)?n(f.error):f.success.fields});return function(_x232,_x233){return _ref96.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var WT=["author","language","urihash","objecttype","collection","source","permanentid"],O1=[...WT,"date","filetype","parents"],q2e=[...O1,"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"],YT=()=>({fieldsToInclude:WT,fetchAllFields:!1,fieldsDescription:[]});var Ms=fe(YT(),e=>e.addCase(No,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(pg,t=>{t.fetchAllFields=!0}).addCase(fg,t=>{t.fetchAllFields=!1}).addCase(mg.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Ds,(t,{payload:r})=>{let n=ug().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Vs(e){if(!_1(e))throw ie;let t=Se(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:jd(n)}}}}function _1(e){return e.addReducers({search:Pe}),!0}var N1=new De({fieldsToInclude:new ae({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function gg(e,t){if(!D1(e))throw ie;let r=Se(e),n=Vs(e),{dispatch:o}=e,a=()=>e.state,i=yt(e,N1,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(No(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,m=0,f=0,g=5,S=200,C=!1;return{...r,get state(){let y=a();return{...n.state,results:y.search.results,moreResultsAvailable:p(),searchResponseId:y.search.searchResponseId}},fetchMoreResults:function(){var _ref97=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-m<S){if(f++,f>=g){m=Date.now(),!C&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),C=!0;return}}else f=0;C=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),m=Date.now())});return function fetchMoreResults(){return _ref97.apply(this,arguments)}}()}}function D1(e){return e.addReducers({search:Pe,configuration:we,fields:Ms}),!0}var q1=new De(ku);function KT(e,t,r){if(!M1(e))throw ie;let n=gg(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?yt(e,q1,t.options.folding,"buildFoldedResultList"):{};return o(Ds({...i})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return Qv(this.state.results,m=>m.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return Qv(this.state.results,m=>m.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=a();return{...n.state,results:n.state.results.map(m=>{let f=m.raw[p.folding.fields.collection];return!f||!p.folding.collections[f]?{result:m,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[f]})}}}}function M1(e){return e.addReducers({search:Pe,configuration:Ap,folding:dg,query:_o}),!0}function Qv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=Qv(n.children,t);if(o)return o}}return null}function XT(e,t={}){let r=KT(e,{...t,loadCollectionActionCreator:cg,fetchMoreResultsActionCreator:xd},QT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function hg(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var js=fe(FS(),e=>e.addCase(Gi,(t,{payload:r})=>{t.isVisible=r}).addCase(zi,(t,{payload:r})=>{t.isEnabled=r}).addCase(np,(t,{payload:r})=>{t.id=r.id}).addCase(sa,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),a=n.trim().length>0;if(o){t.answer+=n;return}t.answer=a?n:void 0}).addCase(ca,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=hg([...t.citations,...r.citations]),delete t.error}).addCase(ua,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===Fh},t.citations=[],delete t.answer}).addCase(Jd,t=>{t.liked=!0,t.disliked=!1}).addCase(ep,t=>{t.liked=!1,t.disliked=!0}).addCase(tp,t=>{t.feedbackModalOpen=!0}).addCase(op,t=>{t.feedbackModalOpen=!1}).addCase(Wi,t=>{t.feedbackSubmitted=!0}).addCase(dr,t=>({...FS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(rn,(t,{payload:r})=>{t.isLoading=r}).addCase(ia,(t,{payload:r})=>{t.isStreaming=r}).addCase(la,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(ap,(t,{payload:r})=>{t.responseFormat=r}).addCase(sp,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(nu,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(ru,t=>{t.expanded=!0}).addCase(rp,t=>{t.expanded=!1}).addCase(ip,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(da,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(PS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase($i,(t,{payload:r})=>{t.answerId=r}).addCase(Hi,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(cp,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(up,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}).addCase(lp,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a}=r,i=t.generationSteps.findLast(p=>p.status==="active");i&&(i.toolCalls=i.toolCalls||[],i.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:a,status:"active"}))}).addCase(Yi,(t,{payload:r})=>{let{toolCallId:n,args:o,type:a}=r,p=t.generationSteps.findLast(m=>m.status==="active")?.toolCalls?.find(m=>m.toolCallId===n);p&&(p.toolCallArgs=o,p.type=a==="search"?"search":"generic")}).addCase(dp,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o}=r,i=t.generationSteps.findLast(p=>p.status==="active")?.toolCalls?.find(p=>p.toolCallId===n);i&&(i.finishedAt=o,i.status="completed")}));d();c();l();u();function yg(e,t,r={}){if(!V1(e))throw ie;let{dispatch:n}=e,o=Se(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Gi(i));let p=r.initialState?.isEnabled;p!==void 0&&n(zi(p));let m=r.initialState?.responseFormat;m&&n(ap(m));let f=r.fieldsToIncludeInCitations;return f&&n(sp(f)),r.initialState?.expanded&&n(ru()),{...o,get state(){let S=a().generatedAnswer;return{...S,error:Kf(S.error)}},like(){this.state.liked||(n(Jd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(ep()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(tp())},closeFeedbackModal(){n(op())},sendFeedback(S){n(t.logGeneratedAnswerFeedback(S)),n(Wi())},logCitationClick(S,C){n(t.logOpenGeneratedAnswerSource(S,C))},logCitationHover(S,C,h){n(t.logHoverCitation(S,C,h))},show(){this.state.isVisible||(n(Gi(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Gi(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(ru()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(rp()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(zi(!0))},disable(){this.state.isEnabled&&n(zi(!1))},logCopyToClipboard(S){n(t.logCopyGeneratedAnswer(S))},retry(){}}}function V1(e){return e.addReducers({generatedAnswer:js}),!0}var $t={engines:{},setAbortControllerRef:(e,t)=>{$t.engines[t].abortController=e},getIsStreamInProgress:e=>!$t.engines[e].abortController||$t.engines[e].abortController?.signal.aborted?($t.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,a=r.generatedAnswer.id;if($t.engines[a].lastRequestId!==n){if($t.engines[a].lastRequestId=n,$t.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(dr())}if(!$t.getIsStreamInProgress(a)&&o&&o!==$t.engines[a].lastStreamId){if($t.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(dw({setAbortControllerRef:p=>$t.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function ZT(e,t,r={}){if(!j1(e))throw ie;let n=yg(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!$t.engines[e.state.generatedAnswer.id]&&($t.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let i=Hu("genQA-",12);e.dispatch(np({id:i}))}$t.engines[e.state.generatedAnswer.id]||($t.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),$t.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(qe({legacy:t.logRetryGeneratedAnswer()}))}}}function j1(e){return e.addReducers({generatedAnswer:js}),!0}d();c();l();u();d();c();l();u();var JT=mp.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var Sg=e=>e==="yes"?!0:e==="no"?!1:null,L1=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:Sg(t.correctTopic),documented:Sg(t.documented),hallucinationFree:Sg(t.hallucinationFree),readable:Sg(t.readable)},helpful:t.helpful,question:r}),U1=e=>{let t="",r=()=>{let n=e.state,o=YR(n),a=o.requestId;if(a!==t){if(t=a,e.dispatch(dr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Hi("automatic")),e.dispatch(pp()))}};e.subscribe(r)};function eP(e,t,r={}){if(!Q1(e))throw ie;Xf(e.state.configuration.analytics.analyticsMode);let{...n}=yg(e,t,r),o=()=>e.state;return e.dispatch(ip(r.answerConfigurationId)),U1(e),{...n,get state(){let a=kS(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:hg(a?.citations??[]),error:Kf({message:a?.error?.message,code:a?.error?.code}),isLoading:a?.isLoading??!1,isStreaming:a?.isStreaming??!1,answerContentFormat:a?.contentFormat??"text/plain",isAnswerGenerated:a?.generated??!1,cannotAnswer:i.cannotAnswer||a?.generated===!1&&!a?.isLoading&&!a?.isStreaming}},retry(){let a=Wd(o());e.dispatch(fp(a??oa))},reset(){e.dispatch(dr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=L1({query:o().query.q,feedback:a,answerApiState:kS(e.state).data});e.dispatch(JT.endpoints.post.initiate(i)),e.dispatch(Wi())})()}}}function Q1(e){return e.addReducers({[pa.reducerPath]:pa.reducer,query:_o}),!0}function tP(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?eP(e,Ti,t):ZT(e,Ti,t);return{...n,get state(){return n.state},retry(){r(Re({legacy:Ti.logRetryGeneratedAnswer(),next:Ox()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function xn(e,t,r){if(!B1(e))throw ie;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Ku(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function B1(e){return e.addReducers({configuration:we}),!0}function rP(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return xn(e,r,()=>{o()})}function nP(e,t){return rP(e,{logCitationOpen:r=>By(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var z1=new oe({min:1,default:8,required:!1}),W1=new oe({min:1,max:20,default:5,required:!1}),Y1={desiredCount:W1,numberOfValues:z1},kHe=N("automaticFacet/setOptions",e=>q(e,Y1)),OHe=N("automaticFacet/deselectAll",e=>q(e,ve)),K1=H,oP=N("automaticFacet/toggleSelectValue",e=>q(e,{field:K1,selection:new Y({values:Va})}));var Us=fe(Xr(),e=>{e.addCase(Td,(t,r)=>{let n=Bv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Nu(n,o)}).addCase(Pd,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(Nt,t=>{t.firstResult=0}).addCase(kd,(t,r)=>{let n=r.payload;t.firstResult=Nu(n,t.numberOfResults)}).addCase(ao,(t,r)=>{let n=r.payload;t.firstResult=Nu(n,t.numberOfResults)}).addCase(_d,t=>{let r=Bv(t),n=Math.max(r-1,1);t.firstResult=Nu(n,t.numberOfResults)}).addCase(Od,t=>{let r=Bv(t),n=X1(t),o=Math.min(r+1,n);t.firstResult=Nu(o,t.numberOfResults)}).addCase(ot.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(st,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(qe.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(en.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(bt,t=>{Ht(t)}).addCase(yn,t=>{Ht(t)}).addCase(Eo,t=>{Ht(t)}).addCase(Cn,t=>{Ht(t)}).addCase(gm,t=>{Ht(t)}).addCase(Io,t=>{Ht(t)}).addCase(wo,t=>{Ht(t)}).addCase(Cs,t=>{Ht(t)}).addCase(om,t=>{Ht(t)}).addCase(hn,t=>{Ht(t)}).addCase(bn,t=>{Ht(t)}).addCase(er,t=>{Ht(t)}).addCase(Gn,t=>{Ht(t)}).addCase($n,t=>{Ht(t)}).addCase(mm,t=>{Ht(t)}).addCase(oP,t=>{Ht(t)})});function Ht(e){e.firstResult=Xr().firstResult}function Bv(e){let{firstResult:t,numberOfResults:r}=e;return Gv(t,r)}function X1(e){let{totalCountFiltered:t,numberOfResults:r}=e;return $v(t,r)}function Nu(e,t){return(e-1)*t}function Gv(e,t){return Math.round(e/t)+1}function $v(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Z1(e){return e.pagination.firstResult}function aP(e){return e.pagination.numberOfResults}function J1(e){return e.pagination.totalCountFiltered}var Do=e=>{let t=Z1(e),r=aP(e);return Gv(t,r)},Hv=e=>{let t=J1(e),r=aP(e);return $v(t,r)},iP=(e,t)=>{let r=Do(e),n=Hv(e),o=eG(r,t);return o=tG(o),o=rG(o,n),nG(o)};function eG(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,a=e-n,i=e+o;return{start:a,end:i}}function tG(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function rG(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function nG(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var zv=()=>ke("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Xr().numberOfResults}));var Qs=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var vg=()=>re("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:Do(t),...ee(t.insightCaseContext)})),Ag=()=>re("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:Do(t),...ee(t.insightCaseContext)})),bg=()=>re("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:Do(t),...ee(t.insightCaseContext)}));d();c();l();u();var oG=new De({numberOfPages:new oe({default:5,min:0})}),aG=new De({page:new oe({min:1})});function sP(e,t={}){if(!iG(e))throw ie;let r=Se(e),{dispatch:n}=e,o=yt(e,oG,t.options,"buildPager"),i=yr(e,aG,t.initialState,"buildPager").page;i&&n(kd(i));let p=()=>Do(e.state),m=()=>{let{numberOfPages:g}=o;return iP(e.state,g)},f=()=>Hv(e.state);return{...r,get state(){let g=p(),S=f(),C=g>1&&S>0,h=g<S;return{currentPage:g,currentPages:m(),maxPage:S,hasPreviousPage:C,hasNextPage:h}},selectPage(g){n(ao(g))},nextPage(){n(Od())},previousPage(){n(_d())},isCurrentPage(g){return g===this.state.currentPage}}}function iG(e){return e.addReducers({configuration:we,pagination:Us}),!0}function cP(e,t={}){let{dispatch:r}=e,n=sP(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Cd({legacy:vg(),next:Qs()}))},nextPage(){n.nextPage(),r(Cd({legacy:Ag(),next:Qs()}))},previousPage(){n.previousPage(),r(Cd({legacy:bg(),next:Qs()}))}}}d();c();l();u();d();c();l();u();function uP(e){if(!sG(e))throw ie;let t=Se(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function sG(e){return e.addReducers({search:Pe}),!0}function lP(e){return uP(e)}d();c();l();u();d();c();l();u();function dP(e){if(!cG(e))throw ie;let t=Se(e),r=Vs(e),n=()=>e.state,o=()=>{let a=n().search.duration/1e3;return Math.round((a+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function cG(e){return e.addReducers({search:Pe,pagination:Us}),!0}function pP(e){return dP(e)}d();c();l();u();d();c();l();u();function fP(_x234,_x235){return _fP.apply(this,arguments)}function _fP(){_fP=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:a}=e.insightConfiguration,i=e.query?.q||"";return{url:Oh({url:gt(n,o),accessToken:r,organizationId:n,insightId:a}),accessToken:r,organizationId:n,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0}});return _fP.apply(this,arguments)}d();c();l();u();var mP=e=>re("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=et(e,r),o=tt(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{action:"preview",itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Vr(t)}}});d();c();l();u();function gP(e,t,r,n,o){if(!uG(e))throw ie;let{dispatch:a}=e,i=()=>e.state,p=Se(e),{result:m,maximumPreviewSize:f}=t.options,g=()=>{let{resultsWithPreview:C,position:h}=i().resultPreview;return C[h]},S=C=>{a(Vd({uniqueId:C,requestedOutputSize:f,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Yc({uniqueId:C,requestedOutputSize:f})),o&&o()};return{...p,fetchResultContent(){S(m.uniqueId)},next(){a(qd()),S(g())},previous(){a(Md()),S(g())},get state(){let C=i(),h=m.hasHtmlVersion,y=C.resultPreview,x=m.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,E=y.contentURL,T=g();return{content:x,resultHasPreview:h,isLoading:w,contentURL:E,currentResultUniqueId:T}}}}function uG(e){return e.addReducers({configuration:we,resultPreview:Vi}),!0}function hP(e,t){if(!lG(e))throw ie;let r=()=>{e.dispatch(mP(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return gP(e,o,(a,i)=>fP(a,i),n,r)}function lG(e){return e.addReducers({configuration:we,resultPreview:Vi,insightInterface:ro}),!0}d();c();l();u();d();c();l();u();var yP=()=>re("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(ee(t.insightCaseContext))),SP=()=>re("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var dG={queries:new ae({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new oe({required:!0,min:1,default:10})},Du=N("recentQueries/registerRecentQueries",e=>q(e,dG)),Cg=N("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function vP(){return{queries:[],maxLength:10}}var AP=fe(vP(),e=>{e.addCase(Du,pG).addCase(Cg,fG).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||mG(n,t)})});function pG(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function fG(e){e.queries=[]}function mG(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var gG={queries:[]},hG={maxLength:10,clearFilters:!0},yG=new De({queries:new ae({required:!0})}),SG=new De({maxLength:new oe({required:!0,min:1}),clearFilters:new pe});function vG(e,t){yt(e,SG,t?.options,"buildRecentQueriesList"),yr(e,yG,t?.initialState,"buildRecentQueriesList")}function bP(e,t){if(!AG(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state,a={...hG,...t?.options},i={...gG,...t?.initialState};vG(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(Du(p)),{...r,get state(){let m=o();return{...m.recentQueries,analyticsEnabled:m.configuration.analytics.enabled}},clear(){n(Cg())},updateRecentQueries(m){let f=new ae({required:!0,each:new $({required:!0}),min:1}).validate(m);if(f)throw new Error(f);n(Du({queries:m,maxLength:a.maxLength}))},executeRecentQuery(m){let f=new oe({required:!0,min:0,max:this.state.queries.length}).validate(m);if(f)throw new Error(f);let g={q:this.state.queries[m],clearFilters:a.clearFilters};$u(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(qi(g))}}}function AG(e){return e.addReducers({search:Pe,recentQueries:AP,query:_o}),!0}function CP(e,t){let r=bP(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(yP()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Re({legacy:SP(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var bG={results:new ae({required:!0,each:new Y({values:od})}),maxLength:new oe({required:!0,min:1,default:10})},xg=N("recentResults/registerRecentResults",e=>q(e,bG)),Rn=N("recentResults/pushRecentResult",e=>(_t(e),{payload:e})),Rg=N("recentResults/clearRecentResults");d();c();l();u();var xP=e=>re("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logDocumentOpen(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Vr(t)}}});function RP(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(xP(t.options.result)))};return xn(e,t,()=>{n(),e.dispatch(Rn(t.options.result))})}d();c();l();u();function wP(e,t){return gg(e,{...t,fetchMoreResultsActionCreator:xd})}d();c();l();u();d();c();l();u();var CG=new De({numberOfResults:new oe({min:0})});function IP(e,t={}){if(!xG(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state,i=yr(e,CG,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(Td(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Pd(p))},isSetTo(p){return p===this.state.numberOfResults}}}function xG(e){return e.addReducers({pagination:Us,configuration:we}),!0}function EP(e,t={}){let r=IP(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Re({legacy:zv(),next:Qs()}))}}}d();c();l();u();d();c();l();u();var Wv=()=>ke("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),wg=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var Ig=()=>re("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var FP={id:H,query:Je},Bs=N("querySet/register",e=>q(e,FP)),Qa=N("querySet/update",e=>q(e,FP));d();c();l();u();var Gs=fe(yd(),e=>{e.addCase(Bs,(t,r)=>wG(t,r.payload)).addCase(Qa,(t,r)=>{let{id:n,query:o}=r.payload;Yv(t,n,o)}).addCase(ko,(t,r)=>{let{id:n,expression:o}=r.payload;Yv(t,n,o)}).addCase(qe.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;TP(t,n)}).addCase(st,RG).addCase(ot.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))Yv(t,n,o)})});function RG(e,t){J(t.payload.q)||TP(e,t.payload.q)}function TP(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var Yv=(e,t,r)=>{t in e&&(e[t]=r)},wG=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var PP=e=>ke("analytics/querySuggest",(t,r)=>{let n=IG(r,e);return t.makeOmniboxAnalytics(n)}),kP=()=>({actionCause:"omniboxAnalytics"});function IG(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let a=o.completions.map(f=>f.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",m=o.responseId;return{suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:a,querySuggestResponseId:m}}d();c();l();u();d();c();l();u();function OP(e,t){let r=t.id;r in e||(e[r]=EG(t))}function _P(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function NP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function DP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function EG(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var qP=()=>({});var Eg=fe(qP(),e=>e.addCase(Po,(t,r)=>{OP(t,r.payload)}).addCase(zT,(t,r)=>{delete t[r.payload.id]}).addCase(qs.pending,_P).addCase(qs.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(qs.rejected,NP).addCase(Oo,(t,r)=>{DP(t,r.payload)}).addCase(ji,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var MP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},Kv={open:new $,close:new $},FG={id:H,numberOfSuggestions:new oe({min:0}),enableQuerySyntax:new pe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:Kv}),exactMatchDelimiters:new Y({values:Kv}),correctionDelimiters:new Y({values:Kv})}}),clearFilters:new pe},VP=new De(FG);function jP(e,t){if(!PG(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||Hu("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...MP,...t.options};yt(e,VP,i,"buildSearchBox"),n(Bs({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(Po({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Yt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],m=/*#__PURE__*/function(){var _ref98=_asyncToGenerator(function*(f){let{enableQuerySyntax:g,clearFilters:S}=i;n(qi({q:p(),enableQuerySyntax:g,clearFilters:S})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(f)):n(t.executeSearchActionCreator(f.legacy))});return function m(_x236){return _ref98.apply(this,arguments)}}();return{...r,updateText(f){n(Qa({id:a,query:f})),this.showSuggestions()},clear(){n(Qa({id:a,query:""})),n(Oo({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(f){n(ko({id:a,expression:f})),m({legacy:PP({id:a,suggestion:f}),next:kP()}).then(()=>{n(Oo({id:a}))})},submit(f=Wv(),g){m({legacy:f,next:g}),n(Oo({id:a}))},get state(){let f=o(),g=f.querySuggest[i.id],S=TG(g,i.highlightOptions),C=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:S,isLoading:f.search.isLoading,isLoadingSuggestions:C}}}}function TG(e,t){return e?e.completions.map(r=>({highlightedValue:sh(r.highlighted,t),rawValue:r.expression})):[]}function PG(e){return e.addReducers({query:_o,querySuggest:Eg,configuration:we,querySet:Gs,search:Pe}),!0}function LP(e,t={}){let r=jP(e,{...t,executeSearchActionCreator:Re,fetchQuerySuggestionsActionCreator:Rd,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(Ig(),wg())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var Fg=()=>({actionCause:"resultsSort"});function UP(e,t){return e.q!==t.q?wg():e.sortCriteria!==t.sortCriteria?Fg():$s(e.f,t.f)?Hs(e.f,t.f):$s(e.fExcluded,t.fExcluded)?Hs(e.fExcluded,t.fExcluded,!0):$s(e.cf,t.cf)?Hs(e.cf,t.cf):$s(e.af,t.af)?Hs(e.af,t.af):$s(e.nf,t.nf)?Hs(Tg(e.nf),Tg(t.nf)):$s(e.df,t.df)?Hs(Tg(e.df),Tg(t.df)):wi()}function $s(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Hs(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];return e[C].length>1?ir():Qn()}if(o.filter(C=>!n.includes(C)).length)return r?pm():mr();let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return wi();let m=e[p],f=t[p];return f.filter(C=>!m.includes(C)).length?r?pm():mr():m.filter(C=>!f.includes(C)).length?Qn():wi()}function Tg(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var zs=()=>re("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||lr(),...ee(t.insightCaseContext)}));function GP(e,t){return e.q!==t.q?Ig():e.sortCriteria!==t.sortCriteria?zs():qu(e.f,t.f)?qu(e.cf,t.cf)?qu(e.nf,t.nf)?qu(e.df,t.df)?qu(e.fExcluded,t.fExcluded)?oo():kG(e.fExcluded,t.fExcluded):BP(e.df,t.df):BP(e.nf,t.nf):Pg(e.cf,t.cf):Pg(e.f,t.f)}function qu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function QP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function Pg(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];return e[C].length>1?Bt(C):(r?Es:Lr)({facetId:C,facetValue:e[C][0]})}let i=o.filter(C=>!n.includes(C));if(i.length){let C=i[0];return Kt({facetId:C,facetValue:t[C][0]})}let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return oo();let m=e[p],f=t[p],g=f.filter(C=>!m.includes(C));if(g.length)return Kt({facetId:p,facetValue:g[0]});let S=m.filter(C=>!f.includes(C));return S.length?(r?Es:Lr)({facetId:p,facetValue:S[0]}):oo()}function BP(e={},t={}){return Pg(QP(e),QP(t))}function kG(e={},t={}){return Pg(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:$P,getOwnPropertySymbols:OG}=Object,{hasOwnProperty:_G}=Object.prototype;function Mu(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function Vu(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:a}=o,i=a.get(r),p=a.get(n);if(i&&p)return i===n&&p===r;a.set(r,n),a.set(n,r);let m=e(r,n,o);return a.delete(r),a.delete(n),m}}function HP(e){let t=OG(e);return t.length?$P(e).concat(t):$P(e)}var NG=Object.hasOwn||((e,t)=>_G.call(e,t)),DG="__v",qG="__o",MG="_owner",VG=typeof Float16Array<"u",{getOwnPropertyDescriptor:zP,keys:WP}=Object,Ba=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function jG(e,t){return e===t}function LG(e,t){return e.byteLength===t.byteLength&&kg(new Uint8Array(e),new Uint8Array(t))}function UG(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function QG(e,t){return e.byteLength===t.byteLength&&kg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function BG(e,t){return Ba(e.getTime(),t.getTime())}function YP(e,t,r){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&r.equals(e.cause,t.cause,"cause","cause",e,t,r)}function KP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.entries(),i,p,m=0;for(;(i=a.next())&&!i.done;){let f=t.entries(),g=0,S=0;for(;(p=f.next())&&!p.done;){if(o[S]){S++;continue}let C=i.value,h=p.value;if(r.equals(C[0],h[0],m,S,e,t,r)&&r.equals(C[1],h[1],C[0],h[0],e,t,r)){g=o[S]=1;break}S++}if(!g)return!1;m++}return!0}function XP(e,t,r){let n=WP(e),o=n.length;if(WP(t).length!==o)return!1;for(;o-->0;)if(!ek(e,t,r,n[o]))return!1;return!0}function Ws(e,t,r){let n=HP(e),o=n.length;if(HP(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!ek(e,t,r,a)||(i=zP(e,a),p=zP(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function GG(e,t){return Ba(e.valueOf(),t.valueOf())}function $G(e,t){return e.source===t.source&&e.flags===t.flags}function ZP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let m=t.values(),f=0,g=0;for(;(p=m.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){f=o[g]=1;break}g++}if(!f)return!1}return!0}function kg(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||VG&&e instanceof Float16Array){for(;r-->0;)if(e[r]!==t[r]&&(e[r]===e[r]||t[r]===t[r]))return!1;return!0}for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function HG(e,t){return e.href===t.href?!0:e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&zG(e.searchParams,t.searchParams)}function zG(e,t){let r=e.toString(),n=t.toString();return r===n||JP(r)===JP(n)}function JP(e){return e.split("&").sort().join("&")}function ek(e,t,r,n){return(n===MG||n===qG||n===DG)&&(e.$$typeof||t.$$typeof)?!0:NG(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var WG=Object.prototype.toString;function YG(e){let t=JG(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:m,areSetsEqual:f,getUnsupportedCustomComparator:g}=e;return function(C,h,y){if(C===h)return!0;if(C==null||h==null)return!1;let x=typeof C;if(x!==typeof h)return!1;if(x!=="object")return x==="number"||x==="bigint"?i(C,h,y):x==="function"?o(C,h,y):!1;let w=C.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(C,h,y);if(w===Array)return r(C,h,y);if(w===Date)return n(C,h,y);if(w===RegExp)return m(C,h,y);if(w===Map)return a(C,h,y);if(w===Set)return f(C,h,y);if(w===Promise)return!1;if(Array.isArray(C))return r(C,h,y);let E=WG.call(C),T=t[E];if(T)return T(C,h,y);let F=g&&g(C,h,y,E);return F?F(C,h,y):!1}}function KG({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:LG,areArraysEqual:r?Ws:UG,areDataViewsEqual:QG,areDatesEqual:BG,areErrorsEqual:r?Mu(YP,Ws):Mu(YP,XP),areFunctionsEqual:jG,areMapsEqual:r?Mu(KP,Ws):KP,areNumbersEqual:Ba,areObjectsEqual:r?Ws:XP,arePrimitiveWrappersEqual:GG,areRegExpsEqual:$G,areSetsEqual:r?Mu(ZP,Ws):ZP,areTypedArraysEqual:r?Mu(kg,Ws):kg,areUrlsEqual:HG,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=Vu(n.areArraysEqual),a=Vu(n.areErrorsEqual),i=Vu(n.areMapsEqual),p=Vu(n.areObjectsEqual),m=Vu(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:a,areMapsEqual:i,areObjectsEqual:p,areSetsEqual:m})}return n}function XG(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function ZG({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,m){let{cache:f=e?new WeakMap:void 0,meta:g}=r();return t(p,m,{cache:f,equals:n,meta:g,strict:o})};if(e)return function(p,m){return t(p,m,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let a={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,m){return t(p,m,a)}}function JG({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areObjectsEqual:p,arePrimitiveWrappersEqual:m,areRegExpsEqual:f,areSetsEqual:g,areTypedArraysEqual:S,areUrlsEqual:C}){return{"[object Arguments]":p,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":m,"[object BigInt64Array]":S,"[object BigUint64Array]":S,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":S,"[object Float32Array]":S,"[object Float64Array]":S,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":S,"[object Int16Array]":S,"[object Int32Array]":S,"[object Map]":i,"[object Number]":m,"[object Object]":(h,y,x)=>typeof h.then!="function"&&typeof y.then!="function"&&p(h,y,x),"[object RegExp]":f,"[object Set]":g,"[object String]":m,"[object URL]":C,"[object Uint8Array]":S,"[object Uint8ClampedArray]":S,"[object Uint16Array]":S,"[object Uint32Array]":S}}var Xv=wn(),WKe=wn({strict:!0}),YKe=wn({circular:!0}),KKe=wn({circular:!0,strict:!0}),XKe=wn({createInternalComparator:()=>Ba}),ZKe=wn({strict:!0,createInternalComparator:()=>Ba}),JKe=wn({circular:!0,createInternalComparator:()=>Ba}),e7e=wn({circular:!0,createInternalComparator:()=>Ba,strict:!0});function wn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=KG(e),i=YG(a),p=r?r(i):XG(i);return ZG({circular:t,comparator:i,createState:n,equals:p,strict:o})}function tk(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function e2(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Zv(r,n))!==-1)}var Zv=wn({createCustomConfig:e=>({...e,areArraysEqual:e2})});d();c();l();u();d();c();l();u();function rk(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function nk(e,t,r){if(e===void 0)return{};let n=t(e);return!Xv(n,r)?{sortCriteria:n}:{}}function Og(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let p=r(i);return p.length?{[a]:p}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}function ok(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function ak(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??_n().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??_n().defaultFilters.cq,firstResult:Xr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Xr().defaultNumberOfResults,sortCriteria:lr(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:gd(),sf:{},tab:"",af:{},mnf:{}}}var t2=new De({parameters:new Y({options:{required:!0},values:gp})});function ck(e,t){let{dispatch:r}=e,n=Se(e);yr(e,t2,t.initialState,"buildSearchParameterManager");let o=ik(e.state.tabSet,t.initialState.parameters);return r(st(o)),{...n,synchronize(a){let i=ik(e.state.tabSet,_g(e,a));r(st(i))},get state(){return{parameters:Jv(e)}}}}function _g(e,t){let n={...ak(e.state),...t},o={};if(e.state.dateFacetSet)for(let i of Object.keys(e.state.dateFacetSet))o[i]=[];let a={};if(e.state.numericFacetSet)for(let i of Object.keys(e.state.numericFacetSet))a[i]=[];return{...n,df:{...o,...n.df},nf:{...a,...n.nf}}}function ik(e,t){if(J(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:sk(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??sk(e)}}return t}function sk(e){return Object.keys(e)[0]??""}function Jv(e){let t=e.state;return{...rk(t.query,r=>r.q,ut().q),...ok(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...nk(t.sortCriteria,r=>r,lr()),...n2(t),...o2(t),...a2(t),...i2(t),...s2(t)}}function r2(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function Ng(e){let t=r2(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=ar(n?.tabs,t);return o&&a}}function uk(e){return e.currentValues.filter(t=>t.state==="selected")}function n2(e){let t=e.facetSet;if(t===void 0)return{};let r=Ng(e),n={},o={};for(let[a,{request:i}]of Object.entries(t)){if(!r(a))continue;let p=i.currentValues.filter(f=>f.state==="selected").map(f=>f.value),m=i.currentValues.filter(f=>f.state==="excluded").map(f=>f.value);p.length&&(n[a]=p),m.length&&(o[a]=m)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function o2(e){return Og(e.categoryFacetSet,Ng(e),t=>zr(t.currentValues).map(r=>r.value),"cf")}function a2(e){return Og(e.numericFacetSet,Ng(e),uk,"nf")}function i2(e){return Og(e.dateFacetSet,Ng(e),uk,"df")}function s2(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=c2(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function c2(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function lk(e,t){let{dispatch:r}=e,n=ck(e,t);return{...n,synchronize(o){let a=Jv(e),i=_g(e,a),p=_g(e,o);Zv(i,p)||(n.synchronize(o),r(Re({legacy:GP(i,p),next:UP(i,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var ju=()=>new Y({values:{questionAnswerId:H},options:{required:!0}}),Dg=()=>new Y({values:{linkText:Je,linkURL:Je},options:{required:!0}});function Ga(e){return q(e,ju())}d();c();l();u();function mt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&gR(e,r.contentIdKey,r.contentIdValue)}function Er(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var dk={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var u2=()=>re("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),l2=()=>re("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),d2=()=>re("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),p2=()=>re("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),f2=()=>re("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=mt(t);return e.logOpenSmartSnippetSource(et(r,t),tt(r),ee(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),eA=e=>re("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{q(e,Dg());let n=mt(r);return t.logOpenSmartSnippetInlineLink(et(n,r),{...tt(n),...e},ee(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),m2=()=>re("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(ee(t.insightCaseContext))),g2=()=>re("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(ee(t.insightCaseContext))),h2=e=>re("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:dk[e]}}}),y2=e=>re("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),S2=e=>re("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Ga(e);let n=Er(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Er(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),v2=e=>re("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Ga(e);let n=Er(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Er(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),tA=e=>re("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{q(e,ju());let n=Er(r,e.questionAnswerId);if(!n)return null;let o=mt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(et(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Er(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),pk=(e,t)=>re("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{q(e,ju()),q(t,Dg());let o=Er(n,e.questionAnswerId);if(!o)return null;let a=mt(n,o.documentId);return a?r.logOpenSmartSnippetSuggestionInlineLink(et(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},ee(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Er(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=mt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),qg={logExpandSmartSnippet:u2,logCollapseSmartSnippet:l2,logLikeSmartSnippet:d2,logDislikeSmartSnippet:p2,logOpenSmartSnippetSource:f2,logOpenSmartSnippetInlineLink:eA,logOpenSmartSnippetFeedbackModal:m2,logCloseSmartSnippetFeedbackModal:g2,logSmartSnippetFeedback:h2,logSmartSnippetDetailedFeedback:y2,logExpandSmartSnippetSuggestion:S2,logCollapseSmartSnippetSuggestion:v2,logOpenSmartSnippetSuggestionSource:tA};d();c();l();u();d();c();l();u();var Ys=N("smartSnippet/expand"),Ks=N("smartSnippet/collapse"),Xs=N("smartSnippet/like"),Zs=N("smartSnippet/dislike"),Js=N("smartSnippet/feedbackModal/open"),qo=N("smartSnippet/feedbackModal/close"),ec=N("smartSnippet/related/expand",e=>Ga(e)),tc=N("smartSnippet/related/collapse",e=>Ga(e));d();c();l();u();d();c();l();u();var rA=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var fk=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function mk({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Za({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function A2(e,t){let r=mk(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var In=fe(rA(),e=>e.addCase(Ys,t=>{t.expanded=!0}).addCase(Ks,t=>{t.expanded=!1}).addCase(Xs,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Zs,t=>{t.liked=!1,t.disliked=!0}).addCase(Js,t=>{t.feedbackModalOpen=!0}).addCase(qo,t=>{t.feedbackModalOpen=!1}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>A2(a,t.relatedQuestions[i])),o=mk(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...rA(),relatedQuestions:n,questionAnswerId:o}}).addCase(ec,(t,r)=>{let n=fk(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(tc,(t,r)=>{let n=fk(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function gk(e,t,r){if(!b2(e))throw ie;let n=Se(e),o=()=>e.state,a=()=>mt(o()),i=null,p=xn(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let m=a();if(!m){i=null;return}let{searchResponseId:f}=o().search;i!==f&&(i=f,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(Rn(m)))});return{...n,get state(){let m=o();return{question:m.search.questionAnswer.question,answer:m.search.questionAnswer.answerSnippet,documentId:m.search.questionAnswer.documentId,expanded:m.questionAnswering.expanded,answerFound:m.search.questionAnswer.answerSnippet!=="",liked:m.questionAnswering.liked,disliked:m.questionAnswering.disliked,feedbackModalOpen:m.questionAnswering.feedbackModalOpen,source:a()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Ys())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ks())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Xs())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Zs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Js())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(qo())},sendFeedback(m){e.dispatch(t.logSmartSnippetFeedback(m)),e.dispatch(qo())},sendDetailedFeedback(m){e.dispatch(t.logSmartSnippetDetailedFeedback(m)),e.dispatch(qo())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function b2(e){return e.addReducers({search:Pe,questionAnswering:In}),!0}d();c();l();u();function Mg(e,t){if(!C2(e))throw ie;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),a=null,i=g=>{a!==g&&(a=g,m={},n.clear())},p=(g,S,C)=>xn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(S)||e.dispatch(C?pk({questionAnswerId:C},g):eA(g))}),m={},f=(g,S)=>{let{searchResponseId:C}=r().search;i(C);let h=Za({...g,questionAnswerId:S});return h in m||(m[h]=p(g,h,S)),m[h]};return{selectInlineLink(g,S){f(g,S)?.select()},beginDelayedSelectInlineLink(g,S){f(g,S)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,S){f(g,S)?.cancelPendingSelect()}}}function C2(e){return e.addReducers({search:Pe,questionAnswering:In}),!0}function hk(e,t){let r=gk(e,qg,t),n=Mg(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function yk(e,t){if(!x2(e))throw ie;let r=Se(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(m=>fo(m,i)===p)};return{...r,get state(){let a=n();return{questions:a.search.questionAnswer.relatedQuestions.map((i,p)=>({question:i.question,answer:i.answerSnippet,documentId:i.documentId,questionAnswerId:a.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:a.questionAnswering.relatedQuestions[p].expanded,source:o(i.documentId)}))}},expand(a){let i={questionAnswerId:a};e.dispatch(t.logExpandSmartSnippetSuggestion(i)),e.dispatch(ec(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(tc(i))}}}function x2(e){return e.addReducers({search:Pe,questionAnswering:In}),!0}d();c();l();u();function Sk(e,t){if(!R2(e))throw ie;let r=()=>e.state,n=S=>{let C=r(),h=Er(C,S);return h?mt(C,h.documentId):null},o=new Set,a=S=>o.has(S)?!0:(o.add(S),!1),i=null,p=S=>{i!==S&&(i=S,f={},o.clear())},m=(S,C)=>xn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(C)||(e.dispatch(tA({questionAnswerId:C})),e.dispatch(Rn(S)))}),f={},g=S=>{let{searchResponseId:C}=r().search;p(C);let h=n(S);return h?(S in f||(f[S]=m(h,S)),f[S]):null};return{selectSource(S){g(S)?.select()},beginDelayedSelectSource(S){g(S)?.beginDelayedSelect()},cancelPendingSelectSource(S){g(S)?.cancelPendingSelect()}}}function R2(e){return e.addReducers({search:Pe,questionAnswering:In}),!0}function vk(e,t){let r=yk(e,qg),n=Mg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=Sk(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(a){o.selectSource(a)},beginDelayedSelectSource(a){o.beginDelayedSelectSource(a)},cancelPendingSelectSource(a){o.cancelPendingSelectSource(a)},selectInlineLink(a,i){n.selectInlineLink(i,a)},beginDelayedSelectInlineLink(a,i){n.beginDelayedSelectInlineLink(i,a)},cancelPendingSelectInlineLink(a,i){n.cancelPendingSelectInlineLink(i,a)}}}d();c();l();u();d();c();l();u();d();c();l();u();var Ak={by:new uc({enum:Zl,required:!0})},Vg=N("sortCriteria/register",e=>bk(e)),jg=N("sortCriteria/update",e=>bk(e)),bk=e=>Xa(e)?(e.forEach(t=>q(t,Ak)),{payload:e}):q(e,Ak);d();c();l();u();var Ck=fe(lr(),e=>{e.addCase(Vg,(t,r)=>Wr(r.payload)).addCase(jg,(t,r)=>Wr(r.payload)).addCase(ot.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(st,(t,r)=>r.payload.sortCriteria??t)});function w2(e,t){if(!t)return;let r=new De({criterion:new ae({each:cx})}),n=I2(t),o={...t,criterion:n};yr(e,r,o,"buildSort")}function I2(e){return e.criterion?Xa(e.criterion)?e.criterion:[e.criterion]:[]}function xk(e,t){if(!E2(e))throw ie;let r=Se(e),{dispatch:n}=e,o=()=>e.state;w2(e,t.initialState);let a=t.initialState?.criterion;return a&&n(Vg(a)),{...r,sortBy(i){n(jg(i)),n(ao(1))},isSortedBy(i){return this.state.sortCriteria===Wr(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function E2(e){return e.addReducers({configuration:we,sortCriteria:Ck}),!0}function Rk(e,t={}){let{dispatch:r}=e,n=xk(e,t),o=()=>r(Re({legacy:zs(),next:Fg()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();function wk(e){return Vs(e)}d();c();l();u();d();c();l();u();var F2=new De({expression:Je,id:H,clearFiltersOnTabChange:new pe}),T2=new De({isActive:new pe});function Ik(e,t){if(k2(t.options.id),!P2(e))throw ie;let r=Se(e),{dispatch:n}=e;yt(e,F2,t.options,"buildTab");let o=yr(e,T2,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(yp({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(Nt(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(qi({q:"",clearFilters:!0})),n(Nt(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function P2(e){return e.addReducers({configuration:we,tabSet:jm}),!0}function k2(e){let t=vp().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function Ek(e,t){let{dispatch:r}=e,n=Ik(e,t),o=()=>r(Re({legacy:oo(),next:wi()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var Fk=()=>re("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},ee(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function Tk(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function Pk(e,t){let r=[],n=[],o=[],a=[];return t.forEach(i=>{switch(i.type){case"redirect":r.push(i.content);break;case"query":n.push(i.content);break;case"execute":o.push({functionName:i.content.name,params:i.content.params});break;case"notify":a.push(i.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=a,e}function kk(e,t){return e.queryModification={...t,queryToIgnore:""},e}function Ok(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var _k=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var Nk=fe(_k(),e=>e.addCase(qe.pending,Tk).addCase(qe.fulfilled,(t,r)=>Pk(t,r.payload.response.triggers)).addCase(Di,(t,r)=>kk(t,r.payload)).addCase(Ni,(t,r)=>Ok(t,r.payload)));function Dk(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!O2(e))throw ie;let n=Se(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let m=()=>{let f=!tk(i,this.state.notifications);i=this.state.notifications,f&&(p(),o(r()))};return m(),e.subscribe(m)},get state(){return{notifications:a().triggers.notifications}}}}function O2(e){return e.addReducers({triggers:Nk}),!0}function qk(e){return Dk(e,{options:{logNotifyTriggerActionCreator:Fk}})}d();c();l();u();d();c();l();u();var Mk=(e,t)=>re("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=ee(n.insightCaseContext),a={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(a)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=ee(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),Vk=e=>re("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(q(e,{articleType:H}),t.logCreateArticle(e,ee(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=ee(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Lg=()=>re("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(ee(t.insightCaseContext))});d();c();l();u();d();c();l();u();var jk=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:gt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function jk(_x237,_x238){return _ref99.apply(this,arguments)}}();var _2={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new ae({required:!1,each:Ze})},rc=N("insight/userActions/registerUserActions",e=>q(e,_2)),Mo=me("insight/userActions/fetch",/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield n.userActions(yield jk(o,e));return Xe(a)?r(a.error):{response:a.success}});return function(_x239,_x240){return _ref100.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function Lk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var N2=1e3,D2=N2*60,nA=30*D2,q2=2,M2=2,Bk=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,a=j2(t);return U2(a,n,o)},V2=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},j2=e=>{let t=!1,r=e.reduce((n,o)=>{try{let a=V2(o);n.push(a)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},L2=(e,t)=>Math.abs(e.timestamp-t)<nA,Uk=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-nA&&t<=e.end+nA){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(a=>a.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},Qk=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},U2=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(a=>{if(L2(a,o.start)){o.actions.push(a),o.start=a.timestamp;return}o.actions=o.actions.filter(i=>!Qk(i,r)),Uk(o,t,n),o={start:a.timestamp,end:a.timestamp,actions:[a]}}),o.actions=o.actions.filter(a=>!Qk(a,r)),Uk(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,q2),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-M2)}};var Ug=fe(Lk(),e=>{e.addCase(rc,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(Mo.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Mo.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Mo.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=Bk(t,r.payload.response.value)})});function Gk(e,t){if(!Q2(e))throw ie;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=Se(e),{ticketCreationDate:a,excludedCustomActions:i}=t.options;return r(rc({ticketCreationDate:a,excludedCustomActions:i})),{...o,get state(){return n()},fetchUserActions(p){r(Mo(p))},logOpenUserActions(){r(Lg())}}}function Q2(e){return e.addReducers({configuration:we,insightUserActions:Ug}),!0}d();c();l();u();function $k(e){if(!B2(e))throw ie;let t=Se(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(Yr())}}}function B2(e){return e.addReducers({configuration:we,insightConfiguration:ud,insightInterface:ro,searchHub:Ld}),!0}d();c();l();u();function G2(e){return e.addReducers({}),{logSearchEvent:Cx,logClickEvent:xx,logCustomEvent:Rx}}d();c();l();u();d();c();l();u();var Hk=e=>re("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCopyToClipboard(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Vr(t)}}}),zk=e=>re("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logCaseSendEmail(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Vr(t)}}}),Wk=e=>re("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{_t(e);let n=ee(r.insightCaseContext);return t.logFeedItemTextPost(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Vr(t)}}});function $2(e){return e.addReducers({}),{logClearBreadcrumbs:ym,logInterfaceLoad:vd,logInterfaceChange:oo,logCreateArticle:Vk,logCategoryFacetBreadcrumb:nm,logFacetBreadcrumb:wu,logFacetClearAll:Bt,logFacetDeselect:Lr,logFacetSelect:Kt,logFacetShowLess:Ts,logFacetShowMore:Fs,logFacetUpdateSort:mn,logDateFacetBreadcrumb:Iu,logNumericFacetBreadcrumb:Eu,logPageNext:Ag,logPageNumber:vg,logPagePrevious:bg,logResultsSort:zs,logStaticFilterDeselect:Dm,logCopyToClipboard:Hk,logCaseSendEmail:zk,logFeedItemTextPost:Wk,logOpenUserActions:Lg}}d();c();l();u();function H2(e){return e.addReducers({attachedResults:Ro}),{setAttachedResults:em,detachResult:xo,attachResult:Co}}d();c();l();u();function z2(e){return e.addReducers({attachedResults:Ro}),{logCaseDetach:Ss,logCaseAttach:ys}}d();c();l();u();d();c();l();u();d();c();l();u();var Qg=N("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=q(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ae({each:Je}),a=q(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Bg=N("insight/caseId/set",e=>{let r=q(e,Je).error;return r?{payload:e,error:r}:{payload:e}}),Gg=N("insight/caseNumber/set",e=>{let r=q(e,Je).error;return r?{payload:e,error:r}:{payload:e}});var Yk=fe(kx(),e=>{e.addCase(Qg,(t,r)=>{t.caseContext=r.payload}).addCase(Bg,(t,r)=>{t.caseId=r.payload}).addCase(Gg,(t,r)=>{t.caseNumber=r.payload})});function W2(e){return e.addReducers({insightCaseContext:Yk}),{setCaseContext:Qg,setCaseId:Bg,setCaseNumber:Gg}}d();c();l();u();d();c();l();u();d();c();l();u();var Y2=new ae({each:H,required:!0}),Kk=(e,t)=>(q(e,H),Ka(t)?q(t,H):q(t,Y2),{payload:{contextKey:e,contextValue:t}}),$g=N("context/set",e=>{for(let[t,r]of Object.entries(e))Kk(t,r);return{payload:e}}),Hg=N("context/add",e=>Kk(e.contextKey,e.contextValue)),zg=N("context/remove",e=>q(e,H));var Xk=fe(md(),e=>{e.addCase($g,(t,r)=>{t.contextValues=r.payload}).addCase(Hg,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(zg,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ot.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function K2(e){return e.addReducers({context:Xk}),{addContext:Hg,removeContext:zg,setContext:$g}}d();c();l();u();function X2(e){return e.addReducers({dateFacetSet:vn}),{deselectAllDateFacetValues:Am,registerDateFacet:gn,toggleSelectDateFacetValue:hn,toggleExcludeDateFacetValue:yn,updateDateFacetSortCriterion:vm,updateDateFacetValues:Gn}}d();c();l();u();function Z2(e){return e.addReducers({numericFacetSet:Fo}),{deselectAllNumericFacetValues:_m,registerNumericFacet:An,toggleSelectNumericFacetValue:bn,toggleExcludeNumericFacetValue:Cn,updateNumericFacetSortCriterion:Om,updateNumericFacetValues:$n}}d();c();l();u();function J2(e){return e.addReducers({fields:Ms}),{registerFieldsToInclude:No,enableFetchAllFields:pg,disableFetchAllFields:fg,fetchFieldsDescription:mg}}d();c();l();u();function e$(e){return e.addReducers({folding:dg}),{registerFolding:BT,loadCollection:cg}}d();c();l();u();function t$(e){return e.addReducers({generatedAnswer:js}),{generateAnswer:pp,resetAnswer:dr,setAnswerGenerationMode:Hi}}d();c();l();u();function r$(e){return e.addReducers({insightInterface:ro}),{fetch:Yr}}d();c();l();u();function n$(e){return e.addReducers({querySet:Gs}),{registerQuerySetQuery:Bs,updateQuerySetQuery:Qa}}d();c();l();u();function o$(e){return e.addReducers({search:Pe}),{executeSearch:zx,fetchFacetValues:Kx,fetchMoreResults:Yx,fetchPage:Wx,fetchQuerySuggestions:Rd,registerQuerySuggest:Po}}d();c();l();u();function a$(e){return e.addReducers({}),{logContextChanged:Bx,logExpandToFullUI:Mk}}d();c();l();u();function i$(e){return e.addReducers({insightUserActions:Ug}),{registerUserActions:rc,fetchUserActions:Mo}}d();c();l();u();function s$(e){return e.addReducers({querySuggest:Eg,querySet:Gs}),{clearQuerySuggest:Oo,fetchQuerySuggestions:qs,registerQuerySuggest:Po,selectQuerySuggestion:ko}}d();c();l();u();function c$(e){return e.addReducers({questionAnswering:In}),{collapseSmartSnippet:Ks,expandSmartSnippet:Ys,dislikeSmartSnippet:Zs,likeSmartSnippet:Xs,openFeedbackModal:Js,closeFeedbackModal:qo,expandSmartSnippetRelatedQuestion:ec,collapseSmartSnippetRelatedQuestion:tc}}d();c();l();u();d();c();l();u();d();c();l();u();function Zk(){return{results:[],maxLength:10}}var Jk=fe(Zk(),e=>{e.addCase(xg,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(Rg,t=>{t.results=[]}).addCase(Rn,(t,r)=>{let n=r.payload;t.results=t.results.filter(a=>a.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function u$(e){return e.addReducers({recentResults:Jk}),{registerRecentResults:xg,clearRecentResults:Rg,pushRecentResult:Rn}}d();c();l();u();d();c();l();u();var l$=new De({content:new Ke({required:!0}),conditions:new Ke({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ae({required:!1,each:H})});function eO(){let e=[],t=r=>{let n=l$.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Vo("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(a=>a(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(a=>a(r)));return n?n.linkContent:null}}}function tO(e){if(!d$(e))throw ie;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=eO();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(No(a))},selectTemplate:r,selectLinkTemplate:n}}function d$(e){return e.addReducers({fields:Ms}),!0}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Wf(e){e==="next"&&console.warn(KQ)}d();c();l();u();var oF=Pr(nF(),1);function iF(e){return(0,oF.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function aF(e,t){let r=mB(e),n=yr,o=gB(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function mB(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function gB(e){return e.preprocessRequest||tl}d();c();l();u();d();c();l();u();var sF={organizationId:H,accessToken:H,name:new B({required:!1,emptyAllowed:!1}),analytics:new W({options:{required:!1},values:{enabled:new de({required:!1}),originContext:new B({required:!1}),originLevel2:new B({required:!1}),originLevel3:new B({required:!1}),analyticsMode:new B({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new B({required:!1,url:!0}),trackingId:new B({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new de({required:!1})}}),environment:new B({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function cF(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var uF=new De({...sF,insightId:H,search:new W({options:{required:!1},values:{locale:Ze}})}),hB="2729db39-d7fd-4504-a06e-668c64968c95";function Ov(){return{...cF(),insightId:hB}}var yB={insightConfiguration:ad,search:Te,insightInterface:to,searchHub:Md,resultPreview:Va};function SB(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function lF(e){let t=iF(e.loggerOptions);vB(e.configuration,t);let r=AB(e.configuration,t),n=CB(t),o={...aF(e.configuration,t),apiClient:r,streamingClient:n,generatedAnswerAnalyticsClient:Ta},i={...e,reducers:yB},a=WE(i,o);Wf(a.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,m=SB(e.configuration);return a.dispatch(id({insightId:p})),a.dispatch(Wr()),m&&a.dispatch(Ea(m)),{...a,get state(){return a.state},executeFirstSearch(f=hd()){qd(a.state)||a.dispatch(xe({legacy:f,next:Fx()}))}}}function vB(e,t){try{uF.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function AB(e,t){return new rl({logger:t,preprocessRequest:e.preprocessRequest||tl})}function CB(e){return new el({logger:e})}d();c();l();u();function ye(e){let t,r=new Map,n=()=>r.size===0,o,i=a=>{try{let p=JSON.stringify(a),m=t!==p;return t=p,m}catch(p){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",p),!0}};return{subscribe(a){a();let p=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&r.forEach(m=>m())})),r.set(p,a),()=>{r.delete(p),n()&&(o?.(),o=void 0)}},get state(){return{}}}}d();c();l();u();d();c();l();u();var dF={articleLanguage:Ze,articlePublishStatus:Ze,articleVersionNumber:Ze,caseId:H,knowledgeArticleId:Ze,name:Ze,permanentId:Ze,resultUrl:Ze,source:Ze,title:H,uriHash:Ze,isAttachedFromCitation:new de({required:!1,default:!1})},bB=new W({options:{required:!0},values:dF}),Xf=N("insight/attachToCase/setAttachedResults",e=>q(e,{results:new ie({each:bB}),loading:new de({required:!1,default:!1})})),Co=N("insight/attachToCase/attach",e=>pF(e)),bo=N("insight/attachToCase/detach",e=>pF(e)),pF=e=>ee(e.permanentId)&&ee(e.uriHash)?{payload:e,error:kr(new Mo("Either permanentId or uriHash is required"))}:q(e,dF);d();c();l();u();d();c();l();u();var Vr=e=>{let t=te(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var ys=e=>ne("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{_t(e);let n=te(r.insightCaseContext);return t.logCaseAttach(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Vr(t)}}}),Ss=e=>ne("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,te(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:_r(e,t),context:Vr(t)})});d();c();l();u();d();c();l();u();function fF(){return{results:[],loading:!1}}var xo=pe(fF(),e=>{e.addCase(Xf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(Co,(t,r)=>{(!ee(r.payload.permanentId)||!ee(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(bo,(t,r)=>{t.results=t.results.filter(n=>xB(n,r.payload))})}),xB=(e,t)=>{let r=!ee(e.permanentId)&&e?.permanentId===t?.permanentId,n=!ee(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Zf=(e,t)=>Ki(e.raw[t])?String(e.raw[t]):void 0,vs=(e,t)=>({articleLanguage:Zf(e,"sflanguage"),articleVersionNumber:Zf(e,"sflanguage"),articlePublishStatus:Zf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Zf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function mF(e,t){if(!RB(e))throw ae;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=ye(e),{result:i,caseId:a}=t.options,p=()=>ee(a)||ee(i.raw.permanentid)&&ee(i.raw.urihash)?!1:e.state.attachedResults.results.some(m=>{let f=a===m.caseId,g=!ee(m.permanentId)&&m.permanentId===i.raw.permanentid,S=!ee(m.uriHash)&&m.uriHash===i.raw.urihash;return f&&(g||S)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(Co(vs(i,a))),r(ys(i))},detach(){r(bo(vs(i,a))),r(Ss(i))}}}function RB(e){return e.addReducers({configuration:Re,attachedResults:xo}),!0}d();c();l();u();function gF(e,t){if(!wB(e))throw ae;let{dispatch:r}=e,n=ye(e),{caseId:o}=t.options,i=p=>ee(o)||ee(p.raw.permanentid)&&ee(p.raw.urihash)?!1:e.state.attachedResults.results.some(m=>{let f=o===m.caseId,g=!ee(m.permanentId)&&m.permanentId===p.raw.permanentid,S=!ee(m.uriHash)&&m.uriHash===p.raw.urihash;return f&&(g||S)}),a=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:a(),loading:e.state.attachedResults.loading}},isAttached(p){return i(p)},attach(p){r(Co(vs(p,o))),r(ys(p))},detach(p){r(bo(vs(p,o))),r(Ss(p))}}}function wB(e){return e.addReducers({configuration:Re,attachedResults:xo}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ve=H;d();c();l();u();var IB={state:new Ke({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new B({required:!0,emptyAllowed:!0}),path:new ie({required:!0,each:H}),moreValuesAvailable:new de({required:!1})};function _v(e){e.children.forEach(t=>{_v(t)}),yr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},IB)}var As={facetId:ve,field:H,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),activeTab:new B({required:!1}),delimitingCharacter:new B({required:!1,emptyAllowed:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),basePath:new ie({required:!1,each:H}),filterByBasePath:new de({required:!1})};var Cs=N("categoryFacet/register",e=>q(e,As)),bs=N("categoryFacet/toggleSelectValue",e=>{try{return yr(e.facetId,H),_v(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),Ro=N("categoryFacet/deselectAll",e=>q(e,As.facetId)),yu=N("categoryFacet/updateNumberOfValues",e=>q(e,{facetId:As.facetId,numberOfValues:As.numberOfValues})),Jf=N("categoryFacet/updateSortCriterion",e=>q(e,{facetId:As.facetId,criterion:new Ke})),hF=N("categoryFacet/updateBasePath",e=>q(e,{facetId:As.facetId,basePath:new ie({each:H})}));d();c();l();u();var zFe={categoryFacetId:ve,categoryFacetPath:new ie({required:!0,each:H})};var yF=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var EB={categoryFacetId:ve,categoryFacetPath:new ie({required:!0,each:H})},FB=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,i=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:i}},em=e=>ne("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{q(e,EB);let n={...FB(r,e),...te(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var We=N("facetOptions/update",(e={freezeFacetOrder:!0})=>q(e,{freezeFacetOrder:new de({required:!1})})),or=N("facetOptions/facet/enable",e=>q(e,ve)),ft=N("facetOptions/facet/disable",e=>q(e,ve));d();c();l();u();var ir=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var Su={facetId:ve,captions:new W({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new B({required:!1,emptyAllowed:!0})};var TB={path:new ie({required:!0,each:H}),displayValue:Je,rawValue:Je,count:new oe({required:!0,min:0})},tm=N("categoryFacet/selectSearchResult",e=>q(e,{facetId:ve,value:new W({values:TB})})),SF=N("categoryFacetSearch/register",e=>q(e,Su));d();c();l();u();function xs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Rs(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function rm(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function vu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function nm(e,t,r){e.currentValues=PB(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function PB(e,t){if(!e.length)return[];let r=vF(e[0],t),n=r;for(let o of e.splice(1)){let i=vF(o,t);n.children.push(i),n=i}return n.state="selected",n.retrieveChildren=!0,[r]}function vF(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var om=pe(va(),e=>{e.addCase(Cs,(t,r)=>{let n=r.payload,{facetId:o,tabs:i}=n;if(o in t)return;let a=OB(n),p=a.numberOfValues;t[o]={request:a,initialNumberOfValues:p,tabs:i}}).addCase(ot.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(at,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(i=>{let a=t[i],p=a.request;if((a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ir(a.tabs,o)){p.currentValues.length&&nm(p,[],a.initialNumberOfValues);return}let f=n[i]||[];(f.length||p.currentValues.length)&&nm(p,f,a.initialNumberOfValues)})}).addCase(Jf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,i=t[n]?.request;i&&(i.sortCriteria=o)}).addCase(hF,(t,r)=>{let{facetId:n,basePath:o}=r.payload,i=t[n]?.request;i&&(i.basePath=[...o])}).addCase(bs,(t,r)=>{let{facetId:n,selection:o,retrieveCount:i}=r.payload,a=t[n]?.request;if(!a)return;let{path:p}=o,m=p.slice(0,p.length-1),f=kB(a,m,i);if(f.length){let S=f[0];S.retrieveChildren=!0,S.state="selected",S.previousState="idle",S.children=[];return}let g=CF(o.value,i);g.state="selected",g.previousState="idle",f.push(g),a.numberOfValues=1}).addCase(Ro,(t,r)=>{let n=r.payload;vu(t,n)}).addCase(er,t=>{Object.keys(t).forEach(r=>vu(t,r))}).addCase(Oa,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(yu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,i=t[n]?.request;if(i){if(!i.currentValues.length)return rm(i,o);_B(t,r.payload)}}).addCase(tm,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n];if(!i)return;let a=[...o.path,o.rawValue];nm(i.request,a,i.initialNumberOfValues)}).addCase(Ma.fulfilled,(t,r)=>{AF(t,r.payload.response.facets)}).addCase(qe.fulfilled,(t,r)=>{AF(t,r.payload.response.facets)}).addCase(ft,(t,r)=>{vu(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!ir(i.tabs,n)&&vu(t,o)})})}),Nv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function kB(e,t,r){let n=e.currentValues;for(let o of t){let i=n[0];(!i||o!==i.value)&&(i=CF(o,r),n.length=0,n.push(i)),i.retrieveChildren=!1,i.previousState=void 0,i.state="idle",n=i.children}return n}function OB(e){return{...Nv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function CF(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function AF(e,t){t.forEach(r=>{if(!NB(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let i=DB(o,r);o.currentValues=i?[]:o.currentValues,o.preventAutoSelect=!1})}function _B(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function NB(e,t){return t.facetId in e}function DB(e,t){let r=Hr(e.currentValues),n=Hr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var un=new B({regex:/^[a-zA-Z0-9-_]+$/}),ln=new B({required:!0}),bF=new ie({each:new B}),xF=new B,RF=new de,dn=new de,pn=new oe({min:0}),jr=new oe({min:1}),im=new de({required:!0}),qB=new W,MB=new B,VB={captions:qB,numberOfValues:jr,query:MB},ws=new W({values:VB}),am=new W({options:{required:!1},values:{type:new B({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ie({required:!0,max:25,each:new B({emptyAllowed:!1,required:!0})})}}),SPe=new de,sm=new ie({min:1,max:25,required:!1,each:new B({emptyAllowed:!1,required:!0})});d();c();l();u();var Vi={value:H,numberOfResults:new oe({min:0}),state:H};var jB={facetId:ve,field:new B({required:!0,emptyAllowed:!0}),tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),activeTab:new B({required:!1}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),resultsMustMatch:new Ke({required:!1}),allowedValues:am,customSort:sm},Is=N("facet/register",e=>q(e,jB)),wo=N("facet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new W({values:Vi})})),Io=N("facet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new W({values:Vi})})),Ct=N("facet/deselectAll",e=>q(e,ve)),cm=N("facet/updateSortCriterion",e=>q(e,{facetId:ve,criterion:new Ke({required:!0})})),Au=N("facet/updateNumberOfValues",e=>q(e,{facetId:ve,numberOfValues:new oe({required:!0,min:1})})),Cu=N("facet/updateIsFieldExpanded",e=>q(e,{facetId:ve,isFieldExpanded:new de({required:!0})})),ji=N("facet/updateFreezeCurrentValues",e=>q(e,{facetId:ve,freezeCurrentValues:new de({required:!0})}));d();c();l();u();var Es=e=>Pe("analytics/facet/unexclude",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o=xa(e,n);return t.makeFacetUnexclude(o)});var ar=()=>({actionCause:"facetClearAll"}),mr=()=>({actionCause:"facetSelect"}),um=()=>({actionCause:"facetExclude"}),Un=()=>({actionCause:"facetDeselect"});var Dv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var Fs=e=>ne("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{q(e,ve);let n={...Ko(e,Zt(r)),...te(r.insightCaseContext)};return t.logFacetShowMore(n)}),Ts=e=>ne("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{q(e,ve);let n={...Ko(e,Zt(r)),...te(r.insightCaseContext)};return t.logFacetShowLess(n)}),fn=e=>ne("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{q(e,{facetId:ve,sortCriterion:new Ke({required:!0})});let{facetId:n,sortCriterion:o}=e,i=Zt(r),p={...Ko(n,i),criteria:o,...te(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Gt=e=>ne("facetClearAll")("analytics/facet/reset",(t,r)=>{q(e,ve);let n=Zt(r),o={...Ko(e,n),...te(r.insightCaseContext)};return t.logFacetClearAll(o)}),Kt=e=>ne("facetSelect")("analytics/facet/select",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o={...xa(e,n),...te(r.insightCaseContext)};return t.logFacetSelect(o)}),Lr=e=>ne("facetDeselect")("analytics/facet/deselect",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n=Zt(r),o={...xa(e,n),...te(r.insightCaseContext)};return t.logFacetDeselect(o)}),bu=e=>ne("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{q(e,{facetId:ve,facetValue:H});let n={...xa(e,Zt(r)),...te(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var wF={facetId:ve,value:new W({values:{displayValue:Je,rawValue:Je,count:new oe({required:!0,min:0})}})},IF=N("facetSearch/register",e=>q(e,Su)),lm=N("facetSearch/update",e=>q(e,Su)),dm=N("facetSearch/toggleSelectValue",e=>q(e,wF)),pm=N("facetSearch/toggleExcludeValue",e=>q(e,wF));var Ps=pe(ba(),e=>{e.addCase(Is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Zb(LB(r.payload),o))}).addCase(ot.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(at,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(a=>{let{request:p}=t[a],m=n[a]||[],f=o[a]||[],g=m.length+f.length,S=p.currentValues.filter(b=>!m.includes(b.value)&&!f.includes(b.value));p.currentValues=[...m.map(FF),...f.map(TF),...S.map(QB)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(wo,(t,r)=>{let{facetId:n,selection:o}=r.payload,i=t[n]?.request;if(!i)return;i.preventAutoSelect=!0;let a=i.currentValues.find(m=>m.value===o.value);if(!a){fm(i,o);return}let p=a.state==="selected";a.previousState=a.state,a.state=p?"idle":"selected",i.freezeCurrentValues=!0}).addCase(Io,(t,r)=>{let{facetId:n,selection:o}=r.payload,i=t[n]?.request;if(!i)return;i.preventAutoSelect=!0;let a=i.currentValues.find(m=>m.value===o.value);if(!a){fm(i,o);return}let p=a.state==="excluded";a.previousState=a.state,a.state=p?"idle":"excluded",i.freezeCurrentValues=!0}).addCase(ji,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,i=t[n]?.request;i&&(i.freezeCurrentValues=o)}).addCase(Ct,(t,r)=>{Rs(t[r.payload]?.request)}).addCase(er,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Rs(r))}).addCase(bd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Rs(r))}).addCase(Oa,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(cm,(t,r)=>{xs(t,r.payload)}).addCase(Au,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;rm(t[n]?.request,o)}).addCase(Cu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,i=t[n]?.request;i&&(i.isFieldExpanded=o)}).addCase(qe.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>EF(t[o.facetId]?.request,o))}).addCase(Ma.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>EF(t[o.facetId]?.request,o))}).addCase(dm,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n]?.request;if(!i)return;let{rawValue:a}=o,{currentValues:p}=i,m=p.find(g=>g.value===a);if(m){m.state="selected";return}let f=FF(a);fm(i,f),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(pm,(t,r)=>{let{facetId:n,value:o}=r.payload,i=t[n]?.request;if(!i)return;let{rawValue:a}=o,{currentValues:p}=i,m=p.find(g=>g.value===a);if(m){m.state="excluded";return}let f=TF(a);fm(i,f),i.freezeCurrentValues=!0,i.preventAutoSelect=!0}).addCase(ft,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Rs(n)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!ir(i.tabs,n)&&Rs(i.request)})})});function fm(e,t){let{currentValues:r}=e,n=r.findIndex(i=>i.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function EF(e,t){e&&(e.currentValues=t.values.map(UB),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var qv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function LB(e){return{...qv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function UB(e){let{value:t,state:r}=e;return{value:t,state:r}}function FF(e){return{value:e,state:"selected"}}function TF(e){return{value:e,state:"excluded"}}function QB(e){return{...e,state:"idle"}}d();c();l();u();var mm=()=>ne("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(te(t.insightCaseContext)));d();c();l();u();d();c();l();u();function ks(e){let t=PF(e.start,e),r=PF(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function PF(e,t){let{dateFormat:r}=t;return ZA(e)?(Zu(e),YA(e)):typeof e=="string"&&Hn(e)?(Zu(e),e):($A(e,r),Xu(ta(e,r)))}d();c();l();u();var Os=N("rangeFacet/updateSortCriterion",e=>q(e,{facetId:ve,criterion:new Ke({required:!0})}));d();c();l();u();var Li={state:H,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new de({required:!0}),numberOfResults:new oe({required:!0,min:0})},Ui={start:H,end:H,endInclusive:new de({required:!0}),state:H,numberOfResults:new oe({required:!0,min:0})},Qn=e=>({facetId:ve,selection:typeof e.start=="string"?new W({values:Ui}):new W({values:Li})});var BB={start:H,end:H,endInclusive:new de({required:!0}),state:H},GB={facetId:ve,field:H,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),activeTab:new B({required:!1}),currentValues:new ie({required:!1,each:new W({values:BB})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),rangeAlgorithm:new Ke({required:!1})};function kF(e){return Hn(e)?fc(e):e}function gm(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=ks(t);if(ta(kF(r)).isAfter(ta(kF(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var mn=N("dateFacet/register",e=>{try{return yr(e,GB),gm(e),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),gn=N("dateFacet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new W({values:Ui})})),hn=N("dateFacet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new W({values:Ui})})),Bn=N("dateFacet/updateFacetValues",e=>{try{return yr(e,{facetId:ve,values:new ie({each:new W({values:Ui})})}),gm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),hm=Os,ym=Ct;d();c();l();u();d();c();l();u();var Sm=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,i=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:i,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},vm=()=>({actionCause:"breadcrumbFacet"});var Mv=vm;d();c();l();u();var xu=e=>ne("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{q(e,Qn(e.selection));let n={...Sm(r,e),...te(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function $B(e,t){return!!t&&t.facetId in e.dateFacetSet}var OF=(e,t)=>{let r=kn(e,t);if($B(e,r))return r},_F=(e,t)=>(OF(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),NF=(e,t)=>(OF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var Cm={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function bm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=DF(r);r.numberOfValues=o,e[n]=t}function xm(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=DF(n))}function Rm(e,t,r){let n=e[t]?.request;if(!n)return;let o=Am(n.currentValues,r);if(!o)return;let i=o.state==="selected";o.previousState=o.state,o.state=i?"idle":"selected",n.preventAutoSelect=!0}function wm(e,t,r){let n=e[t]?.request;if(!n)return;let o=Am(n.currentValues,r);if(!o)return;let i=o.state==="excluded";o.previousState=o.state,o.state=i?"idle":"excluded",n.preventAutoSelect=!0}function yn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function Im(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!Am(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let i=o.filter(p=>!Am(n.currentValues,p)),a=n.currentValues;a.push(...i),n.numberOfValues=Math.max(n.numberOfValues,a.length)})}function Em(e,t,r){t.forEach(n=>{let o=n.facetId,i=e[o]?.request;if(!i)return;let a=r(n.values);i.currentValues=a,i.preventAutoSelect=!1})}function Am(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function DF(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var Sn=pe(Aa(),e=>{e.addCase(mn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=HB(n);bm(t,Kb(i,o))}).addCase(ot.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(at,(t,r)=>{let n=r.payload.df||{};Im(t,n)}).addCase(gn,(t,r)=>{let{facetId:n,selection:o}=r.payload;Rm(t,n,o)}).addCase(hn,(t,r)=>{let{facetId:n,selection:o}=r.payload;wm(t,n,o)}).addCase(Bn,(t,r)=>{let{facetId:n,values:o}=r.payload;xm(t,n,o)}).addCase(ym,(t,r)=>{yn(t,r.payload)}).addCase(er,t=>{Object.keys(t).forEach(r=>{yn(t,r)})}).addCase(hm,(t,r)=>{xs(t,r.payload)}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.facets;Em(t,n,zB)}).addCase(ft,(t,r)=>{yn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!ir(i.tabs,n)&&yn(t,o)})})});function HB(e){return{...Cm,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function zB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var WB={state:H,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new de({required:!0})},YB={facetId:ve,field:H,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),activeTab:new B({required:!1}),currentValues:new ie({required:!1,each:new W({values:WB})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new Ke({required:!1}),rangeAlgorithm:new Ke({required:!1})};function Fm(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 vn=N("numericFacet/register",e=>{try{return q(e,YB),Fm(e),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),An=N("numericFacet/toggleSelectValue",e=>q(e,{facetId:ve,selection:new W({values:Li})})),Cn=N("numericFacet/toggleExcludeValue",e=>q(e,{facetId:ve,selection:new W({values:Li})})),Gn=N("numericFacet/updateFacetValues",e=>{try{return yr(e,{facetId:ve,values:new ie({each:new W({values:Li})})}),Fm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:kr(t)}}}),Tm=Os,Pm=Ct;d();c();l();u();var Vv=vm;d();c();l();u();d();c();l();u();var qF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,i=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:i,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var Ru=e=>ne("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{q(e,Qn(e.selection));let n={...qF(r,e),...te(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function KB(e,t){return!!t&&t.facetId in e.numericFacetSet}var MF=(e,t)=>{let r=kn(e,t);if(KB(e,r))return r},VF=(e,t)=>(MF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),jF=(e,t)=>(MF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Eo=pe(Ca(),e=>{e.addCase(vn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,i=XB(n);bm(t,Xb(i,o))}).addCase(ot.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(at,(t,r)=>{let n=r.payload.nf||{};Im(t,n)}).addCase(An,(t,r)=>{let{facetId:n,selection:o}=r.payload;Rm(t,n,o)}).addCase(Cn,(t,r)=>{let{facetId:n,selection:o}=r.payload;wm(t,n,o)}).addCase(Gn,(t,r)=>{let{facetId:n,values:o}=r.payload;xm(t,n,o)}).addCase(Pm,(t,r)=>{yn(t,r.payload)}).addCase(er,t=>{Object.keys(t).forEach(r=>{yn(t,r)})}).addCase(Tm,(t,r)=>{xs(t,r.payload)}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.facets;Em(t,n,ZB)}).addCase(ft,(t,r)=>{yn(t,r.payload)}).addCase(Nt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let i=t[o];(i.tabs?.included?.length||i.tabs?.excluded?.length)&&!ir(i.tabs,n)&&yn(t,o)})})});function XB(e){return{...Cm,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function ZB(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var wu=H,km=new W({options:{required:!0},values:{caption:Je,expression:Je,state:new B({constrainTo:["idle","selected","excluded"]})}}),LF=new ie({required:!0,each:km});var Y_e=N("staticFilter/register",e=>q(e,{id:wu,values:LF})),UF=N("staticFilter/toggleSelect",e=>q(e,{id:wu,value:km})),QF=N("staticFilter/toggleExclude",e=>q(e,{id:wu,value:km})),K_e=N("staticFilter/deselectAllFilterValues",e=>q(e,wu));d();c();l();u();var Om=e=>ne("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...te(r.insightCaseContext)}));d();c();l();u();var _m=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function BF(e){let t=ye(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(er())},deselectBreadcrumb(n){n.deselect()}}}function GF(e){if(!JB(e))throw ae;let t=BF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:y,selection:x})=>{let w=bu({facetId:y,facetValue:x.value});r(wo({facetId:y,selection:x})),r(ji({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:Dv()}))},executeToggleExclude:({facetId:y,selection:x})=>{let w=bu({facetId:y,facetValue:x.value});r(Io({facetId:y,selection:x})),r(ji({facetId:y,freezeCurrentValues:!1})),r(xe({legacy:w,next:Dv()}))},facetValuesSelector:zb};return _m(h)},i=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:y=>{r(An(y)),r(xe({legacy:Ru(y),next:Vv()}))},executeToggleExclude:y=>{r(Cn(y)),r(xe({legacy:Ru(y),next:Vv()}))},facetValuesSelector:VF};return _m(h)},a=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:y=>{r(gn(y)),r(xe({legacy:xu(y),next:Mv()}))},executeToggleExclude:y=>{r(hn(y)),r(xe({legacy:xu(y),next:Mv()}))},facetValuesSelector:NF};return _m(h)},p=h=>{let y=Yb(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:y,deselect:()=>{r(Ro(h)),r(xe({legacy:em({categoryFacetPath:y.map(x=>x.value),categoryFacetId:h}),next:yF()}))}}},m=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),f=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:y,values:x}=h,w=x.filter(E=>E.state!=="idle").map(E=>S(y,E));return{id:y,values:w}},S=(h,y)=>({value:y,deselect:()=>{let{caption:x,expression:w}=y,E=Om({staticFilterId:h,staticFilterValue:{caption:x,expression:w}});y.state==="selected"?r(UF({id:h,value:y})):y.state==="excluded"&&r(QF({id:h,value:y})),r(xe({legacy:E}))}});function b(){return!![...o(),...i(),...a(),...m(),...f()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:m(),numericFacetBreadcrumbs:i(),dateFacetBreadcrumbs:a(),staticFilterBreadcrumbs:f(),hasBreadcrumbs:b()}},deselectAll:()=>{t.deselectAll(),r(xe({legacy:mm(),next:{actionCause:"breadcrumbResetAll"}}))}}}function JB(e){return e.addReducers({configuration:Re,search:Te,facetSet:Ps,numericFacetSet:Eo,dateFacetSet:Sn,categoryFacetSet:om}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var $F=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Nm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),HF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function zF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Nm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var WF=(e,t)=>{let r={...HF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var YF=pe(zF(),e=>{e.addCase(ud,t=>{t.enableDidYouMean=!0}).addCase(Ux,t=>{t.enableDidYouMean=!1}).addCase(Qx,t=>{t.automaticallyCorrectQuery=!0}).addCase(ld,t=>{t.automaticallyCorrectQuery=!1}).addCase(qe.pending,t=>{t.queryCorrection=Nm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(qe.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let i=o?.[0]?o[0]:Nm();t.queryCorrection=i}t.queryCorrectionMode==="next"&&WF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Jt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Gc,(t,r)=>{t.queryCorrectionMode=r.payload})});function KF(e,t={}){if(!e1(e))throw ae;let r=ye(e),{dispatch:n}=e;n(ud()),t.options?.automaticallyCorrectQuery===!1&&n(ld()),n(Gc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,i=()=>$F(o().didYouMean);return{...r,get state(){let a=o();return{originalQuery:a.didYouMean.originalQuery,wasCorrectedTo:a.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:a.didYouMean.wasAutomaticallyCorrected,queryCorrection:a.didYouMean.queryCorrection,hasQueryCorrection:i()}},applyCorrection(){n(Jt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(a){n(Gc(a))}}}function e1(e){return e.addReducers({configuration:Re,didYouMean:YF}),!0}var XF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function ZF(e,t={options:XF}){let r={...XF,...t.options},n=KF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(xe({legacy:Yx(),next:nR()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var $t=pe(fd(),e=>{e.addCase(We,(t,r)=>({...t,...r.payload})).addCase(qe.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(qe.rejected,t=>{t.freezeFacetOrder=!1}).addCase(ot.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(Cs,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Dm(o,t,n)}).addCase(Is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Dm(o,t,n)}).addCase(mn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Dm(o,t,n)}).addCase(vn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Dm(o,t,n)}).addCase(or,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(ft,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(at,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=Gy()),t.facets[n].enabled=!0})})});function Dm(e,t,r){let n={...Gy(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var qm=pe(gd(),e=>{e.addCase(mp,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(Nt,(t,r)=>{let n=r.payload;JF(t,n)}).addCase(fp,(t,r)=>{let n=r.payload;JF(t,n)}).addCase(ot.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(at,(t,r)=>{let n=r.payload.tab;ee(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function JF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function eT(e){if(!t1(e))throw ae;let t=ye(e),r=lt(n=>n.tabSet,n=>Object.values(n).find(i=>i.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function t1(e){return e.addReducers({tabSet:qm}),!0}function tT(e,t){if(!r1(e))throw ae;let r=eT(e),n=y=>e.state.facetOptions.facets[y]?.enabled??!1,o=y=>e.state.facetSet?.[y]?.request?.currentValues??e.state.categoryFacetSet?.[y]?.request?.currentValues??e.state.numericFacetSet?.[y]?.request?.currentValues??e.state.dateFacetSet?.[y]?.request?.currentValues??null,i=y=>y in e.state.facetOptions.facets,a=y=>e.state.facetOptions.facets[y]?.tabs,p=()=>Zi({isFacetRegistered:i(t.facetId),parentFacets:t.conditions.map(({parentFacetId:y})=>i(y)?{enabled:n(y),values:o(y)}:null),isTabEnabled:ir(a(t.facetId),r.state.activeTab)}),m=()=>{let y=p();return y===b?!1:(b=y,!0)},f=()=>t.conditions.length>0?t.conditions.some(y=>{if(!n(y.parentFacetId))return!1;let x=o(y.parentFacetId);return x===null?!1:y.condition(x)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([y,x])=>x.request.freezeCurrentValues&&e.dispatch(ji({facetId:y,freezeCurrentValues:!1})))},S=()=>{if(!i(t.facetId))return;let y=n(t.facetId),x=f(),w=ir(a(t.facetId),r.state.activeTab),E=x&&w;y!==E&&(e.dispatch(E?or(t.facetId):ft(t.facetId)),g())},b=p(),h=e.subscribe(()=>{m()&&S()});return S(),{stopWatching(){h()}}}function r1(e){return e.addReducers({facetOptions:$t}),!0}function rT(e,t){return tT(e,t)}d();c();l();u();d();c();l();u();function nT(e){if(!n1(e))throw ae;let t=ye(e),r=()=>e.state;return{...t,sort(n){return Hc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(i=>i.facetId)}}}}function n1(e){return e.addReducers({search:Te,facetOptions:$t}),!0}function oT(e){return nT(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Mm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,i={..._s,...t},a=r();e[n]={options:i,isLoading:o,response:a,initialNumberOfValues:i.numberOfValues,requestId:""}}function Vm(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function jm(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Lm(e,t){let r=e[t];r&&(r.isLoading=!1)}function Um(e,t,r){let{facetId:n,response:o}=t,i=e[n];i&&i.requestId===r&&(i.isLoading=!1,i.response=o)}function Iu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=_s.query)}function Qm(e,t){Object.keys(e).forEach(r=>Iu(e,{facetId:r},t))}var _s={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var iT=/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,i=t.categoryFacetSet[e].request,{captions:a,query:p,numberOfValues:m}=o,{field:f,delimitingCharacter:g,basePath:S,filterFacetCount:b}=i,h=o1(i),y=h.length?[h]:[],x=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:S,captions:a,numberOfValues:m,query:x,field:f,delimitingCharacter:g,ignorePaths:y,filterFacetCount:b,type:"hierarchical",...(n?{}:{searchContext:(yield br(t,r)).request})}});return function iT(_x213,_x214,_x215,_x216){return _ref89.apply(this,arguments)}}(),o1=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var aT=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:i,numberOfValues:a}=t.facetSearchSet[e].options,{field:p,currentValues:m,filterFacetCount:f}=t.facetSet[e].request,g=m.filter(b=>b.state!=="idle").map(b=>b.value),S=`*${i}*`;return{url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:a,query:S,field:p,ignoreValues:g,filterFacetCount:f,type:"specific",...(n?{}:{searchContext:(yield br(t,r)).request})}});return function aT(_x217,_x218,_x219,_x220){return _ref90.apply(this,arguments)}}();var sT=e=>(/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){let a=r(),p;o(t,H),i1(a,t)?p=yield aT(t,a,i,e):p=yield iT(t,a,i,e);let m=yield n.facetSearch(p);return{facetId:t,response:m}});return function(_x221,_x222){return _ref91.apply(this,arguments)}}()),Fo=fe("facetSearch/executeSearch",sT(!1)),FMe=fe("facetSearch/executeSearch",sT(!0)),Bm=N("facetSearch/clearResults",e=>q(e,{facetId:ve})),i1=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function cT(){return{}}var uT=pe(cT(),e=>{e.addCase(SF,(t,r)=>{let n=r.payload;Mm(t,n,jv)}).addCase(lm,(t,r)=>{Vm(t,r.payload)}).addCase(Fo.pending,(t,r)=>{let n=r.meta.arg;jm(t,n,r.meta.requestId)}).addCase(Fo.rejected,(t,r)=>{let n=r.meta.arg;Lm(t,n)}).addCase(Fo.fulfilled,(t,r)=>{Um(t,r.payload,r.meta.requestId)}).addCase(Bm,(t,{payload:{facetId:r}})=>{Iu(t,{facetId:r},jv)}).addCase(qe.fulfilled,t=>{Qm(t,jv)})});function jv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function lT(e,t){let{field:r,state:n}=e;if(!a1(e))return r;let o=`${r}_`,i=s1(o,n);return u1(r,t),`${o}${i}`}function a1(e){let{field:t,state:r}=e;return dT(r).some(o=>o&&t in o)}function s1(e,t){let n=dT(t).map(o=>Object.keys(o||{})).reduce((o,i)=>o.concat(i),[]);return c1(n,e)+1}function dT(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function c1(e,t){return e.map(i=>{let a=i.split(t)[1],p=parseInt(a,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function u1(e,t){let r=`A facet with field "${e}" already exists.
46
+ To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function Er(e,t){let{state:r,logger:n}=e,{field:o,facetId:i}=t;return i||lT({field:o,state:r},n)}d();c();l();u();d();c();l();u();var pT=["alphanumeric","occurrences"];var fT=new De({field:ln,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),basePath:bF,delimitingCharacter:xF,facetId:un,facetSearch:ws,filterByBasePath:RF,filterFacetCount:dn,injectionDepth:pn,numberOfValues:jr,sortCriteria:new B({constrainTo:pT})});function mT(e,t){if(!l1(e))throw ae;let r=ye(e),{dispatch:n}=e,o=Er(e,t.options),i=t.options.tabs??{},a=Qt(e.state.tabSet),p={...Nv,...$u("facetSearch",t.options),field:t.options.field,facetId:o,tabs:i,activeTab:a},m={facetSearch:{..._s,...t.options.facetSearch},...p};yt(e,fT,m,"buildCategoryFacet");let f=()=>Fy(e.state,o),g=()=>Ey(e.state,o),S=()=>$r(e.state),b=()=>en(e.state,o);return n(Cs(p)),{...r,toggleSelect(h){let y=m.numberOfValues;n(bs({facetId:o,selection:h,retrieveCount:y})),n(We())},deselectAll(){n(Ro(o)),n(We())},sortBy(h){n(Jf({facetId:o,criterion:h})),n(We())},isSortedBy(h){return f().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=m,{activeValue:y,valuesAsTrees:x}=this.state,w=(y?.children.length??x.length)+h;n(yu({facetId:o,numberOfValues:w})),n(We())},showLessValues(){let{numberOfValues:h}=m;n(yu({facetId:o,numberOfValues:h})),n(We())},enable(){n(or(o))},disable(){n(ft(o))},get state(){let h=f(),y=g(),x=S(),w=b(),E=y?.values??[],k=E.some(G=>G.children.length>0)??!1,{parents:F,values:_}=Wb(y?.values),I=Hr(E),O=I.length?I[I.length-1]:void 0,P=!!O,T=O?.moreValuesAvailable??y?.moreValuesAvailable??!1,V=O?O.children.length>m.numberOfValues:E.length>m.numberOfValues;return{facetId:o,parents:F,selectedValueAncestry:I,values:_,isHierarchical:k,valuesAsTrees:E,activeValue:O,isLoading:x,hasActiveValues:P,canShowMoreValues:T,canShowLessValues:V,sortCriteria:h.sortCriteria,enabled:w}}}}function l1(e){return e.addReducers({categoryFacetSet:om,categoryFacetSearchSet:uT,facetOptions:$t,configuration:Re,search:Te}),!0}function gT(e,t){let r=mT(e,t),{dispatch:n}=e,o=()=>r.state.facetId,a={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...m}=a;return{...r,facetSearch:m,toggleSelect(f){r.toggleSelect(f);let g=d1(o(),f);n(xe({legacy:g,next:p1(f)}))},deselectAll(){r.deselectAll(),n(xe({legacy:Gt(o()),next:ar()}))},sortBy(f){r.sortBy(f),n(xe({legacy:fn({facetId:o(),sortCriterion:f})}))},isSortedBy(f){return r.isSortedBy(f)},showMoreValues(){r.showMoreValues(),n(ka({legacy:Fs(o())}))},showLessValues(){r.showLessValues(),n(ka({legacy:Ts(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function d1(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Lr(r):Kt(r)}function p1(e){return e.state==="selected"?Un():mr()}d();c();l();u();d();c();l();u();d();c();l();u();function hT(){return{}}var Gm=pe(hT(),e=>{e.addCase(IF,(t,r)=>{let n=r.payload;Mm(t,n,Lv)}).addCase(lm,(t,r)=>{Vm(t,r.payload)}).addCase(Fo.pending,(t,r)=>{let n=r.meta.arg;jm(t,n,r.meta.requestId)}).addCase(Fo.rejected,(t,r)=>{let n=r.meta.arg;Lm(t,n)}).addCase(Fo.fulfilled,(t,r)=>{Um(t,r.payload,r.meta.requestId)}).addCase(Bm,(t,{payload:r})=>{Iu(t,r,Lv)}).addCase(qe.fulfilled,t=>{Qm(t,Lv)})});function Lv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var f1=e=>e.state==="selected",yT=(e,t)=>{let r={facetId:e,facetValue:t.value};return f1(t)?Lr(r):Kt(r)};d();c();l();u();var Uv=e=>e.state==="selected",CT=e=>e.state==="excluded";var bT=e=>Uv(e)?Un():mr();d();c();l();u();d();c();l();u();var xT={facetId:ve,selection:new W({values:Vi})},RT=fe("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},xT),n(wo({facetId:e,selection:t})),n(We())}),wT=fe("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},xT),n(Io({facetId:e,selection:t})),n(We())});d();c();l();u();d();c();l();u();var Ns=["allValues","atLeastOneValue"];d();c();l();u();var $m=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var IT=new De({facetId:un,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),field:ln,filterFacetCount:dn,injectionDepth:pn,numberOfValues:jr,sortCriteria:new B({constrainTo:$m}),resultsMustMatch:new B({constrainTo:Ns}),facetSearch:ws});function ET(e,t,r=IT){if(!m1(e))throw ae;let{dispatch:n}=e,o=ye(e),i=Er(e,t.options),a=t.options.tabs??{},p=Qt(e.state.tabSet),m={...qv,...$u("facetSearch",t.options),field:t.options.field,facetId:i,tabs:a,activeTab:p},f={facetSearch:{..._s,...t.options.facetSearch},...m};yt(e,r,f,"buildFacet");let g=()=>Hb(e.state,i),S=()=>Iy(e.state,i),b=()=>$r(e.state),h=()=>en(e.state,i),y=()=>{let{currentValues:w}=g();return w.filter(E=>E.state!=="idle").length},x=()=>{let{currentValues:w}=g(),E=f.numberOfValues,k=!!w.find(F=>F.state==="idle");return E<w.length&&k};return n(Is(m)),{...o,toggleSelect:w=>n(RT({facetId:f.facetId,selection:w})),toggleExclude:w=>n(wT({facetId:f.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(Ct(i)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(Ct(i)),this.toggleExclude(w)},isValueSelected:Uv,isValueExcluded:CT,deselectAll(){n(Ct(i)),n(We())},sortBy(w){n(cm({facetId:i,criterion:w})),n(We())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,E=f.numberOfValues,k=E-w%E,F=w+k;n(Au({facetId:i,numberOfValues:F})),n(Cu({facetId:i,isFieldExpanded:!0})),n(We())},showLessValues(){let w=f.numberOfValues,E=Math.max(w,y());n(Au({facetId:i,numberOfValues:E})),n(Cu({facetId:i,isFieldExpanded:!1})),n(We())},enable(){n(or(i))},disable(){n(ft(i))},get state(){let w=g(),E=S(),k=b(),F=h(),_;typeof w.sortCriteria=="object"?_=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":_=w.sortCriteria;let I=E?E.values:[],O=I.some(V=>V.state!=="idle"),P=E?E.moreValuesAvailable:!1,T=w.resultsMustMatch;return{label:E?.label,facetId:i,tabs:a,values:I,sortCriterion:_,resultsMustMatch:T,isLoading:k,hasActiveValues:O,canShowMoreValues:P,canShowLessValues:x(),enabled:F}}}}function m1(e){return e.addReducers({facetSet:Ps,facetOptions:$t,configuration:Re,facetSearchSet:Gm}),!0}d();c();l();u();var FT=new De({facetId:un,field:ln,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),filterFacetCount:dn,injectionDepth:pn,numberOfValues:jr,sortCriteria:new B({constrainTo:$m}),resultsMustMatch:new B({constrainTo:Ns}),facetSearch:ws,allowedValues:am,customSort:sm});function TT(e,t){if(!g1(e))throw ae;let{dispatch:r}=e,n=ET(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},FT),o=()=>n.state.facetId,a={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...m}=a;return{...n,facetSearch:m,toggleSelect(f){n.toggleSelect(f),r(xe({legacy:yT(o(),f),next:bT(f)}))},deselectAll(){n.deselectAll(),r(xe({legacy:Gt(o()),next:ar()}))},sortBy(f){n.sortBy(f),r(xe({legacy:fn({facetId:o(),sortCriterion:f})}))},isSortedBy(f){return this.state.sortCriterion===f},showMoreValues(){n.showMoreValues(),r(ka({legacy:Fs(o())}))},showLessValues(){n.showLessValues(),r(ka({legacy:Ts(o())}))},get state(){return{...n.state,facetSearch:a.state}}}}function g1(e){return e.addReducers({facetSet:Ps,configuration:Re,facetSearchSet:Gm,search:Te}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var Eu=e=>e.state==="selected",PT=e=>e.state==="excluded";var Hm=e=>Eu(e)?Un():mr();var zm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Eu(t)?Lr(n):Kt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Wm=N("rangeFacet/executeToggleSelect",e=>q(e,Qn(e.selection))),Ym=N("rangeFacet/executeToggleExclude",e=>q(e,Qn(e.selection)));var kT={facetId:ve,selection:new W({values:Ui})},OT=fe("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,kT),t(gn(e)),t(Wm(e)),t(We())}),_T=fe("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,kT),t(hn(e)),t(Ym(e)),t(We())});d();c();l();u();function Km(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function Xm(e,t){let{facetId:r,getRequest:n}=t,o=ye(e),i=e.dispatch,a=()=>en(e.state,r);return{...o,isValueSelected:Eu,isValueExcluded:PT,deselectAll(){i(Ct(r)),i(We())},sortBy(p){i(Os({facetId:r,criterion:p})),i(We())},isSortedBy(p){return this.state.sortCriterion===p},enable(){i(or(r))},disable(){i(ft(r))},get state(){let p=n(),m=kn(e.state,r),f=p.sortCriteria,g=p.resultsMustMatch,S=m?m.values:[],b=$r(e.state),h=a(),y=S.some(w=>w.state!=="idle"),x=m?.domain;return{facetId:r,values:S,sortCriterion:f,resultsMustMatch:g,hasActiveValues:y,isLoading:b,enabled:h,domain:x}}}}d();c();l();u();d();c();l();u();var Zm=["idle","selected","excluded"];d();c();l();u();var Jm=["ascending","descending"],eg=["even","equiprobable"];var h1={start:new B,end:new B,endInclusive:new de,state:new B({constrainTo:Zm})},y1=new De({facetId:un,field:ln,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),generateAutomaticRanges:im,filterFacetCount:dn,injectionDepth:pn,numberOfValues:jr,currentValues:new ie({each:new W({values:h1})}),sortCriteria:new B({constrainTo:Jm}),rangeAlgorithm:new B({constrainTo:eg})});function tg(e,t){yt(e,y1,t,"buildDateFacet"),gm(t)}function NT(e,t){if(!S1(e))throw ae;Km(t.options,"buildDateFacet");let r=e.dispatch,n=Er(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};tg(e,a),r(mn(a));let p=Xm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:m=>r(OT({facetId:n,selection:m})),toggleSingleSelect:function(m){m.state==="idle"&&r(Ct(n)),this.toggleSelect(m)},toggleExclude:m=>r(_T({facetId:n,selection:m})),toggleSingleExclude:function(m){m.state==="idle"&&r(Ct(n)),this.toggleExclude(m)},get state(){return p.state}}}function S1(e){return e.addReducers({configuration:Re,search:Te,dateFacetSet:Sn,facetOptions:$t}),!0}function DT(e,t){let r=NT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Gt(o()),next:ar()}))},sortBy(i){r.sortBy(i),n(xe({legacy:fn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(xe({legacy:zm(o(),i),next:Hm(i)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function qT(e,t){if(!v1(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state,i=Er(e,t.options),a=t.options.tabs??{},p=Qt(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:i,tabs:a,activeTab:p};tg(e,m),n(mn(m));let f=()=>en(e.state,i);return{...r,clear:()=>{n(Bn({facetId:i,values:[]})),n(We())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},b=Bn({facetId:i,values:[S]});return b.error?!1:(n(b),n(We()),!0)},enable(){n(or(i))},disable(){n(ft(i))},get state(){let g=$r(o()),S=f(),b=_F(o(),i),h=b.length?b[0]:void 0;return{facetId:i,isLoading:g,range:h,enabled:S}}}}function v1(e){return e.addReducers({dateFacetSet:Sn,facetOptions:$t,configuration:Re,search:Te}),!0}function MT(e,t){if(!A1(e))throw ae;let r=qT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Gt(o()),next:ar()}))},setRange:i=>{let a=r.setRange(i);return a&&n(xe({legacy:Kt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:mr()})),a},get state(){return{...r.state}}}}function A1(e){return e.addReducers({dateFacetSet:Sn,configuration:Re,search:Te}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var VT={facetId:ve,selection:new W({values:Li})},jT=fe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,VT),t(An(e)),t(Wm(e)),t(We())}),OBe=fe("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,VT),t(Cn(e)),t(Ym(e)),t(We())});d();c();l();u();var C1={start:new oe,end:new oe,endInclusive:new de,state:new B({constrainTo:Zm})},b1=new De({facetId:un,tabs:new W({options:{required:!1},values:{included:new ie({each:new B}),excluded:new ie({each:new B})}}),field:ln,generateAutomaticRanges:im,filterFacetCount:dn,injectionDepth:pn,numberOfValues:jr,currentValues:new ie({each:new W({values:C1})}),sortCriteria:new B({constrainTo:Jm}),resultsMustMatch:new B({constrainTo:Ns}),rangeAlgorithm:new B({constrainTo:eg})});function rg(e,t){yt(e,b1,t,"buildNumericFacet"),Fm(t)}d();c();l();u();function ng(e){return{endInclusive:!1,state:"idle",...e}}function LT(e,t){if(!x1(e))throw ae;Km(t.options,"buildNumericFacet");let r=e.dispatch,n=Er(e,t.options),o=t.options.tabs??{},i=Qt(e.state.tabSet),a={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:i};rg(e,a),r(vn(a));let p=Xm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:m=>r(jT({facetId:n,selection:m})),toggleSingleSelect(m){m.state==="idle"&&r(Ct(n)),this.toggleSelect(m)},get state(){return p.state}}}function x1(e){return e.addReducers({numericFacetSet:Eo,facetOptions:$t,configuration:Re,search:Te}),!0}function UT(e,t){let r=LT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(xe({legacy:Gt(o()),next:ar()}))},sortBy(i){r.sortBy(i),n(xe({legacy:fn({facetId:o(),sortCriterion:i})}))},toggleSelect:i=>{r.toggleSelect(i),n(xe({legacy:zm(o(),i),next:Hm(i)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function QT(e,t){if(!R1(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state,i=Er(e,t.options),a=t.options.tabs??{},p=Qt(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:i,tabs:a,activeTab:p};rg(e,m),n(vn(m));let f=()=>en(e.state,i);return{...r,clear:()=>{n(Gn({facetId:i,values:[]})),n(We())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},b=Gn({facetId:i,values:[S]});return b.error?!1:(n(b),n(We()),!0)},enable(){n(or(i))},disable(){n(ft(i))},get state(){let g=$r(o()),S=f(),b=jF(o(),i),h=b.length?b[0]:void 0;return{facetId:i,isLoading:g,range:h,enabled:S}}}}function R1(e){return e.addReducers({numericFacetSet:Eo,facetOptions:$t,configuration:Re,search:Te}),!0}function BT(e,t){let r=QT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(xe({legacy:Gt(o()),next:ar()}))},setRange:i=>{let a=r.setRange(i);return a&&n(xe({legacy:Kt({facetId:o(),facetValue:`${i.start}..${i.end}`}),next:mr()})),a},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var w1=e=>ne("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(_t(e),t.logShowMoreFoldedResults(et(e,r),tt(e),te(r.insightCaseContext)))),I1=()=>ne("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(te(t.insightCaseContext))),GT={logShowMoreFoldedResults:w1,logShowLessFoldedResults:I1};d();c();l();u();d();c();l();u();var Fu={collectionField:new B({emptyAllowed:!1,required:!1}),parentField:new B({emptyAllowed:!1,required:!1}),childField:new B({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},Ds=N("folding/register",e=>q(e,Fu)),og=fe("folding/loadCollection",/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield io(i):_a(i,o),p=yield n.search({...a,q:E1(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 Xe(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x223,_x224){return _ref92.apply(this,arguments)}}());function E1(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var $T=N("folding/register",e=>q(e,Fu)),ig=fe("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield Wx(o,e),p=(yield eR(n,o,i,{origin:"foldingCollection"})).response;return Xe(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x225,_x226){return _ref93.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var ag=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function F1(e,t){return e.raw[t.collection]}function Qv(e,t){return e.raw[t.parent]}function Tu(e,t){let r=e.raw[t.child];return Bu(r)?r[0]:r}function T1(e,t){return(e||t)!==void 0&&e===t}function zT(e,t,r,n=[]){let o=Tu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(i=>{let a=Tu(i,r)===Tu(e,r);return Qv(i,r)===o&&!a}).map(i=>{let a={...i,searchUid:e.searchUid};return{result:a,children:zT(a,t,r,[...n,o])}}):[]}function P1(e,t){return e.find(r=>{let n=Qv(r,t)===void 0,o=T1(Qv(r,t),Tu(r,t));return n||o})}function WT(e){return e.parentResult?WT(e.parentResult):e}function k1(e,t,r,n){let o=ed(e),a={...(n??P1(o,t)??WT(e)),searchUid:r},p=zT(a,o,t);return{result:a,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function sg(e,t,r,n){let o={};return e.forEach(i=>{let a=F1(i,t);a&&(!Tu(i,t)&&!i.parentResult||(o[a]=k1(i,t,r,n)))}),o}function HT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var cg=pe(ag(),e=>e.addCase(qe.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?sg(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Jr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?sg(r.response.results,t.fields,r.response.searchUid):{}}).addCase(lo.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...sg(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Ds,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(og.pending,(t,{meta:r})=>{let n=r.arg;HT(t,n).isLoadingMoreResults=!0}).addCase(og.rejected,(t,{meta:r})=>{let n=r.arg;HT(t,n).isLoadingMoreResults=!1}).addCase(og.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:i}})=>{let a=sg(n,t.fields,i,o);if(!a||!a[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=a[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var Pu={id:H},To=N("querySuggest/register",e=>q(e,{...Pu,count:new oe({min:0})})),YT=N("querySuggest/unregister",e=>q(e,Pu)),Po=N("querySuggest/selectSuggestion",e=>q(e,{...Pu,expression:Je})),ko=N("querySuggest/clear",e=>q(e,Pu)),qs=fe("querySuggest/fetch",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:i}}){o(e,Pu);let a=e.id,p=yield O1(a,t(),i),m=yield n.querySuggest(p);return Xe(m)?r(m.error):{id:a,q:p.q,...m.success}});return function(_x227,_x228){return _ref94.apply(this,arguments)}}()),O1=/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Xt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?At.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield ro(t.configuration.analytics):ti(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function O1(_x229,_x230,_x231){return _ref95.apply(this,arguments)}}();var Oo=pe(ut(),e=>e.addCase(Yt,(t,r)=>({...t,...r.payload})).addCase(Jt,(t,r)=>{t.q=r.payload}).addCase(Po,(t,r)=>{t.q=r.payload.expression}).addCase(ot.fulfilled,(t,r)=>r.payload?.query??t).addCase(at,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var _o=N("fields/registerFieldsToInclude",e=>q(e,nl)),ug=N("fields/fetchall/enable"),lg=N("fields/fetchall/disable"),dg=fe("fields/fetchDescription",/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:p}=o.configuration,{apiBaseUrl:m}=o.configuration.search,f=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:p,url:m??Xt(p,a)});return Xe(f)?n(f.error):f.success.fields});return function(_x232,_x233){return _ref96.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var KT=["author","language","urihash","objecttype","collection","source","permanentid"],_1=[...KT,"date","filetype","parents"],k2e=[..._1,"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"],XT=()=>({fieldsToInclude:KT,fetchAllFields:!1,fieldsDescription:[]});var Ms=pe(XT(),e=>e.addCase(_o,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(ug,t=>{t.fetchAllFields=!0}).addCase(lg,t=>{t.fetchAllFields=!1}).addCase(dg.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Ds,(t,{payload:r})=>{let n=ag().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Vs(e){if(!N1(e))throw ae;let t=ye(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:qd(n)}}}}function N1(e){return e.addReducers({search:Te}),!0}var D1=new De({fieldsToInclude:new ie({required:!1,each:new B({required:!0,emptyAllowed:!1})})});function pg(e,t){if(!q1(e))throw ae;let r=ye(e),n=Vs(e),{dispatch:o}=e,i=()=>e.state,a=yt(e,D1,t?.options,"buildCoreResultList");a.fieldsToInclude&&o(_o(a.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,m=0,f=0,g=5,S=200,b=!1;return{...r,get state(){let y=i();return{...n.state,results:y.search.results,moreResultsAvailable:p(),searchResponseId:y.search.searchResponseId}},fetchMoreResults:function(){var _ref97=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-m<S){if(f++,f>=g){m=Date.now(),!b&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),b=!0;return}}else f=0;b=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),m=Date.now())});return function fetchMoreResults(){return _ref97.apply(this,arguments)}}()}}function q1(e){return e.addReducers({search:Te,configuration:Re,fields:Ms}),!0}var M1=new De(Fu);function ZT(e,t,r){if(!V1(e))throw ae;let n=pg(e,t),{dispatch:o}=e,i=()=>e.state,a=t.options?.folding?yt(e,M1,t.options.folding,"buildFoldedResultList"):{};return o(Ds({...a})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return Bv(this.state.results,m=>m.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return Bv(this.state.results,m=>m.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=i();return{...n.state,results:n.state.results.map(m=>{let f=m.raw[p.folding.fields.collection];return!f||!p.folding.collections[f]?{result:m,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[f]})}}}}function V1(e){return e.addReducers({search:Te,configuration:yp,folding:cg,query:Oo}),!0}function Bv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=Bv(n.children,t);if(o)return o}}return null}function JT(e,t={}){let r=ZT(e,{...t,loadCollectionActionCreator:ig,fetchMoreResultsActionCreator:Ad},GT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function fg(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var js=pe(TS(),e=>e.addCase(Ga,(t,{payload:r})=>{t.isVisible=r}).addCase(za,(t,{payload:r})=>{t.isEnabled=r}).addCase(ep,(t,{payload:r})=>{t.id=r.id}).addCase(si,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),i=n.trim().length>0;if(o){t.answer+=n;return}t.answer=i?n:void 0}).addCase(ci,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=fg([...t.citations,...r.citations]),delete t.error}).addCase(ui,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===Ih},t.citations=[],delete t.answer}).addCase(Kd,t=>{t.liked=!0,t.disliked=!1}).addCase(Xd,t=>{t.liked=!1,t.disliked=!0}).addCase(Zd,t=>{t.feedbackModalOpen=!0}).addCase(tp,t=>{t.feedbackModalOpen=!1}).addCase(Wa,t=>{t.feedbackSubmitted=!0}).addCase(dr,t=>({...TS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(tn,(t,{payload:r})=>{t.isLoading=r}).addCase(ai,(t,{payload:r})=>{t.isStreaming=r}).addCase(li,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(rp,(t,{payload:r})=>{t.responseFormat=r}).addCase(op,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(eu,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Jc,t=>{t.expanded=!0}).addCase(Jd,t=>{t.expanded=!1}).addCase(np,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(di,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(kS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase($a,(t,{payload:r})=>{t.answerId=r}).addCase(Ha,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(ip,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(ap,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}).addCase(sp,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:i}=r,a=t.generationSteps.findLast(p=>p.status==="active");a&&(a.toolCalls=a.toolCalls||[],a.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:i,status:"active"}))}).addCase(Ya,(t,{payload:r})=>{let{toolCallId:n,args:o,type:i}=r,p=t.generationSteps.findLast(m=>m.status==="active")?.toolCalls?.find(m=>m.toolCallId===n);p&&(p.toolCallArgs=o,p.type=i==="search"?"search":"generic")}).addCase(cp,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o}=r,a=t.generationSteps.findLast(p=>p.status==="active")?.toolCalls?.find(p=>p.toolCallId===n);a&&(a.finishedAt=o,a.status="completed")}));d();c();l();u();function mg(e,t,r={}){if(!j1(e))throw ae;let{dispatch:n}=e,o=ye(e),i=()=>e.state,a=r.initialState?.isVisible;a!==void 0&&n(Ga(a));let p=r.initialState?.isEnabled;p!==void 0&&n(za(p));let m=r.initialState?.responseFormat;m&&n(rp(m));let f=r.fieldsToIncludeInCitations;return f&&n(op(f)),r.initialState?.expanded&&n(Jc()),{...o,get state(){let S=i().generatedAnswer;return{...S,error:zf(S.error)}},like(){this.state.liked||(n(Kd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Xd()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Zd())},closeFeedbackModal(){n(tp())},sendFeedback(S){n(t.logGeneratedAnswerFeedback(S)),n(Wa())},logCitationClick(S,b){n(t.logOpenGeneratedAnswerSource(S,b))},logCitationHover(S,b,h){n(t.logHoverCitation(S,b,h))},show(){this.state.isVisible||(n(Ga(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Ga(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Jc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Jd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(za(!0))},disable(){this.state.isEnabled&&n(za(!1))},logCopyToClipboard(S){n(t.logCopyGeneratedAnswer(S))},retry(){}}}function j1(e){return e.addReducers({generatedAnswer:js}),!0}var Ht={engines:{},setAbortControllerRef:(e,t)=>{Ht.engines[t].abortController=e},getIsStreamInProgress:e=>!Ht.engines[e].abortController||Ht.engines[e].abortController?.signal.aborted?(Ht.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,i=r.generatedAnswer.id;if(Ht.engines[i].lastRequestId!==n){if(Ht.engines[i].lastRequestId=n,Ht.engines[i].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(dr())}if(!Ht.getIsStreamInProgress(i)&&o&&o!==Ht.engines[i].lastStreamId){if(Ht.engines[i].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(fw({setAbortControllerRef:p=>Ht.setAbortControllerRef(p,i)}))}};return e.subscribe(t)}};function eP(e,t,r={}){if(!L1(e))throw ae;let n=mg(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Ht.engines[e.state.generatedAnswer.id]&&(Ht.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let a=Qu("genQA-",12);e.dispatch(ep({id:a}))}Ht.engines[e.state.generatedAnswer.id]||(Ht.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Ht.subscribeToSearchRequests(e);let i=a=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in a;return{...n,get state(){return o().generatedAnswer},retry(){i(e)&&e.dispatch(qe({legacy:t.logRetryGeneratedAnswer()}))}}}function L1(e){return e.addReducers({generatedAnswer:js}),!0}d();c();l();u();d();c();l();u();var tP=dp.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var gg=e=>e==="yes"?!0:e==="no"?!1:null,U1=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:gg(t.correctTopic),documented:gg(t.documented),hallucinationFree:gg(t.hallucinationFree),readable:gg(t.readable)},helpful:t.helpful,question:r}),Q1=e=>{let t="",r=()=>{let n=e.state,o=XR(n),i=o.requestId;if(i!==t){if(t=i,e.dispatch(dr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Ha("automatic")),e.dispatch(up()))}};e.subscribe(r)};function rP(e,t,r={}){if(!B1(e))throw ae;Wf(e.state.configuration.analytics.analyticsMode);let{...n}=mg(e,t,r),o=()=>e.state;return e.dispatch(np(r.answerConfigurationId)),Q1(e),{...n,get state(){let i=OS(e.state).data,a=o().generatedAnswer;return{...a,answer:i?.answer,citations:fg(i?.citations??[]),error:zf({message:i?.error?.message,code:i?.error?.code}),isLoading:i?.isLoading??!1,isStreaming:i?.isStreaming??!1,answerContentFormat:i?.contentFormat??"text/plain",isAnswerGenerated:i?.generated??!1,cannotAnswer:a.cannotAnswer||i?.generated===!1&&!i?.isLoading&&!i?.isStreaming}},retry(){let i=$d(o());e.dispatch(lp(i??oi))},reset(){e.dispatch(dr())},sendFeedback(i){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(i));let a=U1({query:o().query.q,feedback:i,answerApiState:OS(e.state).data});e.dispatch(tP.endpoints.post.initiate(a)),e.dispatch(Wa())})()}}}function B1(e){return e.addReducers({[pi.reducerPath]:pi.reducer,query:Oo}),!0}function nP(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?rP(e,Ta,t):eP(e,Ta,t);return{...n,get state(){return n.state},retry(){r(xe({legacy:Ta.logRetryGeneratedAnswer(),next:Dx()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function bn(e,t,r){if(!G1(e))throw ae;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Hu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function G1(e){return e.addReducers({configuration:Re}),!0}function oP(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return bn(e,r,()=>{o()})}function iP(e,t){return oP(e,{logCitationOpen:r=>Uy(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var W1=new oe({min:1,default:8,required:!1}),Y1=new oe({min:1,max:20,default:5,required:!1}),K1={desiredCount:Y1,numberOfValues:W1},IHe=N("automaticFacet/setOptions",e=>q(e,K1)),EHe=N("automaticFacet/deselectAll",e=>q(e,ve)),X1=H,aP=N("automaticFacet/toggleSelectValue",e=>q(e,{field:X1,selection:new W({values:Vi})}));var Us=pe(Kr(),e=>{e.addCase(Id,(t,r)=>{let n=Gv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ku(n,o)}).addCase(Ed,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(Nt,t=>{t.firstResult=0}).addCase(Fd,(t,r)=>{let n=r.payload;t.firstResult=ku(n,t.numberOfResults)}).addCase(oo,(t,r)=>{let n=r.payload;t.firstResult=ku(n,t.numberOfResults)}).addCase(Pd,t=>{let r=Gv(t),n=Math.max(r-1,1);t.firstResult=ku(n,t.numberOfResults)}).addCase(Td,t=>{let r=Gv(t),n=Z1(t),o=Math.min(r+1,n);t.firstResult=ku(o,t.numberOfResults)}).addCase(ot.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(at,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(qe.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Jr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Ct,t=>{zt(t)}).addCase(hn,t=>{zt(t)}).addCase(Io,t=>{zt(t)}).addCase(Cn,t=>{zt(t)}).addCase(pm,t=>{zt(t)}).addCase(wo,t=>{zt(t)}).addCase(Ro,t=>{zt(t)}).addCase(bs,t=>{zt(t)}).addCase(tm,t=>{zt(t)}).addCase(gn,t=>{zt(t)}).addCase(An,t=>{zt(t)}).addCase(er,t=>{zt(t)}).addCase(Bn,t=>{zt(t)}).addCase(Gn,t=>{zt(t)}).addCase(dm,t=>{zt(t)}).addCase(aP,t=>{zt(t)})});function zt(e){e.firstResult=Kr().firstResult}function Gv(e){let{firstResult:t,numberOfResults:r}=e;return $v(t,r)}function Z1(e){let{totalCountFiltered:t,numberOfResults:r}=e;return Hv(t,r)}function ku(e,t){return(e-1)*t}function $v(e,t){return Math.round(e/t)+1}function Hv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function J1(e){return e.pagination.firstResult}function sP(e){return e.pagination.numberOfResults}function eG(e){return e.pagination.totalCountFiltered}var No=e=>{let t=J1(e),r=sP(e);return $v(t,r)},zv=e=>{let t=eG(e),r=sP(e);return Hv(t,r)},cP=(e,t)=>{let r=No(e),n=zv(e),o=tG(r,t);return o=rG(o),o=nG(o,n),oG(o)};function tG(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,i=e-n,a=e+o;return{start:i,end:a}}function rG(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function nG(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function oG(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var Wv=()=>Pe("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Kr().numberOfResults}));var Qs=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var hg=()=>ne("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:No(t),...te(t.insightCaseContext)})),yg=()=>ne("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:No(t),...te(t.insightCaseContext)})),Sg=()=>ne("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:No(t),...te(t.insightCaseContext)}));d();c();l();u();var iG=new De({numberOfPages:new oe({default:5,min:0})}),aG=new De({page:new oe({min:1})});function uP(e,t={}){if(!sG(e))throw ae;let r=ye(e),{dispatch:n}=e,o=yt(e,iG,t.options,"buildPager"),a=Sr(e,aG,t.initialState,"buildPager").page;a&&n(Fd(a));let p=()=>No(e.state),m=()=>{let{numberOfPages:g}=o;return cP(e.state,g)},f=()=>zv(e.state);return{...r,get state(){let g=p(),S=f(),b=g>1&&S>0,h=g<S;return{currentPage:g,currentPages:m(),maxPage:S,hasPreviousPage:b,hasNextPage:h}},selectPage(g){n(oo(g))},nextPage(){n(Td())},previousPage(){n(Pd())},isCurrentPage(g){return g===this.state.currentPage}}}function sG(e){return e.addReducers({configuration:Re,pagination:Us}),!0}function lP(e,t={}){let{dispatch:r}=e,n=uP(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(vd({legacy:hg(),next:Qs()}))},nextPage(){n.nextPage(),r(vd({legacy:yg(),next:Qs()}))},previousPage(){n.previousPage(),r(vd({legacy:Sg(),next:Qs()}))}}}d();c();l();u();d();c();l();u();function dP(e){if(!cG(e))throw ae;let t=ye(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function cG(e){return e.addReducers({search:Te}),!0}function pP(e){return dP(e)}d();c();l();u();d();c();l();u();function fP(e){if(!uG(e))throw ae;let t=ye(e),r=Vs(e),n=()=>e.state,o=()=>{let i=n().search.duration/1e3;return Math.round((i+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function uG(e){return e.addReducers({search:Te,pagination:Us}),!0}function mP(e){return fP(e)}d();c();l();u();d();c();l();u();function gP(_x234,_x235){return _gP.apply(this,arguments)}function _gP(){_gP=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:i}=e.insightConfiguration,a=e.query?.q||"";return{url:Ph({url:gt(n,o),accessToken:r,organizationId:n,insightId:i}),accessToken:r,organizationId:n,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0}});return _gP.apply(this,arguments)}d();c();l();u();var hP=e=>ne("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=et(e,r),o=tt(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{action:"preview",itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Vr(t)}}});d();c();l();u();function yP(e,t,r,n,o){if(!lG(e))throw ae;let{dispatch:i}=e,a=()=>e.state,p=ye(e),{result:m,maximumPreviewSize:f}=t.options,g=()=>{let{resultsWithPreview:b,position:h}=a().resultPreview;return b[h]},S=b=>{i(Dd({uniqueId:b,requestedOutputSize:f,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||i(zc({uniqueId:b,requestedOutputSize:f})),o&&o()};return{...p,fetchResultContent(){S(m.uniqueId)},next(){i(_d()),S(g())},previous(){i(Nd()),S(g())},get state(){let b=a(),h=m.hasHtmlVersion,y=b.resultPreview,x=m.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,E=y.contentURL,k=g();return{content:x,resultHasPreview:h,isLoading:w,contentURL:E,currentResultUniqueId:k}}}}function lG(e){return e.addReducers({configuration:Re,resultPreview:Va}),!0}function SP(e,t){if(!dG(e))throw ae;let r=()=>{e.dispatch(hP(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return yP(e,o,(i,a)=>gP(i,a),n,r)}function dG(e){return e.addReducers({configuration:Re,resultPreview:Va,insightInterface:to}),!0}d();c();l();u();d();c();l();u();var vP=()=>ne("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(te(t.insightCaseContext))),AP=()=>ne("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(te(t.insightCaseContext)));d();c();l();u();d();c();l();u();var pG={queries:new ie({required:!0,each:new B({emptyAllowed:!1})}),maxLength:new oe({required:!0,min:1,default:10})},Ou=N("recentQueries/registerRecentQueries",e=>q(e,pG)),vg=N("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function CP(){return{queries:[],maxLength:10}}var bP=pe(CP(),e=>{e.addCase(Ou,fG).addCase(vg,mG).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||gG(n,t)})});function fG(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function mG(e){e.queries=[]}function gG(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var hG={queries:[]},yG={maxLength:10,clearFilters:!0},SG=new De({queries:new ie({required:!0})}),vG=new De({maxLength:new oe({required:!0,min:1}),clearFilters:new de});function AG(e,t){yt(e,vG,t?.options,"buildRecentQueriesList"),Sr(e,SG,t?.initialState,"buildRecentQueriesList")}function xP(e,t){if(!CG(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state,i={...yG,...t?.options},a={...hG,...t?.initialState};AG(e,{options:i,initialState:a});let p={queries:a.queries,maxLength:i.maxLength};return n(Ou(p)),{...r,get state(){let m=o();return{...m.recentQueries,analyticsEnabled:m.configuration.analytics.enabled}},clear(){n(vg())},updateRecentQueries(m){let f=new ie({required:!0,each:new B({required:!0}),min:1}).validate(m);if(f)throw new Error(f);n(Ou({queries:m,maxLength:i.maxLength}))},executeRecentQuery(m){let f=new oe({required:!0,min:0,max:this.state.queries.length}).validate(m);if(f)throw new Error(f);let g={q:this.state.queries[m],clearFilters:i.clearFilters};Uu(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(qa(g))}}}function CG(e){return e.addReducers({search:Te,recentQueries:bP,query:Oo}),!0}function RP(e,t){let r=xP(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(vP()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(xe({legacy:AP(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var bG={results:new ie({required:!0,each:new W({values:td})}),maxLength:new oe({required:!0,min:1,default:10})},Ag=N("recentResults/registerRecentResults",e=>q(e,bG)),xn=N("recentResults/pushRecentResult",e=>(_t(e),{payload:e})),Cg=N("recentResults/clearRecentResults");d();c();l();u();var wP=e=>ne("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{_t(e);let n=te(r.insightCaseContext);return t.logDocumentOpen(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Vr(t)}}});function IP(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(wP(t.options.result)))};return bn(e,t,()=>{n(),e.dispatch(xn(t.options.result))})}d();c();l();u();function EP(e,t){return pg(e,{...t,fetchMoreResultsActionCreator:Ad})}d();c();l();u();d();c();l();u();var xG=new De({numberOfResults:new oe({min:0})});function FP(e,t={}){if(!RG(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state,a=Sr(e,xG,t.initialState,"buildResultsPerPage").numberOfResults;return a!==void 0&&n(Id(a)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Ed(p))},isSetTo(p){return p===this.state.numberOfResults}}}function RG(e){return e.addReducers({pagination:Us,configuration:Re}),!0}function TP(e,t={}){let r=FP(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(xe({legacy:Wv(),next:Qs()}))}}}d();c();l();u();d();c();l();u();var Yv=()=>Pe("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),bg=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var xg=()=>ne("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(te(t.insightCaseContext)));d();c();l();u();d();c();l();u();var PP={id:H,query:Je},Bs=N("querySet/register",e=>q(e,PP)),Qi=N("querySet/update",e=>q(e,PP));d();c();l();u();var Gs=pe(md(),e=>{e.addCase(Bs,(t,r)=>IG(t,r.payload)).addCase(Qi,(t,r)=>{let{id:n,query:o}=r.payload;Kv(t,n,o)}).addCase(Po,(t,r)=>{let{id:n,expression:o}=r.payload;Kv(t,n,o)}).addCase(qe.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;kP(t,n)}).addCase(at,wG).addCase(ot.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))Kv(t,n,o)})});function wG(e,t){ee(t.payload.q)||kP(e,t.payload.q)}function kP(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var Kv=(e,t,r)=>{t in e&&(e[t]=r)},IG=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var OP=e=>Pe("analytics/querySuggest",(t,r)=>{let n=EG(r,e);return t.makeOmniboxAnalytics(n)}),_P=()=>({actionCause:"omniboxAnalytics"});function EG(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let i=o.completions.map(f=>f.expression),a=o.partialQueries.length-1,p=o.partialQueries[a]||"",m=o.responseId;return{suggestionRanking:i.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:i,querySuggestResponseId:m}}d();c();l();u();d();c();l();u();function NP(e,t){let r=t.id;r in e||(e[r]=FG(t))}function DP(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function qP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function MP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function FG(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var VP=()=>({});var Rg=pe(VP(),e=>e.addCase(To,(t,r)=>{NP(t,r.payload)}).addCase(YT,(t,r)=>{delete t[r.payload.id]}).addCase(qs.pending,DP).addCase(qs.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(qs.rejected,qP).addCase(ko,(t,r)=>{MP(t,r.payload)}).addCase(ja,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var jP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},Xv={open:new B,close:new B},TG={id:H,numberOfSuggestions:new oe({min:0}),enableQuerySyntax:new de,highlightOptions:new W({values:{notMatchDelimiters:new W({values:Xv}),exactMatchDelimiters:new W({values:Xv}),correctionDelimiters:new W({values:Xv})}}),clearFilters:new de},LP=new De(TG);function UP(e,t){if(!kG(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state,i=t.options?.id||Qu("search_box"),a={id:i,highlightOptions:{...t.options?.highlightOptions},...jP,...t.options};yt(e,LP,a,"buildSearchBox"),n(Bs({id:i,query:e.state.query.q})),a.numberOfSuggestions&&n(To({id:i,count:a.numberOfSuggestions})),a.enableQuerySyntax&&n(Yt({enableQuerySyntax:a.enableQuerySyntax}));let p=()=>e.state.querySet[a.id],m=/*#__PURE__*/function(){var _ref98=_asyncToGenerator(function*(f){let{enableQuerySyntax:g,clearFilters:S}=a;n(qa({q:p(),enableQuerySyntax:g,clearFilters:S})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(f)):n(t.executeSearchActionCreator(f.legacy))});return function m(_x236){return _ref98.apply(this,arguments)}}();return{...r,updateText(f){n(Qi({id:i,query:f})),this.showSuggestions()},clear(){n(Qi({id:i,query:""})),n(ko({id:i}))},showSuggestions(){a.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:i}))},selectSuggestion(f){n(Po({id:i,expression:f})),m({legacy:OP({id:i,suggestion:f}),next:_P()}).then(()=>{n(ko({id:i}))})},submit(f=Yv(),g){m({legacy:f,next:g}),n(ko({id:i}))},get state(){let f=o(),g=f.querySuggest[a.id],S=PG(g,a.highlightOptions),b=g?g.isLoading:!1;return{searchBoxId:i,value:p(),suggestions:S,isLoading:f.search.isLoading,isLoadingSuggestions:b}}}}function PG(e,t){return e?e.completions.map(r=>({highlightedValue:ih(r.highlighted,t),rawValue:r.expression})):[]}function kG(e){return e.addReducers({query:Oo,querySuggest:Rg,configuration:Re,querySet:Gs,search:Te}),!0}function QP(e,t={}){let r=UP(e,{...t,executeSearchActionCreator:xe,fetchQuerySuggestionsActionCreator:Cd,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(xg(),bg())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var wg=()=>({actionCause:"resultsSort"});function BP(e,t){return e.q!==t.q?bg():e.sortCriteria!==t.sortCriteria?wg():$s(e.f,t.f)?Hs(e.f,t.f):$s(e.fExcluded,t.fExcluded)?Hs(e.fExcluded,t.fExcluded,!0):$s(e.cf,t.cf)?Hs(e.cf,t.cf):$s(e.af,t.af)?Hs(e.af,t.af):$s(e.nf,t.nf)?Hs(Ig(e.nf),Ig(t.nf)):$s(e.df,t.df)?Hs(Ig(e.df),Ig(t.df)):wa()}function $s(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Hs(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(b=>!o.includes(b));if(i.length){let b=i[0];return e[b].length>1?ar():Un()}if(o.filter(b=>!n.includes(b)).length)return r?um():mr();let p=o.find(b=>t[b].filter(h=>e[b].includes(h)));if(!p)return wa();let m=e[p],f=t[p];return f.filter(b=>!m.includes(b)).length?r?um():mr():m.filter(b=>!f.includes(b)).length?Un():wa()}function Ig(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var zs=()=>ne("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||lr(),...te(t.insightCaseContext)}));function HP(e,t){return e.q!==t.q?xg():e.sortCriteria!==t.sortCriteria?zs():_u(e.f,t.f)?_u(e.cf,t.cf)?_u(e.nf,t.nf)?_u(e.df,t.df)?_u(e.fExcluded,t.fExcluded)?no():OG(e.fExcluded,t.fExcluded):$P(e.df,t.df):$P(e.nf,t.nf):Eg(e.cf,t.cf):Eg(e.f,t.f)}function _u(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function GP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function Eg(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),i=n.filter(b=>!o.includes(b));if(i.length){let b=i[0];return e[b].length>1?Gt(b):(r?Es:Lr)({facetId:b,facetValue:e[b][0]})}let a=o.filter(b=>!n.includes(b));if(a.length){let b=a[0];return Kt({facetId:b,facetValue:t[b][0]})}let p=o.find(b=>t[b].filter(h=>e[b].includes(h)));if(!p)return no();let m=e[p],f=t[p],g=f.filter(b=>!m.includes(b));if(g.length)return Kt({facetId:p,facetValue:g[0]});let S=m.filter(b=>!f.includes(b));return S.length?(r?Es:Lr)({facetId:p,facetValue:S[0]}):no()}function $P(e={},t={}){return Eg(GP(e),GP(t))}function OG(e={},t={}){return Eg(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:zP,getOwnPropertySymbols:_G}=Object,{hasOwnProperty:NG}=Object.prototype;function Nu(e,t){return function(n,o,i){return e(n,o,i)&&t(n,o,i)}}function Du(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:i}=o,a=i.get(r),p=i.get(n);if(a&&p)return a===n&&p===r;i.set(r,n),i.set(n,r);let m=e(r,n,o);return i.delete(r),i.delete(n),m}}function WP(e){let t=_G(e);return t.length?zP(e).concat(t):zP(e)}var DG=Object.hasOwn||((e,t)=>NG.call(e,t)),qG="__v",MG="__o",VG="_owner",jG=typeof Float16Array<"u",{getOwnPropertyDescriptor:YP,keys:KP}=Object,Bi=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function LG(e,t){return e===t}function UG(e,t){return e.byteLength===t.byteLength&&Fg(new Uint8Array(e),new Uint8Array(t))}function QG(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function BG(e,t){return e.byteLength===t.byteLength&&Fg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function GG(e,t){return Bi(e.getTime(),t.getTime())}function XP(e,t,r){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&r.equals(e.cause,t.cause,"cause","cause",e,t,r)}function ZP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),i=e.entries(),a,p,m=0;for(;(a=i.next())&&!a.done;){let f=t.entries(),g=0,S=0;for(;(p=f.next())&&!p.done;){if(o[S]){S++;continue}let b=a.value,h=p.value;if(r.equals(b[0],h[0],m,S,e,t,r)&&r.equals(b[1],h[1],b[0],h[0],e,t,r)){g=o[S]=1;break}S++}if(!g)return!1;m++}return!0}function JP(e,t,r){let n=KP(e),o=n.length;if(KP(t).length!==o)return!1;for(;o-->0;)if(!rk(e,t,r,n[o]))return!1;return!0}function Ws(e,t,r){let n=WP(e),o=n.length;if(WP(t).length!==o)return!1;let i,a,p;for(;o-->0;)if(i=n[o],!rk(e,t,r,i)||(a=YP(e,i),p=YP(t,i),(a||p)&&(!a||!p||a.configurable!==p.configurable||a.enumerable!==p.enumerable||a.writable!==p.writable)))return!1;return!0}function $G(e,t){return Bi(e.valueOf(),t.valueOf())}function HG(e,t){return e.source===t.source&&e.flags===t.flags}function ek(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),i=e.values(),a,p;for(;(a=i.next())&&!a.done;){let m=t.values(),f=0,g=0;for(;(p=m.next())&&!p.done;){if(!o[g]&&r.equals(a.value,p.value,a.value,p.value,e,t,r)){f=o[g]=1;break}g++}if(!f)return!1}return!0}function Fg(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||jG&&e instanceof Float16Array){for(;r-->0;)if(e[r]!==t[r]&&(e[r]===e[r]||t[r]===t[r]))return!1;return!0}for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function zG(e,t){return e.href===t.href?!0:e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&WG(e.searchParams,t.searchParams)}function WG(e,t){let r=e.toString(),n=t.toString();return r===n||tk(r)===tk(n)}function tk(e){return e.split("&").sort().join("&")}function rk(e,t,r,n){return(n===VG||n===MG||n===qG)&&(e.$$typeof||t.$$typeof)?!0:DG(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var YG=Object.prototype.toString;function KG(e){let t=e2(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:p,areRegExpsEqual:m,areSetsEqual:f,getUnsupportedCustomComparator:g}=e;return function(b,h,y){if(b===h)return!0;if(b==null||h==null)return!1;let x=typeof b;if(x!==typeof h)return!1;if(x!=="object")return x==="number"||x==="bigint"?a(b,h,y):x==="function"?o(b,h,y):!1;let w=b.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(b,h,y);if(w===Array)return r(b,h,y);if(w===Date)return n(b,h,y);if(w===RegExp)return m(b,h,y);if(w===Map)return i(b,h,y);if(w===Set)return f(b,h,y);if(w===Promise)return!1;if(Array.isArray(b))return r(b,h,y);let E=YG.call(b),k=t[E];if(k)return k(b,h,y);let F=g&&g(b,h,y,E);return F?F(b,h,y):!1}}function XG({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:UG,areArraysEqual:r?Ws:QG,areDataViewsEqual:BG,areDatesEqual:GG,areErrorsEqual:r?Nu(XP,Ws):Nu(XP,JP),areFunctionsEqual:LG,areMapsEqual:r?Nu(ZP,Ws):ZP,areNumbersEqual:Bi,areObjectsEqual:r?Ws:JP,arePrimitiveWrappersEqual:$G,areRegExpsEqual:HG,areSetsEqual:r?Nu(ek,Ws):ek,areTypedArraysEqual:r?Nu(Fg,Ws):Fg,areUrlsEqual:zG,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=Du(n.areArraysEqual),i=Du(n.areErrorsEqual),a=Du(n.areMapsEqual),p=Du(n.areObjectsEqual),m=Du(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:i,areMapsEqual:a,areObjectsEqual:p,areSetsEqual:m})}return n}function ZG(e){return function(t,r,n,o,i,a,p){return e(t,r,p)}}function JG({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,m){let{cache:f=e?new WeakMap:void 0,meta:g}=r();return t(p,m,{cache:f,equals:n,meta:g,strict:o})};if(e)return function(p,m){return t(p,m,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let i={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,m){return t(p,m,i)}}function e2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:a,areObjectsEqual:p,arePrimitiveWrappersEqual:m,areRegExpsEqual:f,areSetsEqual:g,areTypedArraysEqual:S,areUrlsEqual:b}){return{"[object Arguments]":p,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":i,"[object BigInt]":m,"[object BigInt64Array]":S,"[object BigUint64Array]":S,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":S,"[object Float32Array]":S,"[object Float64Array]":S,"[object Function]":i,"[object GeneratorFunction]":i,"[object Int8Array]":S,"[object Int16Array]":S,"[object Int32Array]":S,"[object Map]":a,"[object Number]":m,"[object Object]":(h,y,x)=>typeof h.then!="function"&&typeof y.then!="function"&&p(h,y,x),"[object RegExp]":f,"[object Set]":g,"[object String]":m,"[object URL]":b,"[object Uint8Array]":S,"[object Uint8ClampedArray]":S,"[object Uint16Array]":S,"[object Uint32Array]":S}}var Zv=Rn(),BKe=Rn({strict:!0}),GKe=Rn({circular:!0}),$Ke=Rn({circular:!0,strict:!0}),HKe=Rn({createInternalComparator:()=>Bi}),zKe=Rn({strict:!0,createInternalComparator:()=>Bi}),WKe=Rn({circular:!0,createInternalComparator:()=>Bi}),YKe=Rn({circular:!0,createInternalComparator:()=>Bi,strict:!0});function Rn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,i=XG(e),a=KG(i),p=r?r(a):ZG(a);return JG({circular:t,comparator:a,createState:n,equals:p,strict:o})}function nk(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function t2(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Jv(r,n))!==-1)}var Jv=Rn({createCustomConfig:e=>({...e,areArraysEqual:t2})});d();c();l();u();d();c();l();u();function ok(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function ik(e,t,r){if(e===void 0)return{};let n=t(e);return!Zv(n,r)?{sortCriteria:n}:{}}function Tg(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([i])=>t(i)).map(([i,{request:a}])=>{let p=r(a);return p.length?{[i]:p}:{}}).reduce((i,a)=>({...i,...a}),{});return Object.keys(o).length?{[n]:o}:{}}function ak(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function sk(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??_n().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??_n().defaultFilters.cq,firstResult:Kr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Kr().defaultNumberOfResults,sortCriteria:lr(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:pd(),sf:{},tab:"",af:{},mnf:{}}}var r2=new De({parameters:new W({options:{required:!0},values:pp})});function lk(e,t){let{dispatch:r}=e,n=ye(e);Sr(e,r2,t.initialState,"buildSearchParameterManager");let o=ck(e.state.tabSet,t.initialState.parameters);return r(at(o)),{...n,synchronize(i){let a=ck(e.state.tabSet,Pg(e,i));r(at(a))},get state(){return{parameters:eA(e)}}}}function Pg(e,t){let n={...sk(e.state),...t},o={};if(e.state.dateFacetSet)for(let a of Object.keys(e.state.dateFacetSet))o[a]=[];let i={};if(e.state.numericFacetSet)for(let a of Object.keys(e.state.numericFacetSet))i[a]=[];return{...n,df:{...o,...n.df},nf:{...i,...n.nf}}}function ck(e,t){if(ee(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:uk(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??uk(e)}}return t}function uk(e){return Object.keys(e)[0]??""}function eA(e){let t=e.state;return{...ok(t.query,r=>r.q,ut().q),...ak(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...ik(t.sortCriteria,r=>r,lr()),...o2(t),...i2(t),...a2(t),...s2(t),...c2(t)}}function n2(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function kg(e){let t=n2(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,i=ir(n?.tabs,t);return o&&i}}function dk(e){return e.currentValues.filter(t=>t.state==="selected")}function o2(e){let t=e.facetSet;if(t===void 0)return{};let r=kg(e),n={},o={};for(let[i,{request:a}]of Object.entries(t)){if(!r(i))continue;let p=a.currentValues.filter(f=>f.state==="selected").map(f=>f.value),m=a.currentValues.filter(f=>f.state==="excluded").map(f=>f.value);p.length&&(n[i]=p),m.length&&(o[i]=m)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function i2(e){return Tg(e.categoryFacetSet,kg(e),t=>Hr(t.currentValues).map(r=>r.value),"cf")}function a2(e){return Tg(e.numericFacetSet,kg(e),dk,"nf")}function s2(e){return Tg(e.dateFacetSet,kg(e),dk,"df")}function c2(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let i=u2(o);return i.length?{[n]:i}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function u2(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function pk(e,t){let{dispatch:r}=e,n=lk(e,t);return{...n,synchronize(o){let i=eA(e),a=Pg(e,i),p=Pg(e,o);Jv(a,p)||(n.synchronize(o),r(xe({legacy:HP(a,p),next:BP(a,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var qu=()=>new W({values:{questionAnswerId:H},options:{required:!0}}),Og=()=>new W({values:{linkText:Je,linkURL:Je},options:{required:!0}});function Gi(e){return q(e,qu())}d();c();l();u();function mt(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&SR(e,r.contentIdKey,r.contentIdValue)}function Fr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var fk={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var l2=()=>ne("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(te(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),d2=()=>ne("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(te(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),p2=()=>ne("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(te(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),f2=()=>ne("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(te(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),m2=()=>ne("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=mt(t);return e.logOpenSmartSnippetSource(et(r,t),tt(r),te(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=mt(e),r=tt(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),tA=e=>ne("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{q(e,Og());let n=mt(r);return t.logOpenSmartSnippetInlineLink(et(n,r),{...tt(n),...e},te(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),g2=()=>ne("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(te(t.insightCaseContext))),h2=()=>ne("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(te(t.insightCaseContext))),y2=e=>ne("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,te(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:fk[e]}}}),S2=e=>ne("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,te(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=mt(t),n=tt(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),v2=e=>ne("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{Gi(e);let n=Fr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},te(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Fr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),A2=e=>ne("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{Gi(e);let n=Fr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},te(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Fr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),rA=e=>ne("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{q(e,qu());let n=Fr(r,e.questionAnswerId);if(!n)return null;let o=mt(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(et(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},te(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Fr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=mt(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),mk=(e,t)=>ne("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{q(e,qu()),q(t,Og());let o=Fr(n,e.questionAnswerId);if(!o)return null;let i=mt(n,o.documentId);return i?r.logOpenSmartSnippetSuggestionInlineLink(et(i,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},te(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Fr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let i=mt(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:i?.title,url:i?.clickUri}}}}}),_g={logExpandSmartSnippet:l2,logCollapseSmartSnippet:d2,logLikeSmartSnippet:p2,logDislikeSmartSnippet:f2,logOpenSmartSnippetSource:m2,logOpenSmartSnippetInlineLink:tA,logOpenSmartSnippetFeedbackModal:g2,logCloseSmartSnippetFeedbackModal:h2,logSmartSnippetFeedback:y2,logSmartSnippetDetailedFeedback:S2,logExpandSmartSnippetSuggestion:v2,logCollapseSmartSnippetSuggestion:A2,logOpenSmartSnippetSuggestionSource:rA};d();c();l();u();d();c();l();u();var Ys=N("smartSnippet/expand"),Ks=N("smartSnippet/collapse"),Xs=N("smartSnippet/like"),Zs=N("smartSnippet/dislike"),Js=N("smartSnippet/feedbackModal/open"),Do=N("smartSnippet/feedbackModal/close"),ec=N("smartSnippet/related/expand",e=>Gi(e)),tc=N("smartSnippet/related/collapse",e=>Gi(e));d();c();l();u();d();c();l();u();var nA=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var gk=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function hk({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Zi({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function C2(e,t){let r=hk(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var wn=pe(nA(),e=>e.addCase(Ys,t=>{t.expanded=!0}).addCase(Ks,t=>{t.expanded=!1}).addCase(Xs,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Zs,t=>{t.liked=!1,t.disliked=!0}).addCase(Js,t=>{t.feedbackModalOpen=!0}).addCase(Do,t=>{t.feedbackModalOpen=!1}).addCase(qe.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((i,a)=>C2(i,t.relatedQuestions[a])),o=hk(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...nA(),relatedQuestions:n,questionAnswerId:o}}).addCase(ec,(t,r)=>{let n=gk(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(tc,(t,r)=>{let n=gk(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function yk(e,t,r){if(!b2(e))throw ae;let n=ye(e),o=()=>e.state,i=()=>mt(o()),a=null,p=bn(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let m=i();if(!m){a=null;return}let{searchResponseId:f}=o().search;a!==f&&(a=f,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(xn(m)))});return{...n,get state(){let m=o();return{question:m.search.questionAnswer.question,answer:m.search.questionAnswer.answerSnippet,documentId:m.search.questionAnswer.documentId,expanded:m.questionAnswering.expanded,answerFound:m.search.questionAnswer.answerSnippet!=="",liked:m.questionAnswering.liked,disliked:m.questionAnswering.disliked,feedbackModalOpen:m.questionAnswering.feedbackModalOpen,source:i()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Ys())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ks())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Xs())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Zs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Js())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Do())},sendFeedback(m){e.dispatch(t.logSmartSnippetFeedback(m)),e.dispatch(Do())},sendDetailedFeedback(m){e.dispatch(t.logSmartSnippetDetailedFeedback(m)),e.dispatch(Do())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function b2(e){return e.addReducers({search:Te,questionAnswering:wn}),!0}d();c();l();u();function Ng(e,t){if(!x2(e))throw ae;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),i=null,a=g=>{i!==g&&(i=g,m={},n.clear())},p=(g,S,b)=>bn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(S)||e.dispatch(b?mk({questionAnswerId:b},g):tA(g))}),m={},f=(g,S)=>{let{searchResponseId:b}=r().search;a(b);let h=Zi({...g,questionAnswerId:S});return h in m||(m[h]=p(g,h,S)),m[h]};return{selectInlineLink(g,S){f(g,S)?.select()},beginDelayedSelectInlineLink(g,S){f(g,S)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,S){f(g,S)?.cancelPendingSelect()}}}function x2(e){return e.addReducers({search:Te,questionAnswering:wn}),!0}function Sk(e,t){let r=yk(e,_g,t),n=Ng(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function vk(e,t){if(!R2(e))throw ae;let r=ye(e),n=()=>e.state,o=i=>{let{contentIdKey:a,contentIdValue:p}=i;return e.state.search.results.find(m=>po(m,a)===p)};return{...r,get state(){let i=n();return{questions:i.search.questionAnswer.relatedQuestions.map((a,p)=>({question:a.question,answer:a.answerSnippet,documentId:a.documentId,questionAnswerId:i.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:i.questionAnswering.relatedQuestions[p].expanded,source:o(a.documentId)}))}},expand(i){let a={questionAnswerId:i};e.dispatch(t.logExpandSmartSnippetSuggestion(a)),e.dispatch(ec(a))},collapse(i){let a={questionAnswerId:i};e.dispatch(t.logCollapseSmartSnippetSuggestion(a)),e.dispatch(tc(a))}}}function R2(e){return e.addReducers({search:Te,questionAnswering:wn}),!0}d();c();l();u();function Ak(e,t){if(!w2(e))throw ae;let r=()=>e.state,n=S=>{let b=r(),h=Fr(b,S);return h?mt(b,h.documentId):null},o=new Set,i=S=>o.has(S)?!0:(o.add(S),!1),a=null,p=S=>{a!==S&&(a=S,f={},o.clear())},m=(S,b)=>bn(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{i(b)||(e.dispatch(rA({questionAnswerId:b})),e.dispatch(xn(S)))}),f={},g=S=>{let{searchResponseId:b}=r().search;p(b);let h=n(S);return h?(S in f||(f[S]=m(h,S)),f[S]):null};return{selectSource(S){g(S)?.select()},beginDelayedSelectSource(S){g(S)?.beginDelayedSelect()},cancelPendingSelectSource(S){g(S)?.cancelPendingSelect()}}}function w2(e){return e.addReducers({search:Te,questionAnswering:wn}),!0}function Ck(e,t){let r=vk(e,_g),n=Ng(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=Ak(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(i){o.selectSource(i)},beginDelayedSelectSource(i){o.beginDelayedSelectSource(i)},cancelPendingSelectSource(i){o.cancelPendingSelectSource(i)},selectInlineLink(i,a){n.selectInlineLink(a,i)},beginDelayedSelectInlineLink(i,a){n.beginDelayedSelectInlineLink(a,i)},cancelPendingSelectInlineLink(i,a){n.cancelPendingSelectInlineLink(a,i)}}}d();c();l();u();d();c();l();u();d();c();l();u();var bk={by:new cc({enum:Yl,required:!0})},Dg=N("sortCriteria/register",e=>xk(e)),qg=N("sortCriteria/update",e=>xk(e)),xk=e=>Xi(e)?(e.forEach(t=>q(t,bk)),{payload:e}):q(e,bk);d();c();l();u();var Rk=pe(lr(),e=>{e.addCase(Dg,(t,r)=>zr(r.payload)).addCase(qg,(t,r)=>zr(r.payload)).addCase(ot.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(at,(t,r)=>r.payload.sortCriteria??t)});function I2(e,t){if(!t)return;let r=new De({criterion:new ie({each:dx})}),n=E2(t),o={...t,criterion:n};Sr(e,r,o,"buildSort")}function E2(e){return e.criterion?Xi(e.criterion)?e.criterion:[e.criterion]:[]}function wk(e,t){if(!F2(e))throw ae;let r=ye(e),{dispatch:n}=e,o=()=>e.state;I2(e,t.initialState);let i=t.initialState?.criterion;return i&&n(Dg(i)),{...r,sortBy(a){n(qg(a)),n(oo(1))},isSortedBy(a){return this.state.sortCriteria===zr(a)},get state(){return{sortCriteria:o().sortCriteria}}}}function F2(e){return e.addReducers({configuration:Re,sortCriteria:Rk}),!0}function Ik(e,t={}){let{dispatch:r}=e,n=wk(e,t),o=()=>r(xe({legacy:zs(),next:wg()}));return{...n,get state(){return n.state},sortBy(i){n.sortBy(i),o()}}}d();c();l();u();function Ek(e){return Vs(e)}d();c();l();u();d();c();l();u();var T2=new De({expression:Je,id:H,clearFiltersOnTabChange:new de}),P2=new De({isActive:new de});function Fk(e,t){if(O2(t.options.id),!k2(e))throw ae;let r=ye(e),{dispatch:n}=e;yt(e,T2,t.options,"buildTab");let o=Sr(e,P2,t.initialState,"buildTab"),{id:i,expression:a}=t.options;return n(mp({id:i,expression:a})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(Nt(i)),{...r,select(){t.options.clearFiltersOnTabChange&&n(qa({q:"",clearFilters:!0})),n(Nt(i))},get state(){return{isActive:e.state.tabSet[i]?.isActive}}}}function k2(e){return e.addReducers({configuration:Re,tabSet:qm}),!0}function O2(e){let t=hp().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function Tk(e,t){let{dispatch:r}=e,n=Fk(e,t),o=()=>r(xe({legacy:no(),next:wa()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var Pk=()=>ne("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},te(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function kk(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function Ok(e,t){let r=[],n=[],o=[],i=[];return t.forEach(a=>{switch(a.type){case"redirect":r.push(a.content);break;case"query":n.push(a.content);break;case"execute":o.push({functionName:a.content.name,params:a.content.params});break;case"notify":i.push(a.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=i,e}function _k(e,t){return e.queryModification={...t,queryToIgnore:""},e}function Nk(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var Dk=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var qk=pe(Dk(),e=>e.addCase(qe.pending,kk).addCase(qe.fulfilled,(t,r)=>Ok(t,r.payload.response.triggers)).addCase(Da,(t,r)=>_k(t,r.payload)).addCase(Na,(t,r)=>Nk(t,r.payload)));function Mk(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!_2(e))throw ae;let n=ye(e),{dispatch:o}=e,i=()=>e.state,a=i().triggers.notifications;return{...n,subscribe(p){let m=()=>{let f=!nk(a,this.state.notifications);a=this.state.notifications,f&&(p(),o(r()))};return m(),e.subscribe(m)},get state(){return{notifications:i().triggers.notifications}}}}function _2(e){return e.addReducers({triggers:qk}),!0}function Vk(e){return Mk(e,{options:{logNotifyTriggerActionCreator:Pk}})}d();c();l();u();d();c();l();u();var jk=(e,t)=>ne("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=te(n.insightCaseContext),i={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(i)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=te(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),Lk=e=>ne("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(q(e,{articleType:H}),t.logCreateArticle(e,te(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=te(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Mg=()=>ne("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(te(t.insightCaseContext))});d();c();l();u();d();c();l();u();var Uk=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:gt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function Uk(_x237,_x238){return _ref99.apply(this,arguments)}}();var N2={ticketCreationDate:new B({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new ie({required:!1,each:Ze})},rc=N("insight/userActions/registerUserActions",e=>q(e,N2)),qo=fe("insight/userActions/fetch",/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=yield n.userActions(yield Uk(o,e));return Xe(i)?r(i.error):{response:i.success}});return function(_x239,_x240){return _ref100.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function Qk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var D2=1e3,q2=D2*60,oA=30*q2,M2=2,V2=2,$k=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,i=L2(t);return Q2(i,n,o)},j2=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},L2=e=>{let t=!1,r=e.reduce((n,o)=>{try{let i=j2(o);n.push(i)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},U2=(e,t)=>Math.abs(e.timestamp-t)<oA,Bk=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-oA&&t<=e.end+oA){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(i=>i.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},Gk=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},Q2=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(i=>{if(U2(i,o.start)){o.actions.push(i),o.start=i.timestamp;return}o.actions=o.actions.filter(a=>!Gk(a,r)),Bk(o,t,n),o={start:i.timestamp,end:i.timestamp,actions:[i]}}),o.actions=o.actions.filter(i=>!Gk(i,r)),Bk(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,M2),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-V2)}};var Vg=pe(Qk(),e=>{e.addCase(rc,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(qo.pending,t=>{t.loading=!0,t.error=void 0}).addCase(qo.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(qo.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=$k(t,r.payload.response.value)})});function Hk(e,t){if(!B2(e))throw ae;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=ye(e),{ticketCreationDate:i,excludedCustomActions:a}=t.options;return r(rc({ticketCreationDate:i,excludedCustomActions:a})),{...o,get state(){return n()},fetchUserActions(p){r(qo(p))},logOpenUserActions(){r(Mg())}}}function B2(e){return e.addReducers({configuration:Re,insightUserActions:Vg}),!0}d();c();l();u();function zk(e){if(!G2(e))throw ae;let t=ye(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(Wr())}}}function G2(e){return e.addReducers({configuration:Re,insightConfiguration:ad,insightInterface:to,searchHub:Md}),!0}d();c();l();u();function $2(e){return e.addReducers({}),{logSearchEvent:wx,logClickEvent:Ix,logCustomEvent:Ex}}d();c();l();u();d();c();l();u();var Wk=e=>ne("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{_t(e);let n=te(r.insightCaseContext);return t.logCopyToClipboard(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Vr(t)}}}),Yk=e=>ne("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{_t(e);let n=te(r.insightCaseContext);return t.logCaseSendEmail(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Vr(t)}}}),Kk=e=>ne("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{_t(e);let n=te(r.insightCaseContext);return t.logFeedItemTextPost(et(e,r),tt(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=et(e,t);return{itemMetadata:_r(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Vr(t)}}});function H2(e){return e.addReducers({}),{logClearBreadcrumbs:mm,logInterfaceLoad:hd,logInterfaceChange:no,logCreateArticle:Lk,logCategoryFacetBreadcrumb:em,logFacetBreadcrumb:bu,logFacetClearAll:Gt,logFacetDeselect:Lr,logFacetSelect:Kt,logFacetShowLess:Ts,logFacetShowMore:Fs,logFacetUpdateSort:fn,logDateFacetBreadcrumb:xu,logNumericFacetBreadcrumb:Ru,logPageNext:yg,logPageNumber:hg,logPagePrevious:Sg,logResultsSort:zs,logStaticFilterDeselect:Om,logCopyToClipboard:Wk,logCaseSendEmail:Yk,logFeedItemTextPost:Kk,logOpenUserActions:Mg}}d();c();l();u();function z2(e){return e.addReducers({attachedResults:xo}),{setAttachedResults:Xf,detachResult:bo,attachResult:Co}}d();c();l();u();function W2(e){return e.addReducers({attachedResults:xo}),{logCaseDetach:Ss,logCaseAttach:ys}}d();c();l();u();d();c();l();u();d();c();l();u();var jg=N("insight/caseContext/set",e=>{let t=new W({options:{required:!0}}),r=q(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ie({each:Je}),i=q(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Lg=N("insight/caseId/set",e=>{let r=q(e,Je).error;return r?{payload:e,error:r}:{payload:e}}),Ug=N("insight/caseNumber/set",e=>{let r=q(e,Je).error;return r?{payload:e,error:r}:{payload:e}});var Xk=pe(Nx(),e=>{e.addCase(jg,(t,r)=>{t.caseContext=r.payload}).addCase(Lg,(t,r)=>{t.caseId=r.payload}).addCase(Ug,(t,r)=>{t.caseNumber=r.payload})});function Y2(e){return e.addReducers({insightCaseContext:Xk}),{setCaseContext:jg,setCaseId:Lg,setCaseNumber:Ug}}d();c();l();u();d();c();l();u();d();c();l();u();var K2=new ie({each:H,required:!0}),Zk=(e,t)=>(q(e,H),Ki(t)?q(t,H):q(t,K2),{payload:{contextKey:e,contextValue:t}}),Qg=N("context/set",e=>{for(let[t,r]of Object.entries(e))Zk(t,r);return{payload:e}}),Bg=N("context/add",e=>Zk(e.contextKey,e.contextValue)),Gg=N("context/remove",e=>q(e,H));var Jk=pe(dd(),e=>{e.addCase(Qg,(t,r)=>{t.contextValues=r.payload}).addCase(Bg,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Gg,(t,r)=>{delete t.contextValues[r.payload]}).addCase(ot.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function X2(e){return e.addReducers({context:Jk}),{addContext:Bg,removeContext:Gg,setContext:Qg}}d();c();l();u();function Z2(e){return e.addReducers({dateFacetSet:Sn}),{deselectAllDateFacetValues:ym,registerDateFacet:mn,toggleSelectDateFacetValue:gn,toggleExcludeDateFacetValue:hn,updateDateFacetSortCriterion:hm,updateDateFacetValues:Bn}}d();c();l();u();function J2(e){return e.addReducers({numericFacetSet:Eo}),{deselectAllNumericFacetValues:Pm,registerNumericFacet:vn,toggleSelectNumericFacetValue:An,toggleExcludeNumericFacetValue:Cn,updateNumericFacetSortCriterion:Tm,updateNumericFacetValues:Gn}}d();c();l();u();function e$(e){return e.addReducers({fields:Ms}),{registerFieldsToInclude:_o,enableFetchAllFields:ug,disableFetchAllFields:lg,fetchFieldsDescription:dg}}d();c();l();u();function t$(e){return e.addReducers({folding:cg}),{registerFolding:$T,loadCollection:ig}}d();c();l();u();function r$(e){return e.addReducers({generatedAnswer:js}),{generateAnswer:up,resetAnswer:dr,setAnswerGenerationMode:Ha}}d();c();l();u();function n$(e){return e.addReducers({insightInterface:to}),{fetch:Wr}}d();c();l();u();function o$(e){return e.addReducers({querySet:Gs}),{registerQuerySetQuery:Bs,updateQuerySetQuery:Qi}}d();c();l();u();function i$(e){return e.addReducers({search:Te}),{executeSearch:Kx,fetchFacetValues:Jx,fetchMoreResults:Zx,fetchPage:Xx,fetchQuerySuggestions:Cd,registerQuerySuggest:To}}d();c();l();u();function a$(e){return e.addReducers({}),{logContextChanged:Hx,logExpandToFullUI:jk}}d();c();l();u();function s$(e){return e.addReducers({insightUserActions:Vg}),{registerUserActions:rc,fetchUserActions:qo}}d();c();l();u();function c$(e){return e.addReducers({querySuggest:Rg,querySet:Gs}),{clearQuerySuggest:ko,fetchQuerySuggestions:qs,registerQuerySuggest:To,selectQuerySuggestion:Po}}d();c();l();u();function u$(e){return e.addReducers({questionAnswering:wn}),{collapseSmartSnippet:Ks,expandSmartSnippet:Ys,dislikeSmartSnippet:Zs,likeSmartSnippet:Xs,openFeedbackModal:Js,closeFeedbackModal:Do,expandSmartSnippetRelatedQuestion:ec,collapseSmartSnippetRelatedQuestion:tc}}d();c();l();u();d();c();l();u();d();c();l();u();function eO(){return{results:[],maxLength:10}}var tO=pe(eO(),e=>{e.addCase(Ag,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(Cg,t=>{t.results=[]}).addCase(xn,(t,r)=>{let n=r.payload;t.results=t.results.filter(i=>i.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function l$(e){return e.addReducers({recentResults:tO}),{registerRecentResults:Ag,clearRecentResults:Cg,pushRecentResult:xn}}d();c();l();u();d();c();l();u();var d$=new De({content:new Ke({required:!0}),conditions:new Ke({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ie({required:!1,each:H})});function rO(){let e=[],t=r=>{let n=d$.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new Mo("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 nO(e){if(!p$(e))throw ae;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=rO();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(_o(i))},selectTemplate:r,selectLinkTemplate:n}}function p$(e){return e.addReducers({fields:Ms}),!0}/**
47
47
  * @license
48
48
  *
49
49
  * Copyright 2026 Coveo Solutions Inc.
@@ -76,4 +76,4 @@ fast-json-patch/module/duplex.mjs:
76
76
  *)
77
77
  */if(__exports!=exports)module.exports=exports;return module.exports});
78
78
 
79
- window.coveoQuanticVersion = '3.45.5';
79
+ window.coveoQuanticVersion = '3.45.6';