@coveo/quantic 3.45.7 → 3.45.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/out/quantic-docs.json +5 -5
- package/force-app/main/default/lwc/quanticBreadcrumbManager/quanticBreadcrumbManager.html +4 -4
- package/force-app/main/default/lwc/quanticCarousel/quanticCarousel.html +2 -2
- package/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.html +18 -18
- package/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js +3 -3
- package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.html +45 -45
- package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.js +9 -0
- package/force-app/main/default/lwc/quanticCategoryFacetValue/quanticCategoryFacetValue.html +11 -11
- package/force-app/main/default/lwc/quanticColoredResultBadge/quanticColoredResultBadge.html +5 -5
- package/force-app/main/default/lwc/quanticDateFacet/quanticDateFacet.html +4 -4
- package/force-app/main/default/lwc/quanticDateFacet/quanticDateFacet.js +4 -0
- package/force-app/main/default/lwc/quanticDidYouMean/templates/didYouMean.html +2 -2
- package/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.html +4 -4
- package/force-app/main/default/lwc/quanticFacet/quanticFacet.html +43 -43
- package/force-app/main/default/lwc/quanticFacet/quanticFacet.js +8 -0
- package/force-app/main/default/lwc/quanticFacetValue/quanticFacetValue.html +5 -5
- package/force-app/main/default/lwc/quanticFacetValue/quanticFacetValue.js +4 -0
- package/force-app/main/default/lwc/quanticFeedbackModal/feedbackForm.html +2 -2
- package/force-app/main/default/lwc/quanticFoldedResultList/quanticFoldedResultList.html +1 -1
- package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.html +5 -5
- package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.js +4 -0
- package/force-app/main/default/lwc/quanticModal/quanticModal.html +2 -2
- package/force-app/main/default/lwc/quanticNoResults/quanticNoResults.html +4 -4
- package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.html +6 -6
- package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.js +4 -0
- package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.html +3 -3
- package/force-app/main/default/lwc/quanticQueryError/quanticQueryError.html +6 -6
- package/force-app/main/default/lwc/quanticQueryError/quanticQueryError.js +4 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/quanticQuickviewDefault.html +1 -1
- package/force-app/main/default/lwc/quanticQuickviewContent/quanticQuickviewYoutube.html +1 -1
- package/force-app/main/default/lwc/quanticRecentQueriesList/quanticRecentQueriesList.html +4 -4
- package/force-app/main/default/lwc/quanticRecentQueriesList/quanticRecentQueriesList.js +8 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/quanticRecentResultsList.html +4 -4
- package/force-app/main/default/lwc/quanticRecentResultsList/quanticRecentResultsList.js +8 -0
- package/force-app/main/default/lwc/quanticRefineModalContent/quanticRefineModalContent.js +4 -0
- package/force-app/main/default/lwc/quanticRefineModalContent/templates/disabledDynamicNavigation.html +9 -9
- package/force-app/main/default/lwc/quanticRefineModalContent/templates/dynamicNavigation.html +9 -9
- package/force-app/main/default/lwc/quanticRefineToggle/quanticRefineToggle.html +2 -2
- package/force-app/main/default/lwc/quanticResult/quanticResult.html +1 -1
- package/force-app/main/default/lwc/quanticResultAction/quanticResultAction.html +3 -3
- package/force-app/main/default/lwc/quanticResultChildren/quanticResultChildren.html +3 -3
- package/force-app/main/default/lwc/quanticResultDate/quanticResultDate.html +2 -2
- package/force-app/main/default/lwc/quanticResultDate/quanticResultDate.js +1 -1
- package/force-app/main/default/lwc/quanticResultField/quanticResultField.js +1 -1
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/quanticResultHighlightedTextField.html +3 -3
- package/force-app/main/default/lwc/quanticResultLabel/quanticResultLabel.html +3 -3
- package/force-app/main/default/lwc/quanticResultLabel/quanticResultLabel.js +4 -0
- package/force-app/main/default/lwc/quanticResultList/quanticResultList.html +1 -1
- package/force-app/main/default/lwc/quanticResultMultiValueText/quanticResultMultiValueText.html +3 -3
- package/force-app/main/default/lwc/quanticResultMultiValueText/quanticResultMultiValueText.js +1 -1
- package/force-app/main/default/lwc/quanticResultNumber/quanticResultNumber.html +2 -2
- package/force-app/main/default/lwc/quanticResultNumber/quanticResultNumber.js +1 -1
- package/force-app/main/default/lwc/quanticResultPrintableUri/quanticResultPrintableUri.html +4 -4
- package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.html +5 -5
- package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.js +2 -2
- package/force-app/main/default/lwc/quanticResultTag/quanticResultTag.html +2 -2
- package/force-app/main/default/lwc/quanticResultText/quanticResultText.html +3 -3
- package/force-app/main/default/lwc/quanticResultText/quanticResultText.js +1 -1
- package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.html +1 -1
- package/force-app/main/default/lwc/quanticSearchBoxInput/quanticSearchBoxInput.js +6 -2
- package/force-app/main/default/lwc/quanticSearchBoxInput/templates/defaultSearchBoxInput.html +4 -4
- package/force-app/main/default/lwc/quanticSearchBoxInput/templates/expandableSearchBoxInput.html +4 -4
- package/force-app/main/default/lwc/quanticSmartSnippet/quanticSmartSnippet.html +2 -2
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/quanticSmartSnippetSuggestions.html +1 -1
- package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.html +1 -1
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/templates/standaloneSearchBox.html +2 -2
- package/force-app/main/default/lwc/quanticSummary/quanticSummary.html +1 -1
- package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.html +7 -7
- package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js +5 -0
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/quanticViewedByCustomerBadge.html +2 -2
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/logger.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/build-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +20 -20
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
- package/package.json +6 -6
|
@@ -14,32 +14,32 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function Cl(){return Cl=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Fw(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Cl.apply(null,arguments)}function Wn(e){return Wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wn(e)}function Pw(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&&El(e,t)}function em(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(em=function(){return!!e})()}function Nw(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 kw(e)}function El(e,t){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},El(e,t)}function Fw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wn(e))!==null;);return e}function Dw(e,t,r,n){var o=Cl(Wn(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Mw(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 Lw(e){var t=Mw(e,"string");return typeof t=="symbol"?t:t+""}function qw(e,t){if(e){if(typeof e=="string")return Yf(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)?Yf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function jw(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 Uw(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var Jf=function(){function e(){Rl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Il(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[s];try{g.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},s=0,u=i.length;s<u;s++)a();return!r.defaultPrevented}}}])}(),Tl=function(e){function t(){var r;return Rl(this,t),r=Ow(this,t),r.listeners||Jf.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Pw(t,e),Il(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)),Dw(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 Ia;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 Ia;function i(){o.abort(this.reason),a()}function a(){var g=Zf(n),v;try{for(g.s();!(v=g.n()).done;){var R=v.value;R.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=Zf(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){s.e(g)}finally{s.f()}return o.signal}}])}(Jf),Ia=function(){function e(){Rl(this,e),Object.defineProperty(this,"signal",{value:new Tl,writable:!0,configurable:!0})}return Il(e,[{key:"abort",value:function(r){var n=Uw(r),o=jw(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Ia.prototype[Symbol.toStringTag]="AbortController",Tl.prototype[Symbol.toStringTag]="AbortSignal");function Vw(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 Gw(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Vw({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||s)&&(u=function(R,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(R,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},u.prototype=o.prototype);var c=r,g=function(R,h){var y=u&&u.prototype.isPrototypeOf(R)?R.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var x=new Promise(function(I,N){y.addEventListener("abort",function(){return N(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,c(R,h)])}return c(R,h)};return{fetch:g,Request:u}}li.AbortController=Ia;li.AbortSignal=Tl;li.abortableFetch=Gw});var tm,l,C,f=zn(()=>{"use strict";tm=jt(_l(),1),l=jt(_l(),1),{fetch:C}=(0,tm.abortableFetch)({fetch})});function rm(e){return typeof e!="string"||e in{}}function kl(){return Object.create(null)}function im(e){return typeof e=="string"&&!!e.trim()}function Ol(e,t){var r=e.split(";").filter(im),n=r.shift();if(!n)return null;var o=Bw(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ta,t):Ta,rm(i))return t.silent||console.warn("set-cookie-parser: dropping cookie due to name:",i),null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(u){t.silent||console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var s=kl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(rm(g)||g==="name"||g==="value"){t.silent||console.warn("set-cookie-parser: ignoring attribute:",u);return}var v=c.join("=").trim();if(g==="expires"){var R=new Date(v);Number.isNaN(R.getTime())?t.silent||console.error("set-cookie-parser: failed to parse expires time:",v):s.expires=R}else g==="max-age"?/^-?\d+$/.test(v)?s.maxAge=parseInt(v,10):t.silent||console.error("set-cookie-parser: failed to parse max-age:",v):g==="secure"?s.secure=!0:g==="httponly"?s.httpOnly=!0:g==="samesite"?s.sameSite=v:g==="partitioned"?s.partitioned=!0:g&&(s[g]=v)}),s}function Bw(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:nm(t),value:nm(r)}}function nm(e){for(var t=0,r=e.length;t<r&&om(e.charCodeAt(t));)t+=1;for(;r>t&&om(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function om(e){return e===32||e===9}function Kn(e,t){if(t=t?Object.assign({},Ta,t):Ta,!e)return t.map?kl():[];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."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(im),n&&(e=e.map(_a).flat()),t.map){var i=kl();return e.reduce(function(a,s){var u=Ol(s,t);return u&&(a[u.name]=u),a},i)}else return e.map(function(a){return Ol(a,t)}).filter(Boolean)}function _a(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),a=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Ta,am=zn(()=>{"use strict";m();d();f();p();Ta={decodeValues:!0,map:!1,silent:!1,split:"auto"};Kn.parseSetCookie=Kn;Kn.parse=Kn;Kn.parseString=Ol;Kn.splitCookiesString=_a});function di(e){if($w.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Pl(e){return e.replace(Qw,"")}function pi(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Hw(r))return!1}return!0}function Hw(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function cm(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 $w,sm,Qw,um,Yn,Nl,lm,E,pm=zn(()=>{"use strict";m();d();f();p();am();$w=/[^a-z0-9\-#$%&'*+.^_`|~]/i;sm=[`
|
|
19
|
-
`,"\r","\t"," "],Qw=new RegExp(`(^[${sm.join("")}]|$[${sm.join("")}])`,"g");Yn=Symbol("normalizedHeaders"),Nl=Symbol("rawHeaderNames"),lm=", ",E=class dm{constructor(t){this[Yn]={},this[Nl]=new Map,this[um]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof dm||typeof A.Headers<"u"&&t instanceof A.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(lm):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(lm):n)})}[(um=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[Yn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!pi(t))throw new TypeError(`Invalid header name "${t}"`);return this[Yn].hasOwnProperty(di(t))}get(t){if(!pi(t))throw TypeError(`Invalid header name "${t}"`);return this[Yn][di(t)]??null}set(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Pl(r);this[Yn][n]=Pl(o),this[Nl].set(n,t)}append(t,r){if(!pi(t)||!cm(r))return;let n=di(t),o=Pl(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!pi(t)||!this.has(t))return;let r=di(t);delete this[Yn][r],this[Nl].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===""?[""]:_a(t)}}});var m=zn(()=>{"use strict";pm()});var Sm=Ze(gi=>{"use strict";m();d();f();p();var Na=gi&&gi.__assign||function(){return Na=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},Na.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});var tx={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function rx(e){var t=Na(Na({},tx),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}gi.getSanitizedOptions=rx});var bm=Ze(ql=>{"use strict";m();d();f();p();Object.defineProperty(ql,"__esModule",{value:!0});function nx(e){var t=Math.random()*e;return Math.round(t)}ql.fullJitter=nx});var Am=Ze(jl=>{"use strict";m();d();f();p();Object.defineProperty(jl,"__esModule",{value:!0});function ox(e){return e}jl.noJitter=ox});var wm=Ze(Ul=>{"use strict";m();d();f();p();Object.defineProperty(Ul,"__esModule",{value:!0});var ix=bm(),ax=Am();function sx(e){return e.jitter==="full"?ix.fullJitter:ax.noJitter}Ul.JitterFactory=sx});var Gl=Ze(Vl=>{"use strict";m();d();f();p();Object.defineProperty(Vl,"__esModule",{value:!0});var cx=wm(),ux=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=cx.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}();Vl.Delay=ux});var xm=Ze(ar=>{"use strict";m();d();f();p();var lx=ar&&ar.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),dx=ar&&ar.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},px=ar&&ar.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(ar,"__esModule",{value:!0});var fx=Gl(),mx=function(e){lx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return dx(this,void 0,void 0,function(){return px(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}(fx.Delay);ar.SkipFirstDelay=mx});var Cm=Ze(hi=>{"use strict";m();d();f();p();var gx=hi&&hi.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(hi,"__esModule",{value:!0});var hx=Gl(),yx=function(e){gx(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(hx.Delay);hi.AlwaysDelay=yx});var Em=Ze(Bl=>{"use strict";m();d();f();p();Object.defineProperty(Bl,"__esModule",{value:!0});var vx=xm(),Sx=Cm();function bx(e,t){var r=Ax(e);return r.setAttemptNumber(t),r}Bl.DelayFactory=bx;function Ax(e){return e.delayFirstAttempt?new Sx.AlwaysDelay(e):new vx.SkipFirstDelay(e)}});var Rm=Ze(en=>{"use strict";m();d();f();p();var $l=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 s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},Ql=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:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(en,"__esModule",{value:!0});var wx=Sm(),xx=Em();function Cx(e,t){return t===void 0&&(t={}),$l(this,void 0,void 0,function(){var r,n;return Ql(this,function(o){switch(o.label){case 0:return r=wx.getSanitizedOptions(t),n=new Ex(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}en.backOff=Cx;var Ex=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return $l(this,void 0,void 0,function(){var t,r;return Ql(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 $l(this,void 0,void 0,function(){var t;return Ql(this,function(r){switch(r.label){case 0:return t=xx.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var oc=Ze((gp,hp)=>{"use strict";m();d();f();p();(function(e,t){typeof gp=="object"&&typeof hp<"u"?hp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(gp,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",c="month",g="quarter",v="year",R="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(q){var B=["th","st","nd","rd"],j=q%100;return"["+q+(B[(j-20)%10]||B[j]||B[0])+"]"}},I=function(q,B,j){var W=String(q);return!W||W.length>=B?q:""+Array(B+1-W.length).join(j)+q},N={s:I,z:function(q){var B=-q.utcOffset(),j=Math.abs(B),W=Math.floor(j/60),Q=j%60;return(B<=0?"+":"-")+I(W,2,"0")+":"+I(Q,2,"0")},m:function q(B,j){if(B.date()<j.date())return-q(j,B);var W=12*(j.year()-B.year())+(j.month()-B.month()),Q=B.clone().add(W,c),X=j-Q<0,z=B.clone().add(W+(X?-1:1),c);return+(-(W+(j-Q)/(X?Q-z:z-Q))||0)},a:function(q){return q<0?Math.ceil(q)||0:Math.floor(q)},p:function(q){return{M:c,y:v,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[q]||String(q||"").toLowerCase().replace(/s$/,"")},u:function(q){return q===void 0}},_="en",P={};P[_]=x;var w="$isDayjsObject",O=function(q){return q instanceof G||!(!q||!q[w])},k=function q(B,j,W){var Q;if(!B)return _;if(typeof B=="string"){var X=B.toLowerCase();P[X]&&(Q=X),j&&(P[X]=j,Q=X);var z=B.split("-");if(!Q&&z.length>1)return q(z[0])}else{var Z=B.name;P[Z]=B,Q=Z}return!W&&Q&&(_=Q),Q||!W&&_},T=function(q,B){if(O(q))return q.clone();var j=typeof B=="object"?B:{};return j.date=q,j.args=arguments,new G(j)},D=N;D.l=k,D.i=O,D.w=function(q,B){return T(q,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var G=function(){function q(j){this.$L=k(j.locale,null,!0),this.parse(j),this.$x=this.$x||j.x||{},this[w]=!0}var B=q.prototype;return B.parse=function(j){this.$d=function(W){var Q=W.date,X=W.utc;if(Q===null)return new Date(NaN);if(D.u(Q))return new Date;if(Q instanceof Date)return new Date(Q);if(typeof Q=="string"&&!/Z$/i.test(Q)){var z=Q.match(y);if(z){var Z=z[2]-1||0,se=(z[7]||"0").substring(0,3);return X?new Date(Date.UTC(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)):new Date(z[1],Z,z[3]||1,z[4]||0,z[5]||0,z[6]||0,se)}}return new Date(Q)}(j),this.init()},B.init=function(){var j=this.$d;this.$y=j.getFullYear(),this.$M=j.getMonth(),this.$D=j.getDate(),this.$W=j.getDay(),this.$H=j.getHours(),this.$m=j.getMinutes(),this.$s=j.getSeconds(),this.$ms=j.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==h},B.isSame=function(j,W){var Q=T(j);return this.startOf(W)<=Q&&Q<=this.endOf(W)},B.isAfter=function(j,W){return T(j)<this.startOf(W)},B.isBefore=function(j,W){return this.endOf(W)<T(j)},B.$g=function(j,W,Q){return D.u(j)?this[W]:this.set(Q,j)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(j,W){var Q=this,X=!!D.u(W)||W,z=D.p(j),Z=function(ve,me){var we=D.w(Q.$u?Date.UTC(Q.$y,me,ve):new Date(Q.$y,me,ve),Q);return X?we:we.endOf(s)},se=function(ve,me){return D.w(Q.toDate()[ve].apply(Q.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(me)),Q)},ye=this.$W,_e=this.$M,Ge=this.$D,Fe="set"+(this.$u?"UTC":"");switch(z){case v:return X?Z(1,0):Z(31,11);case c:return X?Z(1,_e):Z(0,_e+1);case u:var Me=this.$locale().weekStart||0,Le=(ye<Me?ye+7:ye)-Me;return Z(X?Ge-Le:Ge+(6-Le),_e);case s:case R:return se(Fe+"Hours",0);case a:return se(Fe+"Minutes",1);case i:return se(Fe+"Seconds",2);case o:return se(Fe+"Milliseconds",3);default:return this.clone()}},B.endOf=function(j){return this.startOf(j,!1)},B.$set=function(j,W){var Q,X=D.p(j),z="set"+(this.$u?"UTC":""),Z=(Q={},Q[s]=z+"Date",Q[R]=z+"Date",Q[c]=z+"Month",Q[v]=z+"FullYear",Q[a]=z+"Hours",Q[i]=z+"Minutes",Q[o]=z+"Seconds",Q[n]=z+"Milliseconds",Q)[X],se=X===s?this.$D+(W-this.$W):W;if(X===c||X===v){var ye=this.clone().set(R,1);ye.$d[Z](se),ye.init(),this.$d=ye.set(R,Math.min(this.$D,ye.daysInMonth())).$d}else Z&&this.$d[Z](se);return this.init(),this},B.set=function(j,W){return this.clone().$set(j,W)},B.get=function(j){return this[D.p(j)]()},B.add=function(j,W){var Q,X=this;j=Number(j);var z=D.p(W),Z=function(_e){var Ge=T(X);return D.w(Ge.date(Ge.date()+Math.round(_e*j)),X)};if(z===c)return this.set(c,this.$M+j);if(z===v)return this.set(v,this.$y+j);if(z===s)return Z(1);if(z===u)return Z(7);var se=(Q={},Q[i]=t,Q[a]=r,Q[o]=e,Q)[z]||1,ye=this.$d.getTime()+j*se;return D.w(ye,this)},B.subtract=function(j,W){return this.add(-1*j,W)},B.format=function(j){var W=this,Q=this.$locale();if(!this.isValid())return Q.invalidDate||h;var X=j||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),Z=this.$H,se=this.$m,ye=this.$M,_e=Q.weekdays,Ge=Q.months,Fe=Q.meridiem,Me=function(me,we,Se,He){return me&&(me[we]||me(W,X))||Se[we].slice(0,He)},Le=function(me){return D.s(Z%12||12,me,"0")},ve=Fe||function(me,we,Se){var He=me<12?"AM":"PM";return Se?He.toLowerCase():He};return X.replace(b,function(me,we){return we||function(Se){switch(Se){case"YY":return String(W.$y).slice(-2);case"YYYY":return D.s(W.$y,4,"0");case"M":return ye+1;case"MM":return D.s(ye+1,2,"0");case"MMM":return Me(Q.monthsShort,ye,Ge,3);case"MMMM":return Me(Ge,ye);case"D":return W.$D;case"DD":return D.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Me(Q.weekdaysMin,W.$W,_e,2);case"ddd":return Me(Q.weekdaysShort,W.$W,_e,3);case"dddd":return _e[W.$W];case"H":return String(Z);case"HH":return D.s(Z,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ve(Z,se,!0);case"A":return ve(Z,se,!1);case"m":return String(se);case"mm":return D.s(se,2,"0");case"s":return String(W.$s);case"ss":return D.s(W.$s,2,"0");case"SSS":return D.s(W.$ms,3,"0");case"Z":return z}return null}(me)||z.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(j,W,Q){var X,z=this,Z=D.p(W),se=T(j),ye=(se.utcOffset()-this.utcOffset())*t,_e=this-se,Ge=function(){return D.m(z,se)};switch(Z){case v:X=Ge()/12;break;case c:X=Ge();break;case g:X=Ge()/3;break;case u:X=(_e-ye)/6048e5;break;case s:X=(_e-ye)/864e5;break;case a:X=_e/r;break;case i:X=_e/t;break;case o:X=_e/e;break;default:X=_e}return Q?X:D.a(X)},B.daysInMonth=function(){return this.endOf(c).$D},B.$locale=function(){return P[this.$L]},B.locale=function(j,W){if(!j)return this.$L;var Q=this.clone(),X=k(j,W,!0);return X&&(Q.$L=X),Q},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},q}(),M=G.prototype;return T.prototype=M,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",v],["$D",R]].forEach(function(q){M[q[1]]=function(B){return this.$g(B,q[0],q[1])}}),T.extend=function(q,B){return q.$i||(q(B,G,T),q.$i=!0),T},T.locale=k,T.isDayjs=O,T.unix=function(q){return T(1e3*q)},T.en=P[_],T.Ls=P,T.p={},T})});var Ry=Ze((yp,vp)=>{"use strict";m();d();f();p();(function(e,t){typeof yp=="object"&&typeof vp<"u"?vp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(yp,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===t?this.add(3*s,e):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(s)===t){var v=this.quarter()-1;return g?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var Iy=Ze((Sp,bp)=>{"use strict";m();d();f();p();(function(e,t){typeof Sp=="object"&&typeof bp<"u"?bp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Sp,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},u=function(y){return function(b){this[y]=+b}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var x=b.match(/([+-]|\d\d)/g),I=60*x[1]+(+x[2]||0);return I===0?0:x[0]==="+"?-I:I}(y)}],g=function(y){var b=a[y];return b&&(b.indexOf?b:b.s.concat(b.f))},v=function(y,b){var x,I=a.meridiem;if(I){for(var N=1;N<=24;N+=1)if(y.indexOf(I(N,0,b))>-1){x=N>12;break}}else x=y===(b?"pm":"PM");return x},R={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(y){var b=a.ordinal,x=y.match(/\d+/);if(this.day=x[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(y){var b=g("months"),x=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[i,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var b,x;b=y,x=a&&a.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,D,G){var M=G&&G.toUpperCase();return D||x[G]||e[G]||x[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(q,B,j){return B||j.slice(1)})})).match(t),N=I.length,_=0;_<N;_+=1){var P=I[_],w=R[P],O=w&&w[0],k=w&&w[1];I[_]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(T){for(var D={},G=0,M=0;G<N;G+=1){var q=I[G];if(typeof q=="string")M+=q.length;else{var B=q.regex,j=q.parser,W=T.slice(M),Q=B.exec(W)[0];j.call(D,Q),T=T.replace(Q,"")}}return function(X){var z=X.afternoon;if(z!==void 0){var Z=X.hours;z?Z<12&&(X.hours+=12):Z===12&&(X.hours=0),delete X.afternoon}}(D),D}}return function(y,b,x){x.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var I=b.prototype,N=I.parse;I.parse=function(_){var P=_.date,w=_.utc,O=_.args;this.$u=w;var k=O[1];if(typeof k=="string"){var T=O[2]===!0,D=O[3]===!0,G=T||D,M=O[2];D&&(M=O[2]),a=this.$locale(),!T&&M&&(a=x.Ls[M]),this.$d=function(W,Q,X,z){try{if(["x","X"].indexOf(Q)>-1)return new Date((Q==="X"?1e3:1)*W);var Z=h(Q)(W),se=Z.year,ye=Z.month,_e=Z.day,Ge=Z.hours,Fe=Z.minutes,Me=Z.seconds,Le=Z.milliseconds,ve=Z.zone,me=Z.week,we=new Date,Se=_e||(se||ye?1:we.getDate()),He=se||we.getFullYear(),Ye=0;se&&!ye||(Ye=ye>0?ye-1:we.getMonth());var Tt,xt=Ge||0,qt=Fe||0,_t=Me||0,ir=Le||0;return ve?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir+60*ve.offset*1e3)):X?new Date(Date.UTC(He,Ye,Se,xt,qt,_t,ir)):(Tt=new Date(He,Ye,Se,xt,qt,_t,ir),me&&(Tt=z(Tt).week(me).toDate()),Tt)}catch{return new Date("")}}(P,k,w,x),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),G&&P!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var q=k.length,B=1;B<=q;B+=1){O[1]=k[B-1];var j=x.apply(this,O);if(j.isValid()){this.$d=j.$d,this.$L=j.$L,this.init();break}B===q&&(this.$d=new Date(""))}else N.call(this,_)}}})});var xv=Ze((Dp,Mp)=>{"use strict";m();d();f();p();(function(e,t){typeof Dp=="object"&&typeof Mp<"u"?Mp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Dp,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(g,v,R){R===void 0&&(R={});var h=new Date(g),y=function(b,x){x===void 0&&(x={});var I=x.timeZoneName||"short",N=b+"|"+I,_=t[N];return _||(_=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[N]=_),_}(v,R);return y.formatToParts(h)},s=function(g,v){for(var R=a(g,v),h=[],y=0;y<R.length;y+=1){var b=R[y],x=b.type,I=b.value,N=e[x];N>=0&&(h[N]=parseInt(I,10))}var _=h[3],P=_===24?0:_,w=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(w).valueOf()-(O-=O%1e3))/6e4},u=n.prototype;u.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var R,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),x=s(+y,g);if(!Number(x))R=this.utcOffset(0,v);else if(R=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),v){var I=R.utcOffset();R=R.add(h-I,"minute")}return R.$x.$timezone=g,R},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),R=a(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return R&&R.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var R=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(R,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,R){var h=R&&v,y=R||v||i,b=s(+o(),y);if(typeof g!="string")return o(g).tz(y);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var I=o(NaN);return I.$x.$timezone=y,I}var N=function(O,k,T){var D=O-60*k*1e3,G=s(D,T);if(k===G)return[D,k];var M=s(D-=60*(G-k)*1e3,T);return G===M?[D,G]:[O-60*Math.min(G,M)*1e3,Math.max(G,M)]}(x,b,y),_=N[0],P=N[1],w=o(_).utcOffset(P);return w.$x.$timezone=y,w},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Cv=Ze((Lp,qp)=>{"use strict";m();d();f();p();(function(e,t){typeof Lp=="object"&&typeof qp<"u"?qp.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Lp,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},a.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),s.call(this,h)};var u=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else u.call(this)};var c=a.utcOffset;a.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(_){_===void 0&&(_="");var P=_.match(t);if(!P)return null;var w=(""+P[0]).match(r)||["-",0,0],O=w[0],k=60*+w[1]+ +w[2];return k===0?0:O==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=x,I.$u=!1,I;var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(x+N,e)).$offset=x,I.$x.$localOffset=N,I};var g=a.format;a.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},a.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var R=a.diff;a.diff=function(h,y,b){if(h&&this.$u===h.$u)return R.call(this,h,y,b);var x=this.local(),I=i(h).local();return R.call(x,I,y,b)}}})});var SA=Ze((yle,vA)=>{"use strict";m();d();f();p();function KP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}vA.exports=YP;function YP(e,t,r){var n=r&&r.stringify||KP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,R=e&&e.length||0,h=0;h<R;){if(e.charCodeAt(h)===37&&h+1<R){switch(v=v>-1?v:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Number(t[g]),v=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;v<h&&(c+=e.slice(v,h)),c+=Math.floor(Number(t[g])),v=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;v<h&&(c+=e.slice(v,h));var y=typeof t[g];if(y==="string"){c+="'"+t[g]+"'",v=h+2,h++;break}if(y==="function"){c+=t[g].name||"<anonymous>",v=h+2,h++;break}c+=n(t[g]),v=h+2,h++;break;case 115:if(g>=u)break;v<h&&(c+=e.slice(v,h)),c+=String(t[g]),v=h+2,h++;break;case 37:v<h&&(c+=e.slice(v,h)),c+="%",v=h+2,h++,g--;break}++g}++h}return v===-1?e:(v<R&&(c+=e.slice(v)),c)}});var RA=Ze((wle,ll)=>{"use strict";m();d();f();p();var bA=SA();ll.exports=Ar;var Aa=dN().console||{},XP={mapHttpRequest:ul,mapHttpResponse:ul,wrapRequestSerializer:Mf,wrapResponseSerializer:Mf,wrapErrorSerializer:Mf,req:ul,res:ul,err:wA,errWithCause:wA};function Xr(e,t){return e==="silent"?1/0:t.levels.values[e]}var jf=Symbol("pino.logFuncs"),Lf=Symbol("pino.hierarchy"),ZP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function AA(e,t){let r={logger:t,parent:e[Lf]};t[Lf]=r}function JP(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Aa[o]||Aa[ZP[o]||"log"]||ri}),e[jf]=n}function eN(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Ar(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||Aa;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=eN(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=ri),JP(c,s,r),AA({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:R,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:cN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ri};c.levels=tN(e),c.level=u,c.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=ri,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=qf());function v(){return Xr(this.level,this)}function R(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Bn(this,g,c,"error"),Bn(this,g,c,"fatal"),Bn(this,g,c,"warn"),Bn(this,g,c,"info"),Bn(this,g,c,"debug"),Bn(this,g,c,"trace"),a.forEach(x=>{Bn(this,g,c,x)})}function y(b,x,I){if(!x)throw new Error("missing bindings for child Pino");I=I||{},o&&x.serializers&&(I.serializers=x.serializers);let N=I.serializers;if(o&&N){var _=Object.assign({},n,N),P=e.browser.serialize===!0?Object.keys(_):o;delete x.serializers,Uf([x],P,_,this._stdErrSerialize)}function w(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,_&&(this.serializers=_,this._serialize=P),t&&(this._logEvent=qf([].concat(k._logEvent.bindings,x)))}w.prototype=this;let O=new w(this);return AA(this,O),O.child=function(...k){return y.call(this,b,...k)},O.level=I.level||this.level,b.onChild(O),O}return c}function tN(e){let t=e.customLevels||{},r=Object.assign({},Ar.levels.values,t),n=Object.assign({},Ar.levels.labels,rN(t));return{values:r,labels:n}}function rN(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Ar.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"}};Ar.stdSerializers=XP;Ar.stdTimeFunctions=Object.assign({},{nullTime:CA,epochTime:EA,unixTime:uN,isoTime:lN});function nN(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[Lf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Bn(e,t,r,n){if(Object.defineProperty(e,n,{value:Xr(e.level,r)>Xr(n,r)?ri:r[jf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ri){if(!t.transmit)return;let i=t.transmit.level||e.level,a=Xr(i,r);if(Xr(n,r)<a)return}e[n]=iN(e,t,r,n);let o=nN(e);o.length!==0&&(e[n]=oN(o,e[n]))}function oN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function iN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Aa?Aa:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(Uf(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=aN(this,n,s,a,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let R=xA();R&&(v[0].caller=R)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=xA();v&&s.push(v)}catch{}o.apply(u,s)}if(t.transmit){let v=t.transmit.level||e._level,R=Xr(v,r),h=Xr(n,r);if(h<R)return;sN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Xr(e._level,r)},s,g)}}}(e[jf][n])}function aN(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),u=s[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(c,v)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());return[a(c),...s]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());u=s.length?bA(s.shift(),s):void 0}else typeof u=="string"&&(u=bA(s.shift(),s));return u!==void 0&&(c[o.messageKey]=u),[a(c)]}}function Uf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Ar.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 sN(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,u=t.val,c=e._logEvent.bindings;n||Uf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,u),e._logEvent=qf(c)}function qf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function wA(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 cN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?CA:EA}function ul(){return{}}function Mf(e){return e}function ri(){}function CA(){return!1}function EA(){return Date.now()}function uN(){return Math.round(Date.now()/1e3)}function lN(){return new Date(Date.now()).toISOString()}function dN(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}ll.exports.default=Ar;ll.exports.pino=Ar;function xA(){let e=new Error().stack;if(!e)return null;let t=e.split(`
|
|
20
|
-
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var
|
|
17
|
+
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var $w=Object.create;var vi=Object.defineProperty;var Qw=Object.getOwnPropertyDescriptor;var Hw=Object.getOwnPropertyNames;var zw=Object.getPrototypeOf,Ww=Object.prototype.hasOwnProperty;var Kw=(e,t,r)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Jn=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Je=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Si=(e,t)=>{for(var r in t)vi(e,r,{get:t[r],enumerable:!0})},lm=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hw(t))!Ww.call(e,o)&&o!==r&&vi(e,o,{get:()=>t[o],enumerable:!(n=Qw(t,o))||n.enumerable});return e};var Ut=(e,t,r)=>(r=e!=null?$w(zw(e)):{},lm(t||!e||!e.__esModule?vi(r,"default",{value:e,enumerable:!0}):r,e)),Yw=e=>lm(vi({},"__esModule",{value:!0}),e);var de=(e,t,r)=>Kw(e,typeof t!="symbol"?t+"":t,r);var A,d=Jn(()=>{"use strict";A=typeof globalThis<"u"?globalThis:window});function La(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?La=function(t){return typeof t}:La=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},La(e)}function Jw(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=eC.bind(this))}function eC(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","*/*"),Xw(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Zw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Xw,Zw,f=Jn(()=>{"use strict";Xw=function(t){return typeof t=="string"},Zw=function(t){return t instanceof Blob};Jw.call((typeof window>"u"?"undefined":La(window))==="object"?window:{})});var Bl=Je(bi=>{"use strict";m();d();p();f();Object.defineProperty(bi,"__esModule",{value:!0});function dm(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 tC(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rC(e,t,r){return t=eo(t),oC(e,gm()?Reflect.construct(t,r||[],eo(e).constructor):t.apply(e,r))}function jl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fm(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,cC(n.key),n)}}function Ul(e,t,r){return t&&fm(e.prototype,t),r&&fm(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function pm(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=uC(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function ql(){return ql=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=iC(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},ql.apply(null,arguments)}function eo(e){return eo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},eo(e)}function nC(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&&Ll(e,t)}function gm(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gm=function(){return!!e})()}function oC(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 tC(e)}function Ll(e,t){return Ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ll(e,t)}function iC(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=eo(e))!==null;);return e}function aC(e,t,r,n){var o=ql(eo(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function sC(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 cC(e){var t=sC(e,"string");return typeof t=="symbol"?t:t+""}function uC(e,t){if(e){if(typeof e=="string")return dm(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)?dm(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function lC(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 dC(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 mm=function(){function e(){jl(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Ul(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var g=i[s];try{g.callback.call(n,r)}catch(y){Promise.resolve().then(function(){throw y})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},s=0,u=i.length;s<u;s++)a();return!r.defaultPrevented}}}])}(),Vl=function(e){function t(){var r;return jl(this,t),r=rC(this,t),r.listeners||mm.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 nC(t,e),Ul(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)),aC(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 ja;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 ja;function i(){o.abort(this.reason),a()}function a(){var g=pm(n),y;try{for(g.s();!(y=g.n()).done;){var R=y.value;R.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var s=pm(n),u;try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){s.e(g)}finally{s.f()}return o.signal}}])}(mm),ja=function(){function e(){jl(this,e),Object.defineProperty(this,"signal",{value:new Vl,writable:!0,configurable:!0})}return Ul(e,[{key:"abort",value:function(r){var n=dC(r),o=lC(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(ja.prototype[Symbol.toStringTag]="AbortController",Vl.prototype[Symbol.toStringTag]="AbortSignal");function fC(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 pC(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!fC({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||s)&&(u=function(R,h){var v;h&&h.signal&&(v=h.signal,delete h.signal);var w=new o(R,h);return v&&Object.defineProperty(w,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),w},u.prototype=o.prototype);var c=r,g=function(R,h){var v=u&&u.prototype.isPrototypeOf(R)?R.signal:h?h.signal:void 0;if(v){var w;try{w=new DOMException("Aborted","AbortError")}catch{w=new Error("Aborted"),w.name="AbortError"}if(v.aborted)return Promise.reject(w);var E=new Promise(function(C,_){v.addEventListener("abort",function(){return _(w)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([E,c(R,h)])}return c(R,h)};return{fetch:g,Request:u}}bi.AbortController=ja;bi.AbortSignal=Vl;bi.abortableFetch=pC});var hm,l,x,p=Jn(()=>{"use strict";hm=Ut(Bl(),1),l=Ut(Bl(),1),{fetch:x}=(0,hm.abortableFetch)({fetch})});function ym(e){return typeof e!="string"||e in{}}function Gl(){return Object.create(null)}function bm(e){return typeof e=="string"&&!!e.trim()}function $l(e,t){var r=e.split(";"),n=r.shift();if(!bm(n))return null;var o=mC(n),i=o.name,a=o.value;if(t=t?Object.assign({},Ua,t):Ua,ym(i))return t.silent||console.warn("set-cookie-parser: dropping cookie due to name:",i),null;try{a=t.decodeValues?decodeURIComponent(a):a}catch(u){t.silent||console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var s=Gl();return s.name=i,s.value=a,r.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(ym(g)||g==="name"||g==="value"){t.silent||console.warn("set-cookie-parser: ignoring attribute:",u);return}var y=c.join("=").trim();if(g==="expires"){var R=new Date(y);Number.isNaN(R.getTime())?t.silent||console.error("set-cookie-parser: failed to parse expires time:",y):s.expires=R}else g==="max-age"?/^-?\d+$/.test(y)?s.maxAge=parseInt(y,10):t.silent||console.error("set-cookie-parser: failed to parse max-age:",y):g==="secure"?s.secure=!0:g==="httponly"?s.httpOnly=!0:g==="samesite"?s.sameSite=y:g==="partitioned"?s.partitioned=!0:g&&(s[g]=y)}),s}function mC(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:vm(t),value:vm(r)}}function vm(e){for(var t=0,r=e.length;t<r&&Sm(e.charCodeAt(t));)t+=1;for(;r>t&&Sm(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function Sm(e){return e===32||e===9}function to(e,t){if(t=t?Object.assign({},Ua,t):Ua,!e)return t.map?Gl():[];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."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(bm),n&&(e=e.map(Va).flat()),t.map){var i=Gl();return e.reduce(function(a,s){var u=$l(s,t);return u&&(a[u.name]=u),a},i)}else return e.map(function(a){return $l(a,t)}).filter(Boolean)}function Va(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,i,a,s;function u(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function c(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,s=!1;u();)if(o=e.charAt(r),o===","){for(i=r,r+=1,u(),a=r;r<e.length&&c();)r+=1;r<e.length&&e.charAt(r)==="="?(s=!0,r=a,t.push(e.substring(n,i)),n=r):r=i+1}else r+=1;(!s||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Ua,Am=Jn(()=>{"use strict";m();d();p();f();Ua={decodeValues:!0,map:!1,silent:!1,split:"auto"};to.parseSetCookie=to;to.parse=to;to.parseString=$l;to.splitCookiesString=Va});function Ai(e){if(gC.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Ql(e){return e.replace(hC,"")}function wi(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||!yC(r))return!1}return!0}function yC(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Cm(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 gC,wm,hC,xm,ro,Hl,Em,I,Im=Jn(()=>{"use strict";m();d();p();f();Am();gC=/[^a-z0-9\-#$%&'*+.^_`|~]/i;wm=[`
|
|
19
|
+
`,"\r","\t"," "],hC=new RegExp(`(^[${wm.join("")}]|$[${wm.join("")}])`,"g");ro=Symbol("normalizedHeaders"),Hl=Symbol("rawHeaderNames"),Em=", ",I=class Rm{constructor(t){this[ro]={},this[Hl]=new Map,this[xm]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Rm||typeof A.Headers<"u"&&t instanceof A.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(Em):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Em):n)})}[(xm=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[ro]).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(!wi(t))throw new TypeError(`Invalid header name "${t}"`);return this[ro].hasOwnProperty(Ai(t))}get(t){if(!wi(t))throw TypeError(`Invalid header name "${t}"`);return this[ro][Ai(t)]??null}set(t,r){if(!wi(t)||!Cm(r))return;let n=Ai(t),o=Ql(r);this[ro][n]=Ql(o),this[Hl].set(n,t)}append(t,r){if(!wi(t)||!Cm(r))return;let n=Ai(t),o=Ql(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!wi(t)||!this.has(t))return;let r=Ai(t);delete this[ro][r],this[Hl].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===""?[""]:Va(t)}}});var m=Jn(()=>{"use strict";Im()});var Fm=Je(Ei=>{"use strict";m();d();p();f();var Qa=Ei&&Ei.__assign||function(){return Qa=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},Qa.apply(this,arguments)};Object.defineProperty(Ei,"__esModule",{value:!0});var RC={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function IC(e){var t=Qa(Qa({},RC),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Ei.getSanitizedOptions=IC});var Dm=Je(Xl=>{"use strict";m();d();p();f();Object.defineProperty(Xl,"__esModule",{value:!0});function TC(e){var t=Math.random()*e;return Math.round(t)}Xl.fullJitter=TC});var Mm=Je(Zl=>{"use strict";m();d();p();f();Object.defineProperty(Zl,"__esModule",{value:!0});function _C(e){return e}Zl.noJitter=_C});var qm=Je(Jl=>{"use strict";m();d();p();f();Object.defineProperty(Jl,"__esModule",{value:!0});var kC=Dm(),OC=Mm();function PC(e){return e.jitter==="full"?kC.fullJitter:OC.noJitter}Jl.JitterFactory=PC});var td=Je(ed=>{"use strict";m();d();p();f();Object.defineProperty(ed,"__esModule",{value:!0});var NC=qm(),FC=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=NC.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}();ed.Delay=FC});var Lm=Je(cr=>{"use strict";m();d();p();f();var DC=cr&&cr.__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)}}(),MC=cr&&cr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(y){a(y)}}function u(g){try{c(n.throw(g))}catch(y){a(y)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},qC=cr&&cr.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(cr,"__esModule",{value:!0});var LC=td(),jC=function(e){DC(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return MC(this,void 0,void 0,function(){return qC(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}(LC.Delay);cr.SkipFirstDelay=jC});var jm=Je(Ri=>{"use strict";m();d();p();f();var UC=Ri&&Ri.__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(Ri,"__esModule",{value:!0});var VC=td(),BC=function(e){UC(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(VC.Delay);Ri.AlwaysDelay=BC});var Um=Je(rd=>{"use strict";m();d();p();f();Object.defineProperty(rd,"__esModule",{value:!0});var GC=Lm(),$C=jm();function QC(e,t){var r=HC(e);return r.setAttemptNumber(t),r}rd.DelayFactory=QC;function HC(e){return e.delayFirstAttempt?new $C.AlwaysDelay(e):new GC.SkipFirstDelay(e)}});var Vm=Je(an=>{"use strict";m();d();p();f();var nd=an&&an.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(y){a(y)}}function u(g){try{c(n.throw(g))}catch(y){a(y)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})},od=an&&an.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(an,"__esModule",{value:!0});var zC=Fm(),WC=Um();function KC(e,t){return t===void 0&&(t={}),nd(this,void 0,void 0,function(){var r,n;return od(this,function(o){switch(o.label){case 0:return r=zC.getSanitizedOptions(t),n=new YC(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}an.backOff=KC;var YC=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return nd(this,void 0,void 0,function(){var t,r;return od(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 nd(this,void 0,void 0,function(){var t;return od(this,function(r){switch(r.label){case 0:return t=WC.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var yc=Je((_f,kf)=>{"use strict";m();d();p();f();(function(e,t){typeof _f=="object"&&typeof kf<"u"?kf.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs=t()})(_f,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",c="month",g="quarter",y="year",R="date",h="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(U){var L=["th","st","nd","rd"],B=U%100;return"["+U+(L[(B-20)%10]||L[B]||L[0])+"]"}},C=function(U,L,B){var j=String(U);return!j||j.length>=L?U:""+Array(L+1-j.length).join(B)+U},_={s:C,z:function(U){var L=-U.utcOffset(),B=Math.abs(L),j=Math.floor(B/60),V=B%60;return(L<=0?"+":"-")+C(j,2,"0")+":"+C(V,2,"0")},m:function U(L,B){if(L.date()<B.date())return-U(B,L);var j=12*(B.year()-L.year())+(B.month()-L.month()),V=L.clone().add(j,c),z=B-V<0,W=L.clone().add(j+(z?-1:1),c);return+(-(j+(B-V)/(z?V-W:W-V))||0)},a:function(U){return U<0?Math.ceil(U)||0:Math.floor(U)},p:function(U){return{M:c,y,w:u,d:s,D:R,h:a,m:i,s:o,ms:n,Q:g}[U]||String(U||"").toLowerCase().replace(/s$/,"")},u:function(U){return U===void 0}},O="en",F={};F[O]=E;var b="$isDayjsObject",T=function(U){return U instanceof M||!(!U||!U[b])},k=function U(L,B,j){var V;if(!L)return O;if(typeof L=="string"){var z=L.toLowerCase();F[z]&&(V=z),B&&(F[z]=B,V=z);var W=L.split("-");if(!V&&W.length>1)return U(W[0])}else{var J=L.name;F[J]=L,V=J}return!j&&V&&(O=V),V||!j&&O},P=function(U,L){if(T(U))return U.clone();var B=typeof L=="object"?L:{};return B.date=U,B.args=arguments,new M(B)},N=_;N.l=k,N.i=T,N.w=function(U,L){return P(U,{locale:L.$L,utc:L.$u,x:L.$x,$offset:L.$offset})};var M=function(){function U(B){this.$L=k(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[b]=!0}var L=U.prototype;return L.parse=function(B){this.$d=function(j){var V=j.date,z=j.utc;if(V===null)return new Date(NaN);if(N.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var W=V.match(v);if(W){var J=W[2]-1||0,ie=(W[7]||"0").substring(0,3);return z?new Date(Date.UTC(W[1],J,W[3]||1,W[4]||0,W[5]||0,W[6]||0,ie)):new Date(W[1],J,W[3]||1,W[4]||0,W[5]||0,W[6]||0,ie)}}return new Date(V)}(B),this.init()},L.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},L.$utils=function(){return N},L.isValid=function(){return this.$d.toString()!==h},L.isSame=function(B,j){var V=P(B);return this.startOf(j)<=V&&V<=this.endOf(j)},L.isAfter=function(B,j){return P(B)<this.startOf(j)},L.isBefore=function(B,j){return this.endOf(j)<P(B)},L.$g=function(B,j,V){return N.u(B)?this[j]:this.set(V,B)},L.unix=function(){return Math.floor(this.valueOf()/1e3)},L.valueOf=function(){return this.$d.getTime()},L.startOf=function(B,j){var V=this,z=!!N.u(j)||j,W=N.p(B),J=function(je,Ae){var Se=N.w(V.$u?Date.UTC(V.$y,Ae,je):new Date(V.$y,Ae,je),V);return z?Se:Se.endOf(s)},ie=function(je,Ae){return N.w(V.toDate()[je].apply(V.toDate("s"),(z?[0,0,0,0]:[23,59,59,999]).slice(Ae)),V)},ae=this.$W,le=this.$M,ke=this.$D,Me="set"+(this.$u?"UTC":"");switch(W){case y:return z?J(1,0):J(31,11);case c:return z?J(1,le):J(0,le+1);case u:var _e=this.$locale().weekStart||0,Ke=(ae<_e?ae+7:ae)-_e;return J(z?ke-Ke:ke+(6-Ke),le);case s:case R:return ie(Me+"Hours",0);case a:return ie(Me+"Minutes",1);case i:return ie(Me+"Seconds",2);case o:return ie(Me+"Milliseconds",3);default:return this.clone()}},L.endOf=function(B){return this.startOf(B,!1)},L.$set=function(B,j){var V,z=N.p(B),W="set"+(this.$u?"UTC":""),J=(V={},V[s]=W+"Date",V[R]=W+"Date",V[c]=W+"Month",V[y]=W+"FullYear",V[a]=W+"Hours",V[i]=W+"Minutes",V[o]=W+"Seconds",V[n]=W+"Milliseconds",V)[z],ie=z===s?this.$D+(j-this.$W):j;if(z===c||z===y){var ae=this.clone().set(R,1);ae.$d[J](ie),ae.init(),this.$d=ae.set(R,Math.min(this.$D,ae.daysInMonth())).$d}else J&&this.$d[J](ie);return this.init(),this},L.set=function(B,j){return this.clone().$set(B,j)},L.get=function(B){return this[N.p(B)]()},L.add=function(B,j){var V,z=this;B=Number(B);var W=N.p(j),J=function(le){var ke=P(z);return N.w(ke.date(ke.date()+Math.round(le*B)),z)};if(W===c)return this.set(c,this.$M+B);if(W===y)return this.set(y,this.$y+B);if(W===s)return J(1);if(W===u)return J(7);var ie=(V={},V[i]=t,V[a]=r,V[o]=e,V)[W]||1,ae=this.$d.getTime()+B*ie;return N.w(ae,this)},L.subtract=function(B,j){return this.add(-1*B,j)},L.format=function(B){var j=this,V=this.$locale();if(!this.isValid())return V.invalidDate||h;var z=B||"YYYY-MM-DDTHH:mm:ssZ",W=N.z(this),J=this.$H,ie=this.$m,ae=this.$M,le=V.weekdays,ke=V.months,Me=V.meridiem,_e=function(Ae,Se,Re,We){return Ae&&(Ae[Se]||Ae(j,z))||Re[Se].slice(0,We)},Ke=function(Ae){return N.s(J%12||12,Ae,"0")},je=Me||function(Ae,Se,Re){var We=Ae<12?"AM":"PM";return Re?We.toLowerCase():We};return z.replace(w,function(Ae,Se){return Se||function(Re){switch(Re){case"YY":return String(j.$y).slice(-2);case"YYYY":return N.s(j.$y,4,"0");case"M":return ae+1;case"MM":return N.s(ae+1,2,"0");case"MMM":return _e(V.monthsShort,ae,ke,3);case"MMMM":return _e(ke,ae);case"D":return j.$D;case"DD":return N.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return _e(V.weekdaysMin,j.$W,le,2);case"ddd":return _e(V.weekdaysShort,j.$W,le,3);case"dddd":return le[j.$W];case"H":return String(J);case"HH":return N.s(J,2,"0");case"h":return Ke(1);case"hh":return Ke(2);case"a":return je(J,ie,!0);case"A":return je(J,ie,!1);case"m":return String(ie);case"mm":return N.s(ie,2,"0");case"s":return String(j.$s);case"ss":return N.s(j.$s,2,"0");case"SSS":return N.s(j.$ms,3,"0");case"Z":return W}return null}(Ae)||W.replace(":","")})},L.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},L.diff=function(B,j,V){var z,W=this,J=N.p(j),ie=P(B),ae=(ie.utcOffset()-this.utcOffset())*t,le=this-ie,ke=function(){return N.m(W,ie)};switch(J){case y:z=ke()/12;break;case c:z=ke();break;case g:z=ke()/3;break;case u:z=(le-ae)/6048e5;break;case s:z=(le-ae)/864e5;break;case a:z=le/r;break;case i:z=le/t;break;case o:z=le/e;break;default:z=le}return V?z:N.a(z)},L.daysInMonth=function(){return this.endOf(c).$D},L.$locale=function(){return F[this.$L]},L.locale=function(B,j){if(!B)return this.$L;var V=this.clone(),z=k(B,j,!0);return z&&(V.$L=z),V},L.clone=function(){return N.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()},U}(),Q=M.prototype;return P.prototype=Q,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",y],["$D",R]].forEach(function(U){Q[U[1]]=function(L){return this.$g(L,U[0],U[1])}}),P.extend=function(U,L){return U.$i||(U(L,M,P),U.$i=!0),P},P.locale=k,P.isDayjs=T,P.unix=function(U){return P(1e3*U)},P.en=F[O],P.Ls=F,P.p={},P})});var $y=Je((Of,Pf)=>{"use strict";m();d();p();f();(function(e,t){typeof Of=="object"&&typeof Pf<"u"?Pf.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_quarterOfYear=t()})(Of,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===t?this.add(3*s,e):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(s)===t){var y=this.quarter()-1;return g?this.month(3*y).startOf(e).startOf("day"):this.month(3*y+2).endOf(e).endOf("day")}return a.bind(this)(s,u)}}})});var Qy=Je((Nf,Ff)=>{"use strict";m();d();p();f();(function(e,t){typeof Nf=="object"&&typeof Ff<"u"?Ff.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_customParseFormat=t()})(Nf,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(w){this[v]=+w}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=function(w){if(!w||w==="Z")return 0;var E=w.match(/([+-]|\d\d)/g),C=60*E[1]+(+E[2]||0);return C===0?0:E[0]==="+"?-C:C}(v)}],g=function(v){var w=a[v];return w&&(w.indexOf?w:w.s.concat(w.f))},y=function(v,w){var E,C=a.meridiem;if(C){for(var _=1;_<=24;_+=1)if(v.indexOf(C(_,0,w))>-1){E=_>12;break}}else E=v===(w?"pm":"PM");return E},R={A:[i,function(v){this.afternoon=y(v,!1)}],a:[i,function(v){this.afternoon=y(v,!0)}],Q:[r,function(v){this.month=3*(v-1)+1}],S:[r,function(v){this.milliseconds=100*+v}],SS:[n,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[n,u("day")],Do:[i,function(v){var w=a.ordinal,E=v.match(/\d+/);if(this.day=E[0],w)for(var C=1;C<=31;C+=1)w(C).replace(/\[|\]/g,"")===v&&(this.day=C)}],w:[o,u("week")],ww:[n,u("week")],M:[o,u("month")],MM:[n,u("month")],MMM:[i,function(v){var w=g("months"),E=(g("monthsShort")||w.map(function(C){return C.slice(0,3)})).indexOf(v)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[i,function(v){var w=g("months").indexOf(v)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(v){this.year=s(v)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(v){var w,E;w=v,E=a&&a.formats;for(var C=(v=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(P,N,M){var Q=M&&M.toUpperCase();return N||E[M]||e[M]||E[Q].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(U,L,B){return L||B.slice(1)})})).match(t),_=C.length,O=0;O<_;O+=1){var F=C[O],b=R[F],T=b&&b[0],k=b&&b[1];C[O]=k?{regex:T,parser:k}:F.replace(/^\[|\]$/g,"")}return function(P){for(var N={},M=0,Q=0;M<_;M+=1){var U=C[M];if(typeof U=="string")Q+=U.length;else{var L=U.regex,B=U.parser,j=P.slice(Q),V=L.exec(j)[0];B.call(N,V),P=P.replace(V,"")}}return function(z){var W=z.afternoon;if(W!==void 0){var J=z.hours;W?J<12&&(z.hours+=12):J===12&&(z.hours=0),delete z.afternoon}}(N),N}}return function(v,w,E){E.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(s=v.parseTwoDigitYear);var C=w.prototype,_=C.parse;C.parse=function(O){var F=O.date,b=O.utc,T=O.args;this.$u=b;var k=T[1];if(typeof k=="string"){var P=T[2]===!0,N=T[3]===!0,M=P||N,Q=T[2];N&&(Q=T[2]),a=this.$locale(),!P&&Q&&(a=E.Ls[Q]),this.$d=function(j,V,z,W){try{if(["x","X"].indexOf(V)>-1)return new Date((V==="X"?1e3:1)*j);var J=h(V)(j),ie=J.year,ae=J.month,le=J.day,ke=J.hours,Me=J.minutes,_e=J.seconds,Ke=J.milliseconds,je=J.zone,Ae=J.week,Se=new Date,Re=le||(ie||ae?1:Se.getDate()),We=ie||Se.getFullYear(),$e=0;ie&&!ae||($e=ae>0?ae-1:Se.getMonth());var St,Ht=ke||0,qe=Me||0,De=_e||0,Ot=Ke||0;return je?new Date(Date.UTC(We,$e,Re,Ht,qe,De,Ot+60*je.offset*1e3)):z?new Date(Date.UTC(We,$e,Re,Ht,qe,De,Ot)):(St=new Date(We,$e,Re,Ht,qe,De,Ot),Ae&&(St=W(St).week(Ae).toDate()),St)}catch{return new Date("")}}(F,k,b,E),this.init(),Q&&Q!==!0&&(this.$L=this.locale(Q).$L),M&&F!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var U=k.length,L=1;L<=U;L+=1){T[1]=k[L-1];var B=E.apply(this,T);if(B.isValid()){this.$d=B.$d,this.$L=B.$L,this.init();break}L===U&&(this.$d=new Date(""))}else _.call(this,O)}}})});var Vv=Je((Kf,Yf)=>{"use strict";m();d();p();f();(function(e,t){typeof Kf=="object"&&typeof Yf<"u"?Yf.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_timezone=t()})(Kf,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,y,R){R===void 0&&(R={});var h=new Date(g),v=function(w,E){E===void 0&&(E={});var C=E.timeZoneName||"short",_=w+"|"+C,O=t[_];return O||(O=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:w,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),t[_]=O),O}(y,R);return v.formatToParts(h)},s=function(g,y){for(var R=a(g,y),h=[],v=0;v<R.length;v+=1){var w=R[v],E=w.type,C=w.value,_=e[E];_>=0&&(h[_]=parseInt(C,10))}var O=h[3],F=O===24?0:O,b=h[0]+"-"+h[1]+"-"+h[2]+" "+F+":"+h[4]+":"+h[5]+":000",T=+g;return(o.utc(b).valueOf()-(T-=T%1e3))/6e4},u=n.prototype;u.tz=function(g,y){if(g===void 0&&(g=i),!this.isValid())return this;var R,h=this.utcOffset(),v=this.toDate(),w=v.toLocaleString("en-US",{timeZone:g}),E=s(+v,g);if(!Number(E))R=this.utcOffset(0,y);else if(R=o(w,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(E,!0),y){var C=R.utcOffset();R=R.add(h-C,"minute")}return R.$x.$timezone=g,R},u.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),R=a(this.valueOf(),y,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return R&&R.value};var c=u.startOf;u.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return c.call(this,g,y);var R=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(R,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,R){var h=R&&y,v=R||y||i,w=s(+o(),v);if(typeof g!="string")return o(g).tz(v);var E=o.utc(g,h).valueOf();if(Number.isNaN(E)){var C=o(NaN);return C.$x.$timezone=v,C}var _=function(T,k,P){var N=T-60*k*1e3,M=s(N,P);if(k===M)return[N,k];var Q=s(N-=60*(M-k)*1e3,P);return M===Q?[N,M]:[T-60*Math.min(M,Q)*1e3,Math.max(M,Q)]}(E,w,v),O=_[0],F=_[1],b=o(O).utcOffset(F);return b.$x.$timezone=v,b},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var Bv=Je((Xf,Zf)=>{"use strict";m();d();p();f();(function(e,t){typeof Xf=="object"&&typeof Zf<"u"?Zf.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof A<"u"?A:e||self).dayjs_plugin_utc=t()})(Xf,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 v={date:h,utc:!0,args:arguments};return new o(v)},a.utc=function(h){var v=i(this.toDate(),{locale:this.$L,utc:!0});return h?v.add(this.utcOffset(),e):v},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),s.call(this,h)};var u=a.init;a.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else u.call(this)};var c=a.utcOffset;a.utcOffset=function(h,v){var w=this.$utils().u;if(w(h))return this.$u?0:w(this.$offset)?c.call(this):this.$offset;if(typeof h=="string"&&(h=function(O){O===void 0&&(O="");var F=O.match(t);if(!F)return null;var b=(""+F[0]).match(r)||["-",0,0],T=b[0],k=60*+b[1]+ +b[2];return k===0?0:T==="+"?k:-k}(h),h===null))return this;var E=Math.abs(h)<=16?60*h:h;if(E===0)return this.utc(v);var C=this.clone();if(v)return C.$offset=E,C.$u=!1,C;var _=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(C=this.local().add(E+_,e)).$offset=E,C.$x.$localOffset=_,C};var g=a.format;a.format=function(h){var v=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,v)},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 y=a.toDate;a.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var R=a.diff;a.diff=function(h,v,w){if(h&&this.$u===h.$u)return R.call(this,h,v,w);var E=this.local(),C=i(h).local();return R.call(E,C,v,w)}}})});var qA=Je((nde,MA)=>{"use strict";m();d();p();f();function CN(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}MA.exports=xN;function xN(e,t,r){var n=r&&r.stringify||CN,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,y=-1,R=e&&e.length||0,h=0;h<R;){if(e.charCodeAt(h)===37&&h+1<R){switch(y=y>-1?y:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=u||t[g]==null)break;y<h&&(c+=e.slice(y,h)),c+=Number(t[g]),y=h+2,h++;break;case 105:if(g>=u||t[g]==null)break;y<h&&(c+=e.slice(y,h)),c+=Math.floor(Number(t[g])),y=h+2,h++;break;case 79:case 111:case 106:if(g>=u||t[g]===void 0)break;y<h&&(c+=e.slice(y,h));var v=typeof t[g];if(v==="string"){c+="'"+t[g]+"'",y=h+2,h++;break}if(v==="function"){c+=t[g].name||"<anonymous>",y=h+2,h++;break}c+=n(t[g]),y=h+2,h++;break;case 115:if(g>=u)break;y<h&&(c+=e.slice(y,h)),c+=String(t[g]),y=h+2,h++;break;case 37:y<h&&(c+=e.slice(y,h)),c+="%",y=h+2,h++,g--;break}++g}++h}return y===-1?e:(y<R&&(c+=e.slice(y)),c)}});var GA=Je((cde,BA)=>{"use strict";m();d();p();f();function Kp(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=Kp(e[r]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Kp(e[r]));return t}return e}function LA(e){let t=[],r="",n=!1,o=!1,i="";for(let a=0;a<e.length;a++){let s=e[a];!n&&s==="."?r&&(t.push(r),r=""):s==="["?(r&&(t.push(r),r=""),n=!0):s==="]"&&n?(t.push(r),r="",n=!1,o=!1):(s==="\""||s==="'")&&n?o?s===i?(o=!1,i=""):r+=s:(o=!0,i=s):r+=s}return r&&t.push(r),t}function jA(e,t,r){let n=e;for(let i=0;i<t.length-1;i++){let a=t[i];if(typeof n!="object"||n===null||!(a in n)||typeof n[a]!="object"||n[a]===null)return!1;n=n[a]}let o=t[t.length-1];if(o==="*"){if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i]=r;else if(typeof n=="object"&&n!==null)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=r)}else typeof n=="object"&&n!==null&&o in n&&Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=r);return!0}function UA(e,t){let r=e;for(let o=0;o<t.length-1;o++){let i=t[o];if(typeof r!="object"||r===null||!(i in r)||typeof r[i]!="object"||r[i]===null)return!1;r=r[i]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let o=0;o<r.length;o++)r[o]=void 0;else if(typeof r=="object"&&r!==null)for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var wl=Symbol("PATH_NOT_FOUND");function EN(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return wl;r=r[n]}return r}function RN(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function IN(e,t,r,n=!1){for(let o of t){let i=LA(o);if(i.includes("*"))VA(e,i,r,o,n);else if(n)UA(e,i);else{let a=EN(e,i);if(a===wl)continue;let s=typeof r=="function"?r(a,i):r;jA(e,i,s)}}}function VA(e,t,r,n,o=!1){let i=t.indexOf("*");if(i===t.length-1){let a=t.slice(0,-1),s=e;for(let u of a){if(s==null||typeof s!="object"||s===null)return;s=s[u]}if(Array.isArray(s)){if(o)for(let u=0;u<s.length;u++)s[u]=void 0;else for(let u=0;u<s.length;u++){let c=[...a,u.toString()],g=typeof r=="function"?r(s[u],c):r;s[u]=g}}else if(typeof s=="object"&&s!==null)if(o){let u=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&u.push(c);for(let c of u)delete s[c]}else for(let u in s){let c=[...a,u],g=typeof r=="function"?r(s[u],c):r;s[u]=g}}else TN(e,t,r,i,n,o)}function TN(e,t,r,n,o,i=!1){let a=t.slice(0,n),s=t.slice(n+1),u=[];function c(g,y){if(y===a.length){if(Array.isArray(g))for(let R=0;R<g.length;R++)u[y]=R.toString(),c(g[R],y+1);else if(typeof g=="object"&&g!==null)for(let R in g)u[y]=R,c(g[R],y+1)}else if(y<a.length){let R=a[y];g&&typeof g=="object"&&g!==null&&R in g&&(u[y]=R,c(g[R],y+1))}else if(s.includes("*"))VA(g,s,typeof r=="function"?(h,v)=>{let w=[...u.slice(0,y),...v];return r(h,w)}:r,o,i);else if(i)UA(g,s);else{let R=typeof r=="function"?r(RN(g,s),[...u.slice(0,y),...s]):r;jA(g,s,R)}}if(a.length===0)c(e,0);else{let g=e;for(let y=0;y<a.length;y++){let R=a[y];if(g==null||typeof g!="object"||g===null)return;g=g[R],u[y]=R}g!=null&&c(g,a.length)}}function _N(e){if(e.length===0)return null;let t=new Map;for(let r of e){let n=LA(r),o=t;for(let i=0;i<n.length;i++){let a=n[i];o.has(a)||o.set(a,new Map),o=o.get(a)}}return t}function kN(e,t){if(!t)return e;function r(n,o,i=0){if(!o||o.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let s=[];for(let u=0;u<n.length;u++){let c=u.toString();o.has(c)||o.has("*")?s[u]=r(n[u],o.get(c)||o.get("*")):s[u]=n[u]}return s}let a=Object.create(Object.getPrototypeOf(n));for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(o.has(s)||o.has("*")?a[s]=r(n[s],o.get(s)||o.get("*")):a[s]=n[s]);return a}return r(e,t)}function ON(e){if(typeof e!="string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction path (${e})`);let t=0,r=!1,n="";for(let o=0;o<e.length;o++){let i=e[o];if((i==="\""||i==="'")&&t>0)r?i===n&&(r=!1,n=""):(r=!0,n=i);else if(i==="["&&!r)t++;else if(i==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function PN(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)ON(t)}function NN(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:o=!0,remove:i=!1}=e;PN(t);let a=_N(t);return function(u){if(o&&(u===null||typeof u!="object")&&(u==null||typeof u!="object"))return n?n(u):u;let c=kN(u,a),g=u,y=r;return typeof r=="function"&&(y=r),IN(c,t,y,i),n===!1?(c.restore=function(){return Kp(g)},c):typeof n=="function"?n(c):JSON.stringify(c)}}BA.exports=NN});var XA=Je((pde,xl)=>{"use strict";m();d();p();f();var $A=qA(),FN=GA();xl.exports=Cr;var QA="[Redacted]";function DN(e){if(Array.isArray(e))return{paths:e,censor:QA};let{paths:t,censor:r=QA,remove:n}=e;if(!Array.isArray(t))throw Error("pino – redact must contain an array of strings");return{paths:t,censor:n?void 0:r,remove:n}}function MN(e){if(!e)return null;let{paths:t,censor:r,remove:n}=DN(e);return FN({paths:t,censor:r,remove:n,serialize:!1})}var Na=XN().console||{},qN={mapHttpRequest:Cl,mapHttpResponse:Cl,wrapRequestSerializer:Yp,wrapResponseSerializer:Yp,wrapErrorSerializer:Yp,req:Cl,res:Cl,err:zA,errWithCause:zA};function en(e,t){return e==="silent"?1/0:t.levels.values[e]}var Jp=Symbol("pino.logFuncs"),Xp=Symbol("pino.hierarchy"),Kn=Symbol("pino.ownBindings"),li=Symbol("pino.bindings"),LN={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function HA(e,t){let r={logger:t,parent:e[Xp]};t[Xp]=r}function jN(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Na[o]||Na[LN[o]||"log"]||di}),e[Jp]=n}function UN(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Cr(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||Na;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=UN(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(E){r[E]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(r);c.log||(c.log=di),jN(c,s,r),HA({},c),c[li]={},Object.defineProperty(c,"levelVal",{get:R}),Object.defineProperty(c,"level",{get:h,set:v});let g=MN(e.redact),y={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:s,timestamp:WN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||di,redactFn:g};c.levels=VN(e),c.level=u,c.isLevelEnabled=function(E){return this.levels.values[E]?this.levels.values[E]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=di,c.serializers=n,c._serialize=o,c._stdErrSerialize=i,c.child=function(...E){return w.call(this,y,...E)},c.bindings=function(){return Object.assign({},this[li])},c.setBindings=function(E){this[Kn]=Object.assign({},this[Kn],E),this[li]=Object.assign({},this[li],E),this._logEvent&&this._logEvent.bindings.push(E),this.level=this._level},t&&(c._logEvent=Zp());function R(){return en(this.level,this)}function h(){return this._level}function v(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,Wn(this,y,c,"error"),Wn(this,y,c,"fatal"),Wn(this,y,c,"warn"),Wn(this,y,c,"info"),Wn(this,y,c,"debug"),Wn(this,y,c,"trace"),a.forEach(C=>{Wn(this,y,c,C)})}function w(E,C,_){if(!C)throw new Error("missing bindings for child Pino");_=_||{},o&&C.serializers&&(_.serializers=C.serializers);let O=_.serializers;if(o&&O){var F=Object.assign({},n,O),b=e.browser.serialize===!0?Object.keys(F):o;delete C.serializers,em([C],b,F,this._stdErrSerialize)}function T(P){this._childLevel=(P._childLevel|0)+1,this[Kn]=C,this[li]=Object.assign({},P[li],C),F&&(this.serializers=F,this._serialize=b),t&&(this._logEvent=Zp([].concat(P._logEvent.bindings,C)))}T.prototype=this;let k=new T(this);return HA(this,k),k.child=function(...P){return w.call(this,E,...P)},k.level=_.level||this.level,E.onChild(k),k}return c}function VN(e){let t=e.customLevels||{},r=Object.assign({},Cr.levels.values,t),n=Object.assign({},Cr.levels.labels,BN(t));return{values:r,labels:n}}function BN(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Cr.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"}};Cr.stdSerializers=qN;Cr.stdTimeFunctions=Object.assign({},{nullTime:KA,epochTime:YA,unixTime:KN,isoTime:YN});function GN(e){let t=[];e[Kn]&&t.push(e[Kn]);let r=e[Xp];for(;r.parent;)r=r.parent,r.logger[Kn]&&t.push(r.logger[Kn]);return t.reverse()}function Wn(e,t,r,n){if(Object.defineProperty(e,n,{value:en(e.level,r)>en(n,r)?di:r[Jp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===di){if(!t.transmit)return;let i=t.transmit.level||e.level,a=en(i,r);if(en(n,r)<a)return}e[n]=QN(e,t,r,n);let o=GN(e);o.length!==0&&(e[n]=$N(o,e[n]))}function $N(e,t){return function(){return t.apply(this,[...e,...arguments])}}function QN(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Na?Na:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var g=!1;if(t.serialize&&(em(s,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=HN(this,n,s,a,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let R=WA();R&&(y[0].caller=R)}catch{}o.call(u,...y)}else{if(t.reportCaller)try{let y=WA();y&&s.push(y)}catch{}o.apply(u,s)}if(t.transmit){let y=t.transmit.level||e._level,R=en(y,r),h=en(n,r);if(h<R)return;zN(this,{ts:a,methodLevel:n,methodValue:h,transmitLevel:y,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:en(e._level,r)},s,g)}}}(e[Jp][n])}function HN(e,t,r,n,o){let{level:i,log:a=y=>y}=o.formatters||{},s=r.slice(),u=s[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(c.time=n),i){let y=i(t,e.levels.values[t]);Object.assign(c,y)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(u!==null&&typeof u=="object")for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());let y=a(c);return o.redactFn&&(y=o.redactFn(y)),[y,...s]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof s[0]=="object";)Object.assign(c,s.shift());u=s.length?$A(s.shift(),s):void 0}else typeof u=="string"&&(u=$A(s.shift(),s));u!==void 0&&(c[o.messageKey]=u);let y=a(c);return o.redactFn&&(y=o.redactFn(y)),[y]}}function em(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Cr.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 zN(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,u=t.val,c=e._logEvent.bindings;n||em(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,u),e._logEvent=Zp(c)}function Zp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function zA(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 WN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?KA:YA}function Cl(){return{}}function Yp(e){return e}function di(){}function KA(){return!1}function YA(){return Date.now()}function KN(){return Math.round(Date.now()/1e3)}function YN(){return new Date(Date.now()).toISOString()}function XN(){function e(t){return typeof t<"u"&&t}try{return typeof A<"u"?A:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),A)}catch{return e(self)||e(window)||e(this)||{}}}xl.exports.default=Cr;xl.exports.pino=Cr;function WA(){let e=(new Error).stack;if(!e)return null;let t=e.split(`
|
|
20
|
+
`);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],a=o[2],s=o[3];return i+":"+a+":"+s}}return null}});var XF={};Si(XF,{DefaultFieldsToInclude:()=>am,EcommerceDefaultFieldsToInclude:()=>jw,HighlightUtils:()=>Yl,MinimumFieldsToInclude:()=>Dl,ResultTemplatesHelpers:()=>lv,buildContext:()=>sw,buildController:()=>tn,buildDictionaryFieldContext:()=>cw,buildInteractiveResult:()=>Dw,buildRecommendationEngine:()=>ow,buildRecommendationList:()=>Nw,buildResultTemplatesManager:()=>Bw,getAnalyticsNextApiBaseUrl:()=>Ha,getOrganizationEndpoint:()=>Pt,getSampleRecommendationEngineConfiguration:()=>tm,loadAdvancedSearchQueryActions:()=>MF,loadClickAnalyticsActions:()=>zF,loadConfigurationActions:()=>qF,loadContextActions:()=>jF,loadDebugActions:()=>UF,loadDictionaryFieldContextActions:()=>VF,loadFieldActions:()=>$F,loadPaginationActions:()=>im,loadPipelineActions:()=>QF,loadRecommendationActions:()=>HF,loadSearchConfigurationActions:()=>LF,loadSearchHubActions:()=>YF});module.exports=Yw(XF);m();d();p();f();var Yl={};Si(Yl,{escapeHtml:()=>no,getHighlightedSuggestion:()=>EC,highlightString:()=>xC});m();d();p();f();m();d();p();f();function vC(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 fi(r)}var fi=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},yt=class{constructor(e){ue(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw zw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},qe=class{constructor(e={}){ue(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ce(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Je(e){return e===void 0}function Ww(e){return e===null}function ce(e){return Je(e)||Ww(e)}var fe=class{constructor(e={}){ue(this,"value");this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Kw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Kw(e){return Je(e)||fm(e)}function fm(e){return typeof e=="boolean"}var ne=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t||(Yw(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 Yw(e){return Je(e)||mm(e)}function mm(e){return typeof e=="number"&&!Number.isNaN(e)}var Xw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,H=class{constructor(e={}){ue(this,"value");ue(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new qe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Je(e))return null;if(!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(", ")}.`:i&&!(Xw.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 re=class{constructor(e={}){ue(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Je(e))return this.config.options.required?"value is required and is currently undefined":null;if(!gm(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ce(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function gm(e){return e!==void 0&&typeof e=="object"}var Ae=class{constructor(e={}){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(this.config)}validate(e){if(!ce(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ce(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ce(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return fm(e)||ka(e)||mm(e)||gm(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function hm(e){return Array.isArray(e)}var Fl=class{constructor(e){ue(this,"config");ue(this,"value");this.config=e,this.value=new qe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Je(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function ym(e){return Array.isArray(e)}function Oa(e){return e.trim()===""}var Zw=new Set(["1",1,"yes",!0]);function Dl(){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=>Zw.has(r))}function vm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function mi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Pa(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 Jw(e){if(Oa(e.openingDelimiter)||Oa(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ce(e.content)||Oa(e.content))return e.content;if(e.highlights.length===0)return Xn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Xn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Xn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Xn(e.content.slice(n))),r}function ex(e,t){return e=Xn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Ml(n,t.notMatchDelimiters):o?Ml(o,t.exactMatchDelimiters):i?Ml(i,t.correctionDelimiters):r)}function Ml(e,t){return t?t.open+e+t.close:e}function Xn(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var km=jt(Rm(),1);m();d();f();p();var Qt=new Error("Failed to load reducers."),Zn=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."}},tn=class extends Error{constructor(r,n){super();ue(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function Im(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Tm(e){return typeof e!="object"||!e?!1:Object.values(e).every(Rx)}function Rx(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function _m(e){return e===429}var Ut=class e{static call(t){return _asyncToGenerator(function*(){let r=Ix(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _s2=_asyncToGenerator(function*(){let u=yield C(i,a);if(_m(u.status))throw u;return u});function s(){return _s2.apply(this,arguments)}return s}();try{let u=yield(0,km.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _retry=_asyncToGenerator(function*(c){let g=c&&_m(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),g});function retry(_x2){return _retry.apply(this,arguments)}return retry}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new Zn;case 404:throw new tn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new tn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=mi(u);try{let g=yield o(t,n,a);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function kt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Jn(e,t,r="prod"){return e??kt(t,r)}function wr(e,t="prod"){return`${kt(e,t)}/rest/search/v2`}function Fa(e,t="prod"){return`${kt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Ix(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=Tx(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function Tx(e,t){return t==="application/x-www-form-urlencoded"?Tm(e)?Im(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var Da=e=>e;m();d();f();p();m();d();f();p();function Ma(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Ht(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ma(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ma(),extendedResults:{},searchAction:void 0}}m();d();f();p();function xr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Cr=e=>{let{response:t}=e;return t.body?_x(e):kx(t)},_x=e=>Px(e)?Nx(e):Ox(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},kx=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Ox(e){return e.body.statusCode!==void 0}function Px(e){return e.body.exception!==void 0}var Nx=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var Er=class{constructor(){ue(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var yi=class{constructor(t){ue(this,"_basePath");ue(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function Om(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var sr=(e,t,r,n)=>{let o=new yi(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Pm=/*#__PURE__*/function(){var _Pm=_asyncToGenerator(function*(e,t){let r=yield Ut.call({...sr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:xr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Om(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return Fx(a)?{success:a}:{error:Cr({response:r,body:a})}});function Pm(_x3,_x4){return _Pm.apply(this,arguments)}return Pm}();function Fx(e){return typeof e=="string"}m();d();f();p();function Dx(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Mx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function La(e,t){if(t&&e.name==="AbortError")return{error:Mx(e)};if(e instanceof tn)return{error:Dx(e)};throw e}var qa=class{constructor(t){ue(this,"options",t);ue(this,"apiCallsQueues",{unknown:new Er,mainSearch:new Er,facetValues:new Er,foldingCollection:new Er,instantResults:new Er})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/plan"),requestParams:xr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return La(r);let n=yield r.json();return qx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:xr(t),..._this3.options});if(r instanceof Error)return La(r);let n=yield r.json(),o={response:r,body:n};return Lx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Cr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return La(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Nm(i)?(a.body=Fm(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Cr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json","/facet"),requestParams:xr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"POST","application/json",""),requestParams:xr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Nm(n)){let o={response:r,body:n};return o.body=Fm(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Cr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Pm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Ut.call({...sr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return jx(n)?{success:n}:{error:Cr({response:r,body:n})}})()}},ja=e=>e.success!==void 0,vt=e=>e.error!==void 0;function Nm(e){return e.results!==void 0}function Fm(e){let t=Ma();return ce(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function Lx(e){return e.completions!==void 0}function qx(e){return e.preprocessingOutput!==void 0}function jx(e){return e.fields!==void 0}m();d();f();p();var Dm=e=>e,Mm=e=>e,Lm=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function et(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ux=typeof Symbol=="function"&&Symbol.observable||"@@observable",qm=Ux,Hl=()=>Math.random().toString(36).substring(7).split("").join("."),Vx={INIT:`@@redux/INIT${Hl()}`,REPLACE:`@@redux/REPLACE${Hl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Hl()}`},Ua=Vx;function zt(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 zl(e,t,r){if(typeof e!="function")throw new Error(et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(et(1));return r(zl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,u=!1;function c(){a===i&&(a=new Map,i.forEach((x,I)=>{a.set(I,x)}))}function g(){if(u)throw new Error(et(3));return o}function v(x){if(typeof x!="function")throw new Error(et(4));if(u)throw new Error(et(5));let I=!0;c();let N=s++;return a.set(N,x),function(){if(I){if(u)throw new Error(et(6));I=!1,c(),a.delete(N),i=null}}}function R(x){if(!zt(x))throw new Error(et(7));if(typeof x.type>"u")throw new Error(et(8));if(typeof x.type!="string")throw new Error(et(17));if(u)throw new Error(et(9));try{u=!0,o=n(o,x)}finally{u=!1}return(i=a).forEach(N=>{N()}),x}function h(x){if(typeof x!="function")throw new Error(et(10));n=x,R({type:Ua.REPLACE})}function y(){let x=v;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(et(11));function N(){let P=I;P.next&&P.next(g())}return N(),{unsubscribe:x(N)}},[qm](){return this}}}return R({type:Ua.INIT}),{dispatch:R,subscribe:v,getState:g,replaceReducer:h,[qm]:y}}function Gx(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Ua.INIT})>"u")throw new Error(et(12));if(typeof r(void 0,{type:Ua.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(et(13))})}function rn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{Gx(r)}catch(a){i=a}return function(s={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<n.length;v++){let R=n[v],h=r[R],y=s[R],b=h(y,u);if(typeof b>"u"){let x=u&&u.type;throw new Error(et(14))}g[R]=b,c=c||b!==y}return c=c||n.length!==Object.keys(s).length,c?g:s}}function vi(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function jm(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(et(15))},a={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},s=e.map(u=>u(a));return i=vi(...s)(o.dispatch),{...o,dispatch:i}}}function Si(e){return zt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var rd=Symbol.for("immer-nothing"),bi=Symbol.for("immer-draftable"),Ke=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ct=Object,on=Ct.getPrototypeOf,Ai="constructor",Ri="prototype",Yl="configurable",$a="enumerable",Ga="writable",wi="value",gt=e=>!!e&&!!e[Ke];function lt(e){return e?zm(e)||Ti(e)||!!e[bi]||!!e[Ai]?.[bi]||_i(e)||ro(e):!1}var Bx=Ct[Ri][Ai].toString(),Um=new WeakMap;function zm(e){if(!e||!to(e))return!1;let t=on(e);if(t===null||t===Ct[Ri])return!0;let r=Ct.hasOwnProperty.call(t,Ai)&&t[Ai];if(r===Object)return!0;if(!nn(r))return!1;let n=Um.get(r);return n===void 0&&(n=Function.toString.call(r),Um.set(r,n)),n===Bx}function nd(e){return gt(e)||tt(15,e),e[Ke].base_}function Ii(e,t,r=!0){an(e)===0?(r?Reflect.ownKeys(e):Ct.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function an(e){let t=e[Ke];return t?t.type_:Ti(e)?1:_i(e)?2:ro(e)?3:0}var eo=(e,t,r=an(e))=>r===2?e.has(t):Ct[Ri].hasOwnProperty.call(e,t),cr=(e,t,r=an(e))=>r===2?e.get(t):e[t],Qa=(e,t,r,n=an(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function $x(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ti=Array.isArray,_i=e=>e instanceof Map,ro=e=>e instanceof Set,to=e=>typeof e=="object",nn=e=>typeof e=="function",Wl=e=>typeof e=="boolean";function Qx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Hx=e=>to(e)?e?.[Ke]:null,ur=e=>e.copy_||e.base_;var od=e=>e.modified_?e.copy_:e.base_;function Xl(e,t){if(_i(e))return new Map(e);if(ro(e))return new Set(e);if(Ti(e))return Array[Ri].slice.call(e);let r=zm(e);if(t===!0||t==="class_only"&&!r){let n=Ct.getOwnPropertyDescriptors(e);delete n[Ke];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Ga]===!1&&(s[Ga]=!0,s[Yl]=!0),(s.get||s.set)&&(n[a]={[Yl]:!0,[Ga]:!0,[$a]:s[$a],[wi]:e[a]})}return Ct.create(on(e),n)}else{let n=on(e);if(n!==null&&r)return{...e};let o=Ct.create(n);return Ct.assign(o,e)}}function Xa(e,t=!1){return Za(e)||gt(e)||!lt(e)||(an(e)>1&&Ct.defineProperties(e,{set:Va,add:Va,clear:Va,delete:Va}),Ct.freeze(e),t&&Ii(e,(r,n)=>{Xa(n,!0)},!1)),e}function zx(){tt(2)}var Va={[wi]:zx};function Za(e){return e===null||!to(e)?!0:Ct.isFrozen(e)}var Ha="MapSet",za="Patches",Vm="ArrayMethods",Wa={};function sn(e){let t=Wa[e];return t||tt(0,e),t}var Gm=e=>!!Wa[e];function Wx(e,t){Wa[e]||(Wa[e]=t)}var xi,Wm=()=>xi,Kx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Gm(Ha)?sn(Ha):void 0,arrayMethodsPlugin_:Gm(Vm)?sn(Vm):void 0});function Bm(e,t){t&&(e.patchPlugin_=sn(za),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zl(e){Jl(e),e.drafts_.forEach(Yx),e.drafts_=null}function Jl(e){e===xi&&(xi=e.parent_)}var $m=e=>xi=Kx(xi,e);function Yx(e){let t=e[Ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Qm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ke].modified_&&(Zl(t),tt(4)),lt(e)&&(e=Hm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ke].base_,e,t)}else e=Hm(t,r);return Xx(t,e,!0),Zl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==rd?e:void 0}function Hm(e,t){if(Za(t))return t;let r=t[Ke];if(!r)return Ka(t,e.handledSet_,e);if(!Ja(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);Xm(r,e)}return r.copy_}function Xx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xa(t,r)}function Km(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ja=(e,t)=>e.scope_===t,Zx=[];function Ym(e,t,r,n){let o=ur(e),i=e.type_;if(n!==void 0&&cr(o,n,i)===t){Qa(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Ii(o,(u,c)=>{if(gt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Zx;for(let s of a)Qa(o,s,r,i)}function Jx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Ja(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=od(i);Ym(e,i.draft_??i,a,r),Xm(i,o)})}function Xm(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)}Km(e)}}function eC(e,t,r){let{scope_:n}=e;if(gt(r)){let o=r[Ke];Ja(o,n)&&o.callbacks_.push(function(){Ba(e);let a=od(o);Ym(e,r,a,t)})}else lt(r)&&e.callbacks_.push(function(){let i=ur(e);e.type_===3?i.has(r)&&Ka(r,n.handledSet_,n):cr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ka(cr(e.copy_,t,e.type_),n.handledSet_,n)})}function Ka(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||gt(e)||t.has(e)||!lt(e)||Za(e)||(t.add(e),Ii(e,(n,o)=>{if(gt(o)){let i=o[Ke];if(Ja(i,r)){let a=od(i);Qa(e,n,a,e.type_),Km(i)}}else lt(o)&&Ka(o,t,r)})),e}function tC(e,t){let r=Ti(e),n={type_:r?1:0,scope_:t?t.scope_:Wm(),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=Ya;r&&(o=[n],i=Ci);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var Ya={get(e,t){if(t===Ke)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=ur(e);if(!eo(o,t,e.type_))return nC(e,o,t);let i=o[t];if(e.finalized_||!lt(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Qx(t))return i;if(i===Kl(e.base_,t)||rC(e,t,i)){Ba(e);let a=e.type_===1?+t:t,s=td(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ur(e)},ownKeys(e){return Reflect.ownKeys(ur(e))},set(e,t,r){let n=Zm(ur(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Kl(ur(e),t),i=o?.[Ke];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if($x(r,o)&&(r!==void 0||eo(e.base_,t,e.type_)))return!0;Ba(e),ed(e)}return e.copy_[t]===r&&(r!==void 0||eo(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),eC(e,t,r)),!0},deleteProperty(e,t){return Ba(e),Kl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ed(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ur(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ga]:!0,[Yl]:e.type_!==1||t!=="length",[$a]:n[$a],[wi]:r[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return on(e.base_)},setPrototypeOf(){tt(12)}},Ci={};for(let e in Ya){let t=Ya[e];Ci[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ci.deleteProperty=function(e,t){return Ci.set.call(this,e,t,void 0)};Ci.set=function(e,t,r){return Ya.set.call(this,e[0],t,r,e[0])};function Kl(e,t){let r=e[Ke];return(r?ur(r):e)[t]}function rC(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||!lt(r)||r[Ke]?!1:e.baseRefs_.has(r)}function nC(e,t,r){let n=Zm(t,r);return n?wi in n?n[wi]:n.get?.call(e.draft_):void 0}function Zm(e,t){if(!(t in e))return;let r=on(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=on(r)}}function ed(e){e.modified_||(e.modified_=!0,e.parent_&&ed(e.parent_))}function Ba(e){e.copy_||(e.assigned_=new Map,e.copy_=Xl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var oC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(nn(t)&&!nn(r)){let i=r;r=t;let a=this;return function(u=i,...c){return a.produce(u,g=>r.call(this,g,...c))}}nn(r)||tt(6),n!==void 0&&!nn(n)&&tt(7);let o;if(lt(t)){let i=$m(this),a=td(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Zl(i):Jl(i)}return Bm(i,n),Qm(o,i)}else if(!t||!to(t)){if(o=r(t),o===void 0&&(o=t),o===rd&&(o=void 0),this.autoFreeze_&&Xa(o,!0),n){let i=[],a=[];sn(za).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else tt(1,t)},this.produceWithPatches=(t,r)=>{if(nn(t))return(a,...s)=>this.produceWithPatches(a,u=>t(u,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},Wl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Wl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Wl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lt(e)||tt(8),gt(e)&&(e=es(e));let t=$m(this),r=td(t,e,void 0);return r[Ke].isManual_=!0,Jl(t),r}finishDraft(e,t){let r=e&&e[Ke];(!r||!r.isManual_)&&tt(9);let{scope_:n}=r;return Bm(n,t),Qm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=sn(za).applyPatches_;return gt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function td(e,t,r,n){let[o,i]=_i(t)?sn(Ha).proxyMap_(t,r):ro(t)?sn(Ha).proxySet_(t,r):tC(t,r);return(r?.scope_??Wm()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Jx(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function es(e){return gt(e)||tt(10,e),Jm(e)}function Jm(e){if(!lt(e)||Za(e))return e;let t=e[Ke],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Xl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Xl(e,!0);let o=r;return ro(r)&&(r=new Set),Ii(o,(i,a)=>{Qa(r,i,Jm(a))},n),t&&(t.finalized_=!1),r}function eg(){function t(y,b=[]){if(y.key_!==void 0){let x=y.parent_.copy_??y.parent_.base_,I=Hx(cr(x,y.key_)),N=cr(x,y.key_);if(N===void 0||N!==y.draft_&&N!==y.copy_||I!=null&&I.base_!==y.base_)return null;let _=y.parent_.type_===3,P;if(_){let w=y.parent_;P=Array.from(w.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(_&&x.size>P||eo(x,P))||y.parent_.type_===1&&y.parent_.allIndicesReassigned_)return null;b.push(P)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let x=y;for(let I=0;I<b.length-1;I++){let N=b[I];if(x=cr(x,N),!to(x)||x===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return x}let n="replace",o="add",i="remove";function a(y,b,x){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:N}=x;switch(y.type_){case 0:case 2:return u(y,b,I,N);case 1:return s(y,b,I,N);case 3:return c(y,b,I,N)}}function s(y,b,x,I){let{base_:N,assigned_:_}=y,P=y.copy_;P.length<N.length&&([N,P]=[P,N],[x,I]=[I,x]);let w=y.allIndicesReassigned_===!0;for(let O=0;O<N.length;O++){let k=P[O],T=N[O];if((w||_?.get(O.toString()))&&k!==T){let G=k?.[Ke];if(G&&G.modified_)continue;let M=b.concat([O]);x.push({op:n,path:M,value:h(k)}),I.push({op:n,path:M,value:h(T)})}}for(let O=N.length;O<P.length;O++){let k=b.concat([O]);x.push({op:o,path:k,value:h(P[O])})}for(let O=P.length-1;N.length<=O;--O){let k=b.concat([O]);I.push({op:i,path:k})}}function u(y,b,x,I){let{base_:N,copy_:_,type_:P}=y;Ii(y.assigned_,(w,O)=>{let k=cr(N,w,P),T=cr(_,w,P),D=O?eo(N,w)?n:o:i;if(k===T&&D===n)return;let G=b.concat(w);x.push(D===i?{op:D,path:G}:{op:D,path:G,value:h(T)}),I.push(D===o?{op:i,path:G}:D===i?{op:o,path:G,value:h(k)}:{op:n,path:G,value:h(k)})})}function c(y,b,x,I){let{base_:N,copy_:_}=y,P=0;N.forEach(w=>{if(!_.has(w)){let O=b.concat([P]);x.push({op:i,path:O,value:w}),I.unshift({op:o,path:O,value:w})}P++}),P=0,_.forEach(w=>{if(!N.has(w)){let O=b.concat([P]);x.push({op:o,path:O,value:w}),I.unshift({op:i,path:O,value:w})}P++})}function g(y,b,x){let{patches_:I,inversePatches_:N}=x;I.push({op:n,path:[],value:b===rd?void 0:b}),N.push({op:n,path:[],value:y})}function v(y,b){return b.forEach(x=>{let{path:I,op:N}=x,_=y;for(let k=0;k<I.length-1;k++){let T=an(_),D=I[k];typeof D!="string"&&typeof D!="number"&&(D=""+D),(T===0||T===1)&&(D==="__proto__"||D===Ai)&&tt(19),nn(_)&&D===Ri&&tt(19),_=cr(_,D),(_===null||!to(_))&&tt(18,I.join("/"))}let P=an(_),w=R(x.value),O=I[I.length-1];switch(N){case n:switch(P){case 2:return _.set(O,w);case 3:tt(16);default:return _[O]=w}case o:switch(P){case 1:return O==="-"?_.push(w):_.splice(O,0,w);case 2:return _.set(O,w);case 3:return _.add(w);default:return _[O]=w}case i:switch(P){case 1:return _.splice(O,1);case 2:return _.delete(O);case 3:return _.delete(x.value);default:return delete _[O]}default:tt(17,N)}}),y}function R(y){if(!lt(y))return y;if(Ti(y))return y.map(R);if(_i(y))return new Map(Array.from(y.entries()).map(([x,I])=>[x,R(I)]));if(ro(y))return new Set(Array.from(y).map(R));let b=Object.create(on(y));for(let x in y)b[x]=R(y[x]);return eo(y,bi)&&(b[bi]=y[bi]),b}function h(y){return gt(y)?R(y):y}Wx(za,{applyPatches_:v,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var iC=A.Iterator,jL=typeof iC?.from=="function";var Ei=new oC,cn=Ei.produce,id=Ei.produceWithPatches.bind(Ei);var ad=Ei.applyPatches.bind(Ei);m();d();f();p();var aC=class{constructor(e){this.value=e}deref(){return this.value}},sC=()=>typeof WeakRef>"u"?aC:WeakRef,rg=sC(),cC=0,ts=1;function ki(){return{s:cC,v:void 0,o:null,p:null}}function uC(e){return e instanceof rg?e.deref():e}function no(e,t={}){let r=ki(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,s=0,u,c=0,g=!1;function v(){s>=o&&(a=r,r=ki(),s=0)}function R(){let h=r,{length:y}=arguments;for(let I=0,N=y;I<N;I++){let _=arguments[I];if(typeof _=="function"||typeof _=="object"&&_!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h)):h=w}else{let P=h.p;P===null&&(h.p=P=new Map);let w=P.get(_);w===void 0?(h=ki(),P.set(_,h),s++):h=w}}if(h.s===ts)return h.v;if(a!==null){let I=a;for(let N=0,_=y;N<_;N++){let P=arguments[N],w;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=I.o;w=O!==null?O.get(P):void 0}else{let O=I.p;w=O!==null?O.get(P):void 0}if(w===void 0){I=null;break}I=w}if(I!==null&&I.s===ts){let N=h;return N.s=ts,N.v=I.v,v(),I.v}}let b=h,x=e.apply(null,arguments);if(c++,n){let I=uC(u);I!=null&&n(I,x)&&(x=I,c!==0&&c--),u=typeof x=="object"&&x!==null||typeof x=="function"?new rg(x):x}return b.s=ts,b.v=x,i&&v(),x}return R.clearCache=()=>{r=ki(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var sd=Symbol("NOT_FOUND");function lC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function dC(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 tg=e=>Array.isArray(e)?e:[e];function pC(e){let t=Array.isArray(e[0])?e[0]:e;return dC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rs(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),lC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:v,memoizeOptions:R=[],argsMemoize:h=no,argsMemoizeOptions:y=[]}=g,b=tg(R),x=tg(y),I=pC(o),N=v(function(){return i++,c.apply(null,arguments)},...b),_=!0,P=h(function(){a++;let{length:O}=I,k=new Array(O);for(let T=0;T<O;T++)k[T]=I[T].apply(null,arguments);return s=N.apply(null,k),s},...x);return Object.assign(P,{resultFunc:c,memoizedResultFunc:N,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ze=rs(no);function fC(e){let t;return{get(r){return t&&e(t.key,r)?t.value:sd},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 mC(e,t){let r=[];function n(s){let u=r.findIndex(c=>t(c.key,s));if(u>-1){let c=r[u];return u>0&&(r.splice(u,1),r.unshift(c)),c.value}return sd}function o(s,u){r.unshift({key:s,value:u}),r.length>e&&r.pop()}function i(s,u){let c=r,{length:g}=c;for(let v=0;v<g;v++){let R=c[v];if(u(R.value,s))return R}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var gC=(e,t)=>e===t;function hC(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 cd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=gC,maxSize:o=1,resultEqualityCheck:i}=r,a=hC(n),s=0,u=o<=1?fC(a):mC(o,a);function c(){let g=u.get(arguments);if(g===sd){if(g=e.apply(null,arguments),s++,i){let v=u.findMatchingEntry(g,i);v&&(g=v.value,s!==0&&s--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}m();d();f();p();function ng(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var og=ng(),ig=ng;var yC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?vi:vi.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var vC=e=>e&&typeof e.match=="function";function L(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(dt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Si(n)&&n.type===e,r}var fg=class Oi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Oi.prototype)}static get[Symbol.species](){return Oi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Oi(...t[0].concat(this)):new Oi(...t.concat(this))}};function ag(e){return lt(e)?cn(e,()=>{}):e}function ns(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function SC(e){return typeof e=="boolean"}var bC=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new fg;return r&&(SC(r)?a.push(og):a.push(ig(r.extraArgument))),a},Pi="RTK_autoBatch",ao=()=>e=>({payload:e,meta:{[Pi]:!0}}),sg=e=>t=>{setTimeout(t,e)},AC=(e,t)=>r=>{let n=!1,o,i,a=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(i),r())};o=e(a),i=setTimeout(a,t)},wC=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?AC(window.requestAnimationFrame,100):sg(10):e.type==="callback"?e.queueNotification:sg(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let v=()=>o&&g(),R=n.subscribe(v);return s.add(g),()=>{R(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Pi],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},xC=e=>function(r){let{autoBatch:n=!0}=r??{},o=new fg(e);return n&&o.push(wC(typeof n=="object"?n:void 0)),o};function mg(e){let t=bC(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},u;if(typeof r=="function")u=r;else if(zt(r))u=rn(r);else throw new Error(dt(1));let c;typeof n=="function"?c=n(t):c=t();let g=vi;o&&(g=yC({trace:!1,...(typeof o=="object"&&o)}));let v=jm(...c),R=xC(v),h=typeof s=="function"?s(R):R(),y=g(...h);return zl(u,a,y)}function gg(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(dt(28));if(s in t)throw new Error(dt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function CC(e){return typeof e=="function"}function Be(e,t){let[r,n,o]=gg(t),i;if(CC(e))i=()=>ag(e());else{let s=ag(e);i=()=>s}function a(s=i(),u){let c=[r[u.type],...n.filter(({matcher:g})=>g(u)).map(({reducer:g})=>g)];return c.filter(g=>!!g).length===0&&(c=[o]),c.reduce((g,v)=>{if(v)if(gt(g)){let R=v(g,u);return R===void 0?g:R}else{if(lt(g))return cn(g,R=>v(R,u));{let R=v(g,u);if(R===void 0){if(g===null)return g;throw new Error(dt(9))}return R}}return g},s)}return a.getInitialState=i,a}var hg=(e,t)=>vC(e)?e.match(t):e(t);function Wt(...e){return t=>e.some(r=>hg(r,t))}function io(...e){return t=>e.every(r=>hg(r,t))}function ss(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 Ni(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function cs(...e){return e.length===0?t=>ss(t,["pending"]):Ni(e)?Wt(...e.map(t=>t.pending)):cs()(e[0])}function ln(...e){return e.length===0?t=>ss(t,["rejected"]):Ni(e)?Wt(...e.map(t=>t.rejected)):ln()(e[0])}function Fi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?io(ln(...e),t):Ni(e)?io(ln(...e),t):Fi()(e[0])}function lr(...e){return e.length===0?t=>ss(t,["fulfilled"]):Ni(e)?Wt(...e.map(t=>t.fulfilled)):lr()(e[0])}function us(...e){return e.length===0?t=>ss(t,["pending","fulfilled","rejected"]):Ni(e)?Wt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):us()(e[0])}var EC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Di=(e=21)=>{let t="",r=e;for(;r--;)t+=EC[Math.random()*64|0];return t},RC=["name","message","stack","code"],ud=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},cg=class{constructor(e,t){ue(this,"payload");ue(this,"meta");ue(this,"_type");this.payload=e,this.meta=t}},IC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of RC)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},ug="External signal was aborted",ke=(()=>{function e(t,r,n){let o=L(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=L(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),a=L(t+"/rejected",(u,c,g,v,R)=>({payload:v,error:(n&&n.serializeError||IC)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:v!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function s(u,{signal:c}={}){return(g,v,R)=>{let h=n?.idGenerator?n.idGenerator(u):Di(),y=new l.AbortController,b,x;function I(_){x=_,y.abort()}c&&(c.aborted?I(ug):c.addEventListener("abort",()=>I(ug),{once:!0}));let N=_asyncToGenerator(function*(){let _;try{let P=n?.condition?.(u,{getState:v,extra:R});if(_C(P)&&(P=yield P),P===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(y.signal.aborted)throw{name:"AbortError",message:x||"Aborted"};let w=new Promise((O,k)=>{b=()=>{k({name:"AbortError",message:x||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:R}))),_=yield Promise.race([w,Promise.resolve(r(u,{dispatch:g,getState:v,extra:R,requestId:h,signal:y.signal,abort:I,rejectWithValue:(O,k)=>new ud(O,k),fulfillWithValue:(O,k)=>new cg(O,k)})).then(O=>{if(O instanceof ud)throw O;return O instanceof cg?o(O.payload,h,u,O.meta):o(O,h,u)})])}catch(P){_=P instanceof ud?a(null,h,u,P.payload,P.meta):a(P,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&a.match(_)&&_.meta.condition||g(_),_})();return Object.assign(N,{abort:I,requestId:h,arg:u,unwrap(){return N.then(TC)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Wt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function TC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function _C(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var yg=Symbol.for("rtk-slice-createasyncthunk"),sq={[yg]:ke};function kC(e,t){return`${e}/${t}`}function OC({creators:e}={}){let t=e?.asyncThunk?.[yg];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(dt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(NC()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(_,P){let w=typeof _=="string"?_:_.type;if(!w)throw new Error(dt(12));if(w in u.sliceCaseReducersByType)throw new Error(dt(13));return u.sliceCaseReducersByType[w]=P,c},addMatcher(_,P){return u.sliceMatchers.push({matcher:_,reducer:P}),c},exposeAction(_,P){return u.actionCreators[_]=P,c},exposeCaseReducer(_,P){return u.sliceCaseReducersByName[_]=P,c}};s.forEach(_=>{let P=a[_],w={reducerName:_,type:kC(o,_),createNotation:typeof n.reducers=="function"};DC(P)?LC(w,P,c,t):FC(w,P,c)});function g(){let[_={},P=[],w=void 0]=typeof n.extraReducers=="function"?gg(n.extraReducers):[n.extraReducers],O={..._,...u.sliceCaseReducersByType};return Be(n.initialState,k=>{for(let T in O)k.addCase(T,O[T]);for(let T of u.sliceMatchers)k.addMatcher(T.matcher,T.reducer);for(let T of P)k.addMatcher(T.matcher,T.reducer);w&&k.addDefaultCase(w)})}let v=_=>_,R=new Map,h=new WeakMap,y;function b(_,P){return y||(y=g()),y(_,P)}function x(){return y||(y=g()),y.getInitialState()}function I(_,P=!1){function w(k){let T=k[_];return typeof T>"u"&&P&&(T=ns(h,w,x)),T}function O(k=v){return ns(ns(R,P,()=>new WeakMap),k,()=>{let T={};for(let[D,G]of Object.entries(n.selectors??{}))T[D]=PC(G,k,()=>ns(h,k,x),P);return T})}return{reducerPath:_,getSelectors:O,get selectors(){return O(w)},selectSlice:w}}let N={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:x,...I(i),injectInto(_,{reducerPath:P,...w}={}){let O=P??i;return _.inject({reducerPath:O,reducer:b},w),{...N,...I(O,!0)}}};return N}}function PC(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var dn=OC();function NC(){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 FC({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!MC(n))throw new Error(dt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?L(e,a):L(e))}function DC(e){return e._reducerDefinitionType==="asyncThunk"}function MC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function LC({type:e,reducerName:t},r,n,o){if(!o)throw new Error(dt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:u,settled:c,options:g}=r,v=o(e,i,g);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),u&&n.addCase(v.rejected,u),c&&n.addMatcher(v.settled,c),n.exposeCaseReducer(t,{fulfilled:a||os,pending:s||os,rejected:u||os,settled:c||os})}function os(){}var qC="task",vg="listener",Sg="completed",pd="cancelled",jC=`task-${pd}`,UC=`task-${Sg}`,ld=`${vg}-${pd}`,VC=`${vg}-${Sg}`,ls=class{constructor(e){ue(this,"code");ue(this,"name","TaskAbortError");ue(this,"message");this.code=e,this.message=`${qC} ${pd} (reason: ${e})`}},fd=(e,t)=>{if(typeof e!="function")throw new TypeError(dt(32))},is=()=>{},bg=(e,t=is)=>(e.catch(t),e),Ag=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),un=e=>{if(e.aborted)throw new ls(e.reason)};function wg(e,t){let r=is;return new Promise((n,o)=>{let i=()=>o(new ls(e.reason));if(e.aborted){i();return}r=Ag(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=is})}var GC=/*#__PURE__*/function(){var _GC=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ls?"cancelled":"rejected",error:r}}finally{t?.()}});function GC(_x5,_x6){return _GC.apply(this,arguments)}return GC}(),as=e=>t=>bg(wg(e,t).then(r=>(un(e),r))),xg=e=>{let t=as(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:oo}=Object,lg={},ds="listenerMiddleware",BC=(e,t)=>{let r=n=>Ag(e,()=>n.abort(e.reason));return(n,o)=>{fd(n,"taskExecutor");let i=new l.AbortController;r(i);let a=GC(/*#__PURE__*/_asyncToGenerator(function*(){un(e),un(i.signal);let s=yield n({pause:as(i.signal),delay:xg(i.signal),signal:i.signal});return un(i.signal),s}),()=>i.abort(UC));return o?.autoJoin&&t.push(a.catch(is)),{result:as(e)(a),cancel(){i.abort(jC)}}}},$C=(e,t)=>{let r=/*#__PURE__*/function(){var _r2=_asyncToGenerator(function*(n,o){un(t);let i=()=>{},a=[new Promise((s,u)=>{let c=e({predicate:n,effect:(g,v)=>{v.unsubscribe(),s([g,v.getState(),v.getOriginalState()])}});i=()=>{c(),u()}})];o!=null&&a.push(new Promise(s=>setTimeout(s,o,null)));try{let s=yield wg(t,Promise.race(a));return un(t),s}finally{i()}});function r(_x7,_x8){return _r2.apply(this,arguments)}return r}();return(n,o)=>bg(r(n,o))},Cg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=L(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(dt(21));return fd(i,"options.listener"),{predicate:o,type:t,effect:i}},Eg=oo(e=>{let{type:t,predicate:r,effect:n}=Cg(e);return{id:Di(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(dt(22))}}},{withTypes:()=>Eg}),dg=(e,t)=>{let{type:r,effect:n,predicate:o}=Cg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},dd=e=>{e.pending.forEach(t=>{t.abort(ld)})},QC=(e,t)=>()=>{for(let r of t.keys())dd(r);e.clear()},pg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Rg=oo(L(`${ds}/add`),{withTypes:()=>Rg}),HC=L(`${ds}/removeAll`),Ig=oo(L(`${ds}/remove`),{withTypes:()=>Ig}),zC=(...e)=>{console.error(`${ds}/error`,...e)},Tg=(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=zC}=e;fd(a,"onError");let s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&dd(h)}),u=h=>{let y=dg(t,h)??Eg(h);return s(y)};oo(u,{withTypes:()=>u});let c=h=>{let y=dg(t,h);return y&&(y.unsubscribe(),h.cancelActive&&dd(y)),!!y};oo(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _g2=_asyncToGenerator(function*(h,y,b,x){let I=new l.AbortController,N=$C(u,I.signal),_=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,oo({},b,{getOriginalState:x,condition:(P,w)=>N(P,w).then(Boolean),take:N,delay:xg(I.signal),pause:as(I.signal),extra:i,signal:I.signal,fork:BC(I.signal,_),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,w,O)=>{P!==I&&(P.abort(ld),O.delete(P))})},cancel:()=>{I.abort(ld),h.pending.delete(I)},throwIfCancelled:()=>{un(I.signal)}})))}catch(P){P instanceof ls||pg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(_),I.abort(VC),o(h),h.pending.delete(I)}});function g(_x9,_x0,_x1,_x10){return _g2.apply(this,arguments)}return g}(),v=QC(t,r);return{middleware:h=>y=>b=>{if(!Si(b))return y(b);if(Rg.match(b))return u(b.payload);if(HC.match(b)){v();return}if(Ig.match(b))return c(b.payload);let x=h.getState(),I=()=>{if(x===lg)throw new Error(dt(23));return x},N;try{if(N=y(b),t.size>0){let _=h.getState(),P=Array.from(t.values());for(let w of P){let O=!1;try{O=w.predicate(b,_,x)}catch(k){O=!1,pg(a,k,{raisedBy:"predicate"})}O&&g(w,b,h,I)}}}finally{x=lg}return N},startListening:u,stopListening:c,clearListeners:v}};function dt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();f();p();var Y=new H({required:!0,emptyAllowed:!1}),rt=new H({required:!1,emptyAllowed:!1}),nt=new H({required:!0,emptyAllowed:!0}),Sq=new H({required:!1,emptyAllowed:!0}),ps=new Ae({each:Y,required:!0}),_g=new H({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),kg=new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bq=new H({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),dr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Ot=(e,t)=>{if("required"in t)return{payload:new yt({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new fi(o);return{payload:e}},V=(e,t)=>{try{return Ot(e,t)}catch(r){return{payload:e,error:dr(r)}}},Og=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Pg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ng(e,t,r,o,"Controller initialization error")},Ng=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var so="3.58.1",Fg=["@coveo/atomic","@coveo/quantic"];var md=()=>rt,Dg=()=>Y,Rr=L("configuration/updateBasicConfiguration",e=>V(e,{accessToken:rt,environment:new H({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:rt})),Kt=L("configuration/updateSearchConfiguration",e=>V(e,{proxyBaseUrl:new H({required:!1,url:!0}),pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,timezone:rt,locale:rt,authenticationProviders:new Ae({required:!1,each:Y})})),WC={enabled:new fe({default:!0}),originContext:md(),originLevel2:md(),originLevel3:md(),proxyBaseUrl:new H({required:!1,url:!0}),runtimeEnvironment:new qe,anonymous:new fe({default:!1}),deviceId:rt,userDisplayName:rt,documentLocation:rt,trackingId:kg,analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Fg.reduce((e,t)=>(e[t]=_g,e),{})})},co=L("configuration/updateAnalyticsConfiguration",e=>V(e,WC)),uo=L("configuration/analytics/disable"),lo=L("configuration/analytics/enable"),fs=L("configuration/analytics/originlevel2",e=>V(e,{originLevel2:Dg()})),ms=L("configuration/analytics/originlevel3",e=>V(e,{originLevel3:Dg()})),Mg=L("knowledge/setAgentId",e=>V(e,new H({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Lg={q:new H,enableQuerySyntax:new fe,aq:new H,cq:new H,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new H,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new fe,sf:new re,tab:new H,af:new re};var Ir=L("searchParameters/restore",e=>V(e,Lg)),qg=L("searchParameters/restoreTab",e=>V(e,Y));m();d();f();p();var gs=L("debug/enable"),hs=L("debug/disable");m();d();f();p();var ys=()=>!1;var vs=Be(ys(),e=>{e.addCase(gs,()=>!0).addCase(hs,()=>!1).addCase(Ir,(t,r)=>r.payload.debug??t)});m();d();f();p();var po=L("pipeline/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var KC=L("history/undo"),YC=L("history/redo"),Yt=L("history/snapshot"),_j=ke("history/back",/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,{dispatch:t}){t(KC()),yield t(St())});return function(_x11,_x12){return _ref3.apply(this,arguments)}}()),kj=ke("history/forward",/*#__PURE__*/function(){var _ref4=_asyncToGenerator(function*(e,{dispatch:t}){t(YC()),yield t(St())});return function(_x13,_x14){return _ref4.apply(this,arguments)}}()),St=ke("history/change",/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref5.apply(this,arguments)}}());m();d();f();p();var Tr=()=>"";var fo=Be(Tr(),e=>{e.addCase(po,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Kt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var Ss=L("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function XC(){return typeof navigator<"u"}function jg(){try{return typeof localStorage<"u"}catch{return!1}}function Ug(){try{return typeof sessionStorage<"u"}catch{return!1}}function Vg(){return XC()&&navigator.cookieEnabled}m();d();f();p();var pn=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),gd(t,r,o,ZC(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 ZC(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(JC(n))return n}}function JC(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return gd(t,"1",void 0,e),pn.get(t)==="1"}catch{return!1}finally{try{gd(t,"",new Date(0),e)}catch{}}}function gd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Gg(){return jg()?localStorage:Vg()?new bs:Ug()?sessionStorage:new hd}var bs=class e{getItem(t){return pn.get(`${e.prefix}${t}`)}removeItem(t){pn.erase(`${e.prefix}${t}`)}setItem(t,r,n){pn.set(`${e.prefix}${t}`,r,n)}};bs.prefix="coveo_";var hd=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var As="__coveo.analytics.history",eE=20,tE=1e3*60,rE=75,ws=class{constructor(t){this.store=t||Gg()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(As);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(As);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(As,JSON.stringify(t.slice(0,eE)))}catch{}}clear(){try{this.store.removeItem(As)}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,rE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>tE:!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 fn=class fn extends ws{static getInstance(t){return fn.instance||(fn.instance=new fn(t)),fn.instance}constructor(t){super(t)}};ue(fn,"instance",null);var ht=fn;m();d();f();p();m();d();f();p();var mo=ze(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${so}`));m();d();f();p();m();d();f();p();function pr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function U(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}var Ce;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ce||(Ce={}));function Sd(){return typeof window<"u"}function Nd(){return typeof navigator<"u"}function go(){return typeof document<"u"}function bd(){try{return typeof localStorage<"u"}catch{return!1}}function nE(){try{return typeof sessionStorage<"u"}catch{return!1}}function eh(){return Nd()&&navigator.cookieEnabled}var oE=[Ce.click,Ce.custom,Ce.search,Ce.view],iE=(e,t)=>oE.indexOf(e)!==-1?Object.assign({language:go()?document.documentElement.lang:"unknown",userAgent:Nd()?navigator.userAgent:"unknown"},t):t,ho=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Ad(t,r,o,aE(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 aE(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(sE(n))return n}}function sE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Ad(t,"1",void 0,e),ho.get(t)==="1"}catch{return!1}finally{try{Ad(t,"",new Date(0),e)}catch{}}}function Ad(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function cE(){return bd()?localStorage:eh()?new Li:nE()?sessionStorage:new vo}var Li=class e{getItem(t){return ho.get(`${e.prefix}${t}`)}removeItem(t){ho.erase(`${e.prefix}${t}`)}setItem(t,r,n){ho.set(`${e.prefix}${t}`,r,n)}};Li.prefix="coveo_";var wd=class{constructor(){this.cookieStorage=new Li}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)}},vo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},xs="__coveo.analytics.history",uE=20,lE=1e3*60,dE=75,Es=class{constructor(t){this.store=t||cE()}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(xs);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(xs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(xs,JSON.stringify(t.slice(0,uE)))}catch{}}clear(){try{this.store.removeItem(xs)}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,dE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>lE:!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 pE=(e,t)=>U(void 0,void 0,void 0,function*(){return e===Ce.view?(yield fE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),fE=e=>U(void 0,void 0,void 0,function*(){let t=new Es,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),mE=/^(?:[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 Rs(e){return typeof e=="string"&&mE.test(e)}function Bg(e){if(!Rs(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var ot=[];for(let e=0;e<256;++e)ot.push((e+256).toString(16).slice(1));function th(e,t=0){return(ot[e[t+0]]+ot[e[t+1]]+ot[e[t+2]]+ot[e[t+3]]+"-"+ot[e[t+4]]+ot[e[t+5]]+"-"+ot[e[t+6]]+ot[e[t+7]]+"-"+ot[e[t+8]]+ot[e[t+9]]+"-"+ot[e[t+10]]+ot[e[t+11]]+ot[e[t+12]]+ot[e[t+13]]+ot[e[t+14]]+ot[e[t+15]]).toLowerCase()}var gE=new Uint8Array(16);function hE(){return crypto.getRandomValues(gE)}function yE(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 vE="6ba7b810-9dad-11d1-80b4-00c04fd430c8",SE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function bE(e,t,r,n,o,i){let a=typeof r=="string"?yE(r):r,s=typeof n=="string"?Bg(n):n;if(typeof n=="string"&&(n=Bg(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);return u.set(s),u.set(a,s.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,th(u)}function mn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():AE(e,t,r)}function AE(e,t,r){e=e||{};let n=e.random??e.rng?.()??hE();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 th(n)}function wE(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 yd(e,t){return e<<t|e>>>32-t}function xE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];a[s]=u}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=a[s][y];for(let y=16;y<80;++y)u[y]=yd(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let c=r[0],g=r[1],v=r[2],R=r[3],h=r[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),x=yd(c,5)+wE(b,g,v,R)+h+t[b]+u[y]>>>0;h=R,R=v,v=yd(g,30)>>>0,g=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+v>>>0,r[3]=r[3]+R>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Is(e,t,r,n){return bE(80,xE,e,t)}Is.DNS=vE;Is.URL=SE;var rh="2.33.1",$g=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Mi={pageview:"pageview",event:"event"},Ts=class{constructor({client:t,uuidGenerator:r=mn}){this.client=t,this.uuidGenerator=r}},xd=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=$g(window.location),this.lastReferrer=go()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:go()?document.title:"",encoding:go()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Mi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Mi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Mi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Mi.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 $g(window.location)}},_r=class e{constructor(t,r){if(!Rs(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 Rs(i)?new e(i,Number.parseInt(o)*1e3):null}};_r.cvo_cid="cvo_cid";_r.expirationTime=120;var Cd=class extends Ts{constructor({client:t,uuidGenerator:r=mn}){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(_r.cvo_cid,new _r(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Cd.Id="link";var Nt=Object.keys;function Cs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var vd=128,nh=192,Qg=224,Hg=240;function CE(e){return(e&248)===Hg?4:(e&Hg)===Qg?3:(e&Qg)===nh?2:1}function EE(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&vd)!=vd)break;if(r-=3,(n&nh)!=vd){t-r>=CE(n)*3&&(r=t);break}}return e.substring(0,r)}var Ed={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"},RE=Nt(Ed).map(e=>Ed[e]),IE=[...RE].join("|"),TE=new RegExp(`^(${IE}$)`),_E={svcAction:"svc_action",svcActionData:"svc_action_data"},kE=e=>Nt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Ed[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),OE=e=>TE.test(e),PE=[OE],zg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Wg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},pt={action:"pa",list:"pal",listSource:"pls"},_s={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},NE=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Rd={id:"quoteId",affiliation:"quoteAffiliation"},Id={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},FE={add:pt,bookmark_add:pt,bookmark_remove:pt,click:pt,checkout:pt,checkout_option:pt,detail:pt,impression:pt,remove:pt,refund:Object.assign(Object.assign({},pt),_s),purchase:Object.assign(Object.assign({},pt),_s),quickview:pt,quote:Object.assign(Object.assign({},pt),Rd),review:Object.assign(Object.assign({},pt),Id)},DE=Nt(zg).map(e=>zg[e]),ME=Nt(Wg).map(e=>Wg[e]),LE=Nt(pt).map(e=>pt[e]),qE=Nt(_s).map(e=>_s[e]),jE=Nt(Id).map(e=>Id[e]),UE=Nt(Rd).map(e=>Rd[e]),VE=[...DE,"custom"].join("|"),GE=[...ME,"custom"].join("|"),oh="(pr[0-9]+)",ih="(il[0-9]+pi[0-9]+)",BE=new RegExp(`^${oh}(${VE})$`),$E=new RegExp(`^(${ih}(${GE}))|(il[0-9]+nm)$`),QE=new RegExp(`^(${LE.join("|")})$`),HE=new RegExp(`^(${qE.join("|")})$`),zE=new RegExp(`^${oh}custom$`),WE=new RegExp(`^${ih}custom$`),KE=new RegExp(`^(${[...NE,...jE,...UE].join("|")})$`),YE=e=>BE.test(e),XE=e=>$E.test(e),ZE=e=>QE.test(e),JE=e=>HE.test(e),eR=e=>KE.test(e),tR=[XE,YE,ZE,JE,eR],rR=[zE,WE],nR={anonymizeIp:"aip"},oR={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},iR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},aR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],sR=Object.assign(Object.assign(Object.assign(Object.assign({},nR),oR),iR),aR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Td=Object.assign(Object.assign({},sR),_E),cR=e=>{let t=!!e.action&&FE[e.action]||{};return Nt(e).reduce((r,n)=>{let o=t[n]||Td[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},uR=Nt(Td).map(e=>Td[e]),lR=e=>uR.indexOf(e)!==-1,dR=e=>e==="custom",pR=e=>[...tR,...PE,lR,dR].some(t=>t(e)),fR=e=>Nt(e).reduce((t,r)=>{let n=mR(r);return n?Object.assign(Object.assign({},t),gR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),mR=e=>{let t;return[...rR].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},gR=(e,t)=>Nt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),_d=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,s),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:u}=a;o=s||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return 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[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},kd=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},Kg=A.fetch,ks=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=u,g=pr(u,["url"]),v;try{v=yield Kg(c,g)}catch(R){console.error("An error has occurred when sending the event.",R);return}if(v.ok){let R=yield v.json();return R.visitorId&&o.setCurrentVisitorId(R.visitorId),R}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Kg(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.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"})}},Od=class{constructor(t,r){bd()&&eh()?this.storage=new wd:bd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new vo),this.client=new ks(t),this.beaconClient=new _d(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}},Pd=class{constructor(t,r){this.storage=r||new vo,this.client=new ks(t)}getClientDependingOnEventType(t){return this.client}},Os=class{constructor(){this.storage=new vo,this.client=new kd}getClientDependingOnEventType(t){return this.client}},hR="xx",yR=e=>e?.startsWith(hR)||!1,vR=`
|
|
27
|
+
`;return new Ci(r)}var Ci=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},At=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 i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw vC(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}},Ue=class{constructor(e={}){de(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ue(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 tt(e){return e===void 0}function SC(e){return e===null}function ue(e){return tt(e)||SC(e)}var ge=class{constructor(e={}){de(this,"value");this.value=new Ue(e)}validate(e){let t=this.value.validate(e);return t||(bC(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function bC(e){return tt(e)||Tm(e)}function Tm(e){return typeof e=="boolean"}var ne=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new Ue(e)}validate(e){let t=this.value.validate(e);return t||(AC(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 AC(e){return tt(e)||_m(e)}function _m(e){return typeof e=="number"&&!Number.isNaN(e)}var wC=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,K=class{constructor(e={}){de(this,"value");de(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Ue(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(tt(e))return null;if(!Ba(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&&!(wC.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 Ba(e){return Object.prototype.toString.call(e)==="[object String]"}var re=class{constructor(e={}){de(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(tt(e))return this.config.options.required?"value is required and is currently undefined":null;if(!km(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ue(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 km(e){return e!==void 0&&typeof e=="object"}var be=class{constructor(e={}){de(this,"config");de(this,"value");this.config=e,this.value=new Ue(this.config)}validate(e){if(!ue(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ue(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&&ue(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 Tm(e)||Ba(e)||_m(e)||km(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Om(e){return Array.isArray(e)}var zl=class{constructor(e){de(this,"config");de(this,"value");this.config=e,this.value=new Ue(e)}validate(e){let t=this.value.validate(e);return t!==null?t:tt(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();p();f();function Pm(e){return Array.isArray(e)}function Ga(e){return e.trim()===""}var CC=new Set(["1",1,"yes",!0]);function Wl(){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=>CC.has(r))}function Nm(e){let t={};for(let[r,n]of e)t[r]=n;return t}function xi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function $a(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 xC(e){if(Ga(e.openingDelimiter)||Ga(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ue(e.content)||Ga(e.content))return e.content;if(e.highlights.length===0)return no(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=no(e.content.slice(n,a)),r+=e.openingDelimiter,r+=no(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=no(e.content.slice(n))),r}function EC(e,t){return e=no(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Kl(n,t.notMatchDelimiters):o?Kl(o,t.exactMatchDelimiters):i?Kl(i,t.correctionDelimiters):r)}function Kl(e,t){return t?t.open+e+t.close:e}function no(e){let t={"&":"&","<":"<",">":">","\"":""","'":"'","`":"`"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();p();f();var Qm=Ut(Vm(),1);m();d();p();f();var zt=new Error("Failed to load reducers."),oo=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."}},sn=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}};m();d();p();f();function Bm(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Gm(e){return typeof e!="object"||!e?!1:Object.values(e).every(XC)}function XC(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function $m(e){return e===429}var Vt=class e{static call(t){return _asyncToGenerator(function*(){let r=ZC(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _s2=_asyncToGenerator(function*(){let u=yield x(i,a);if($m(u.status))throw u;return u});function s(){return _s2.apply(this,arguments)}return s}();try{let u=yield(0,Qm.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _retry=_asyncToGenerator(function*(c){let g=c&&$m(c.status);return g&&(n.info("Platform retrying request"),yield new Promise(y=>setTimeout(y,1e3))),g});function retry(_x2){return _retry.apply(this,arguments)}return retry}()});switch(u.status){case 419:case 401:throw n.info("Platform renewing token"),new oo;case 404:throw new sn(i,u.status);default:return n.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new sn(i):u}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...u}=t,c=xi(u);try{let g=yield o(t,n,a);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function Pt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function io(e,t,r="prod"){return e??Pt(t,r)}function Er(e,t="prod"){return`${Pt(e,t)}/rest/search/v2`}function Ha(e,t="prod"){return`${Pt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function ZC(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",u=JC(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:u}),signal:a}}function JC(e,t){return t==="application/x-www-form-urlencoded"?Gm(e)?Bm(e):"":JSON.stringify(e)}m();d();p();f();m();d();p();f();var za=e=>e;m();d();p();f();m();d();p();f();function Wa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Wt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Wa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Wa(),extendedResults:{},searchAction:void 0}}m();d();p();f();function Rr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var Ir=e=>{let{response:t}=e;return t.body?ex(e):tx(t)},ex=e=>nx(e)?ox(e):rx(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},tx=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function rx(e){return e.body.statusCode!==void 0}function nx(e){return e.body.exception!==void 0}var ox=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();p();f();var Tr=class{constructor(){de(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();p();f();m();d();p();f();var Ii=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}};m();d();p();f();function Hm(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();p();f();var ur=(e,t,r,n)=>{let o=new Ii(`${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 zm=/*#__PURE__*/function(){var _zm=_asyncToGenerator(function*(e,t){let r=yield Vt.call({...ur(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:Rr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Hm(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return ix(a)?{success:a}:{error:Ir({response:r,body:a})}});function zm(_x3,_x4){return _zm.apply(this,arguments)}return zm}();function ix(e){return typeof e=="string"}m();d();p();f();function ax(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function sx(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ka(e,t){if(t&&e.name==="AbortError")return{error:sx(e)};if(e instanceof sn)return{error:ax(e)};throw e}var Ya=class{constructor(t){de(this,"options",t);de(this,"apiCallsQueues",{unknown:new Tr,mainSearch:new Tr,facetValues:new Tr,foldingCollection:new Tr,instantResults:new Tr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Vt.call({...ur(t,"POST","application/json","/plan"),requestParams:Rr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Ka(r);let n=yield r.json();return ux(n)?{success:n}:{error:Ir({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Vt.call({...ur(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:Rr(t),..._this3.options});if(r instanceof Error)return Ka(r);let n=yield r.json(),o={response:r,body:n};return cx(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:Ir(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Vt.call({...ur(t,"POST","application/json",""),requestParams:Rr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Ka(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return Wm(i)?(a.body=Km(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:Ir(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Vt.call({...ur(t,"POST","application/json","/facet"),requestParams:Rr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Vt.call({...ur(t,"POST","application/json",""),requestParams:Rr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Wm(n)){let o={response:r,body:n};return o.body=Km(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:Ir({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return zm(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Vt.call({...ur(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return lx(n)?{success:n}:{error:Ir({response:r,body:n})}})()}},Xa=e=>e.success!==void 0,wt=e=>e.error!==void 0;function Wm(e){return e.results!==void 0}function Km(e){let t=Wa();return ue(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function cx(e){return e.completions!==void 0}function ux(e){return e.preprocessingOutput!==void 0}function lx(e){return e.fields!==void 0}m();d();p();f();var Ym=e=>e,Xm=e=>e,Zm=e=>e;m();d();p();f();m();d();p();f();m();d();p();f();function rt(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 dx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Jm=dx,id=()=>Math.random().toString(36).substring(7).split("").join("."),fx={INIT:`@@redux/INIT${id()}`,REPLACE:`@@redux/REPLACE${id()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${id()}`},Za=fx;function Kt(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 ad(e,t,r){if(typeof e!="function")throw new Error(rt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(rt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(rt(1));return r(ad)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,u=!1;function c(){a===i&&(a=new Map,i.forEach((E,C)=>{a.set(C,E)}))}function g(){if(u)throw new Error(rt(3));return o}function y(E){if(typeof E!="function")throw new Error(rt(4));if(u)throw new Error(rt(5));let C=!0;c();let _=s++;return a.set(_,E),function(){if(C){if(u)throw new Error(rt(6));C=!1,c(),a.delete(_),i=null}}}function R(E){if(!Kt(E))throw new Error(rt(7));if(typeof E.type>"u")throw new Error(rt(8));if(typeof E.type!="string")throw new Error(rt(17));if(u)throw new Error(rt(9));try{u=!0,o=n(o,E)}finally{u=!1}return(i=a).forEach(_=>{_()}),E}function h(E){if(typeof E!="function")throw new Error(rt(10));n=E,R({type:Za.REPLACE})}function v(){let E=y;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(rt(11));function _(){let F=C;F.next&&F.next(g())}return _(),{unsubscribe:E(_)}},[Jm](){return this}}}return R({type:Za.INIT}),{dispatch:R,subscribe:y,getState:g,replaceReducer:h,[Jm]:v}}function px(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Za.INIT})>"u")throw new Error(rt(12));if(typeof r(void 0,{type:Za.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(rt(13))})}function cn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{px(r)}catch(a){i=a}return function(s={},u){if(i)throw i;let c=!1,g={};for(let y=0;y<n.length;y++){let R=n[y],h=r[R],v=s[R],w=h(v,u);if(typeof w>"u"){let E=u&&u.type;throw new Error(rt(14))}g[R]=w,c=c||w!==v}return c=c||n.length!==Object.keys(s).length,c?g:s}}function Ti(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function eg(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(rt(15))},a={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},s=e.map(u=>u(a));return i=Ti(...s)(o.dispatch),{...o,dispatch:i}}}function _i(e){return Kt(e)&&"type"in e&&typeof e.type=="string"}m();d();p();f();var gd=Symbol.for("immer-nothing"),ki=Symbol.for("immer-draftable"),Ze=Symbol.for("immer-state");function nt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var It=Object,ln=It.getPrototypeOf,Oi="constructor",Mi="prototype",ud="configurable",rs="enumerable",es="writable",Pi="value",yt=e=>!!e&&!!e[Ze];function ft(e){return e?cg(e)||Li(e)||!!e[ki]||!!e[Oi]?.[ki]||ji(e)||co(e):!1}var mx=It[Mi][Oi].toString(),tg=new WeakMap;function cg(e){if(!e||!so(e))return!1;let t=ln(e);if(t===null||t===It[Mi])return!0;let r=It.hasOwnProperty.call(t,Oi)&&t[Oi];if(r===Object)return!0;if(!un(r))return!1;let n=tg.get(r);return n===void 0&&(n=Function.toString.call(r),tg.set(r,n)),n===mx}function hd(e){return yt(e)||nt(15,e),e[Ze].base_}function qi(e,t,r=!0){dn(e)===0?(r?Reflect.ownKeys(e):It.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function dn(e){let t=e[Ze];return t?t.type_:Li(e)?1:ji(e)?2:co(e)?3:0}var ao=(e,t,r=dn(e))=>r===2?e.has(t):It[Mi].hasOwnProperty.call(e,t),lr=(e,t,r=dn(e))=>r===2?e.get(t):e[t],ns=(e,t,r,n=dn(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function gx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Li=Array.isArray,ji=e=>e instanceof Map,co=e=>e instanceof Set,so=e=>typeof e=="object",un=e=>typeof e=="function",sd=e=>typeof e=="boolean";function hx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var yx=e=>so(e)?e?.[Ze]:null,dr=e=>e.copy_||e.base_;var yd=e=>e.modified_?e.copy_:e.base_;function ld(e,t){if(ji(e))return new Map(e);if(co(e))return new Set(e);if(Li(e))return Array[Mi].slice.call(e);let r=cg(e);if(t===!0||t==="class_only"&&!r){let n=It.getOwnPropertyDescriptors(e);delete n[Ze];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[es]===!1&&(s[es]=!0,s[ud]=!0),(s.get||s.set)&&(n[a]={[ud]:!0,[es]:!0,[rs]:s[rs],[Pi]:e[a]})}return It.create(ln(e),n)}else{let n=ln(e);if(n!==null&&r)return{...e};let o=It.create(n);return It.assign(o,e)}}function us(e,t=!1){return ls(e)||yt(e)||!ft(e)||(dn(e)>1&&It.defineProperties(e,{set:Ja,add:Ja,clear:Ja,delete:Ja}),It.freeze(e),t&&qi(e,(r,n)=>{us(n,!0)},!1)),e}function vx(){nt(2)}var Ja={[Pi]:vx};function ls(e){return e===null||!so(e)?!0:It.isFrozen(e)}var os="MapSet",is="Patches",rg="ArrayMethods",as={};function fn(e){let t=as[e];return t||nt(0,e),t}var ng=e=>!!as[e];function Sx(e,t){as[e]||(as[e]=t)}var Ni,ug=()=>Ni,bx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ng(os)?fn(os):void 0,arrayMethodsPlugin_:ng(rg)?fn(rg):void 0});function og(e,t){t&&(e.patchPlugin_=fn(is),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dd(e){fd(e),e.drafts_.forEach(Ax),e.drafts_=null}function fd(e){e===Ni&&(Ni=e.parent_)}var ig=e=>Ni=bx(Ni,e);function Ax(e){let t=e[Ze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ag(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ze].modified_&&(dd(t),nt(4)),ft(e)&&(e=sg(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ze].base_,e,t)}else e=sg(t,r);return wx(t,e,!0),dd(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gd?e:void 0}function sg(e,t){if(ls(t))return t;let r=t[Ze];if(!r)return ss(t,e.handledSet_,e);if(!ds(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);fg(r,e)}return r.copy_}function wx(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&us(t,r)}function lg(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ds=(e,t)=>e.scope_===t,Cx=[];function dg(e,t,r,n){let o=dr(e),i=e.type_;if(n!==void 0&&lr(o,n,i)===t){ns(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;qi(o,(u,c)=>{if(yt(c)){let g=s.get(c)||[];g.push(u),s.set(c,g)}})}let a=e.draftLocations_.get(t)??Cx;for(let s of a)ns(o,s,r,i)}function xx(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!ds(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=yd(i);dg(e,i.draft_??i,a,r),fg(i,o)})}function fg(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)}lg(e)}}function Ex(e,t,r){let{scope_:n}=e;if(yt(r)){let o=r[Ze];ds(o,n)&&o.callbacks_.push(function(){ts(e);let a=yd(o);dg(e,r,a,t)})}else ft(r)&&e.callbacks_.push(function(){let i=dr(e);e.type_===3?i.has(r)&&ss(r,n.handledSet_,n):lr(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ss(lr(e.copy_,t,e.type_),n.handledSet_,n)})}function ss(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||yt(e)||t.has(e)||!ft(e)||ls(e)||(t.add(e),qi(e,(n,o)=>{if(yt(o)){let i=o[Ze];if(ds(i,r)){let a=yd(i);ns(e,n,a,e.type_),lg(i)}}else ft(o)&&ss(o,t,r)})),e}function Rx(e,t){let r=Li(e),n={type_:r?1:0,scope_:t?t.scope_:ug(),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=cs;r&&(o=[n],i=Fi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var cs={get(e,t){if(t===Ze)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=dr(e);if(!ao(o,t,e.type_))return Tx(e,o,t);let i=o[t];if(e.finalized_||!ft(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&hx(t))return i;if(i===cd(e.base_,t)||Ix(e,t,i)){ts(e);let a=e.type_===1?+t:t,s=md(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in dr(e)},ownKeys(e){return Reflect.ownKeys(dr(e))},set(e,t,r){let n=pg(dr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=cd(dr(e),t),i=o?.[Ze];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if(gx(r,o)&&(r!==void 0||ao(e.base_,t,e.type_)))return!0;ts(e),pd(e)}return e.copy_[t]===r&&(r!==void 0||ao(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Ex(e,t,r)),!0},deleteProperty(e,t){return ts(e),cd(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),pd(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=dr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[es]:!0,[ud]:e.type_!==1||t!=="length",[rs]:n[rs],[Pi]:r[t]}},defineProperty(){nt(11)},getPrototypeOf(e){return ln(e.base_)},setPrototypeOf(){nt(12)}},Fi={};for(let e in cs){let t=cs[e];Fi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Fi.deleteProperty=function(e,t){return Fi.set.call(this,e,t,void 0)};Fi.set=function(e,t,r){return cs.set.call(this,e[0],t,r,e[0])};function cd(e,t){let r=e[Ze];return(r?dr(r):e)[t]}function Ix(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||!ft(r)||r[Ze]?!1:e.baseRefs_.has(r)}function Tx(e,t,r){let n=pg(t,r);return n?Pi in n?n[Pi]:n.get?.call(e.draft_):void 0}function pg(e,t){if(!(t in e))return;let r=ln(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ln(r)}}function pd(e){e.modified_||(e.modified_=!0,e.parent_&&pd(e.parent_))}function ts(e){e.copy_||(e.assigned_=new Map,e.copy_=ld(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var _x=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(un(t)&&!un(r)){let i=r;r=t;let a=this;return function(u=i,...c){return a.produce(u,g=>r.call(this,g,...c))}}un(r)||nt(6),n!==void 0&&!un(n)&&nt(7);let o;if(ft(t)){let i=ig(this),a=md(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?dd(i):fd(i)}return og(i,n),ag(o,i)}else if(!t||!so(t)){if(o=r(t),o===void 0&&(o=t),o===gd&&(o=void 0),this.autoFreeze_&&us(o,!0),n){let i=[],a=[];fn(is).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else nt(1,t)},this.produceWithPatches=(t,r)=>{if(un(t))return(a,...s)=>this.produceWithPatches(a,u=>t(u,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},sd(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),sd(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),sd(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ft(e)||nt(8),yt(e)&&(e=fs(e));let t=ig(this),r=md(t,e,void 0);return r[Ze].isManual_=!0,fd(t),r}finishDraft(e,t){let r=e&&e[Ze];(!r||!r.isManual_)&&nt(9);let{scope_:n}=r;return og(n,t),ag(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=fn(is).applyPatches_;return yt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function md(e,t,r,n){let[o,i]=ji(t)?fn(os).proxyMap_(t,r):co(t)?fn(os).proxySet_(t,r):Rx(t,r);return(r?.scope_??ug()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?xx(r,i,n):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function fs(e){return yt(e)||nt(10,e),mg(e)}function mg(e){if(!ft(e)||ls(e))return e;let t=e[Ze],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ld(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ld(e,!0);let o=r;return co(r)&&(r=new Set),qi(o,(i,a)=>{ns(r,i,mg(a))},n),t&&(t.finalized_=!1),r}function gg(){function t(v,w=[]){if(v.key_!==void 0){let E=v.parent_.copy_??v.parent_.base_,C=yx(lr(E,v.key_)),_=lr(E,v.key_);if(_===void 0||_!==v.draft_&&_!==v.copy_||C!=null&&C.base_!==v.base_)return null;let O=v.parent_.type_===3,F;if(O){let b=v.parent_;F=Array.from(b.drafts_.keys()).indexOf(v.key_)}else F=v.key_;if(!(O&&E.size>F||ao(E,F))||v.parent_.type_===1&&v.parent_.allIndicesReassigned_)return null;w.push(F)}if(v.parent_)return t(v.parent_,w);w.reverse();try{r(v.copy_,w)}catch{return null}return w}function r(v,w){let E=v;for(let C=0;C<w.length-1;C++){let _=w[C];if(E=lr(E,_),!so(E)||E===null)throw new Error(`Cannot resolve path at '${w.join("/")}'`)}return E}let n="replace",o="add",i="remove";function a(v,w,E){if(v.scope_.processedForPatches_.has(v))return;v.scope_.processedForPatches_.add(v);let{patches_:C,inversePatches_:_}=E;switch(v.type_){case 0:case 2:return u(v,w,C,_);case 1:return s(v,w,C,_);case 3:return c(v,w,C,_)}}function s(v,w,E,C){let{base_:_,assigned_:O}=v,F=v.copy_;F.length<_.length&&([_,F]=[F,_],[E,C]=[C,E]);let b=v.allIndicesReassigned_===!0;for(let T=0;T<_.length;T++){let k=F[T],P=_[T];if((b||O?.get(T.toString()))&&k!==P){let M=k?.[Ze];if(M&&M.modified_)continue;let Q=w.concat([T]);E.push({op:n,path:Q,value:h(k)}),C.push({op:n,path:Q,value:h(P)})}}for(let T=_.length;T<F.length;T++){let k=w.concat([T]);E.push({op:o,path:k,value:h(F[T])})}for(let T=F.length-1;_.length<=T;--T){let k=w.concat([T]);C.push({op:i,path:k})}}function u(v,w,E,C){let{base_:_,copy_:O,type_:F}=v;qi(v.assigned_,(b,T)=>{let k=lr(_,b,F),P=lr(O,b,F),N=T?ao(_,b)?n:o:i;if(k===P&&N===n)return;let M=w.concat(b);E.push(N===i?{op:N,path:M}:{op:N,path:M,value:h(P)}),C.push(N===o?{op:i,path:M}:N===i?{op:o,path:M,value:h(k)}:{op:n,path:M,value:h(k)})})}function c(v,w,E,C){let{base_:_,copy_:O}=v,F=0;_.forEach(b=>{if(!O.has(b)){let T=w.concat([F]);E.push({op:i,path:T,value:b}),C.unshift({op:o,path:T,value:b})}F++}),F=0,O.forEach(b=>{if(!_.has(b)){let T=w.concat([F]);E.push({op:o,path:T,value:b}),C.unshift({op:i,path:T,value:b})}F++})}function g(v,w,E){let{patches_:C,inversePatches_:_}=E;C.push({op:n,path:[],value:w===gd?void 0:w}),_.push({op:n,path:[],value:v})}function y(v,w){return w.forEach(E=>{let{path:C,op:_}=E,O=v;for(let k=0;k<C.length-1;k++){let P=dn(O),N=C[k];typeof N!="string"&&typeof N!="number"&&(N=""+N),(P===0||P===1)&&(N==="__proto__"||N===Oi)&&nt(19),un(O)&&N===Mi&&nt(19),O=lr(O,N),(O===null||!so(O))&&nt(18,C.join("/"))}let F=dn(O),b=R(E.value),T=C[C.length-1];switch(_){case n:switch(F){case 2:return O.set(T,b);case 3:nt(16);default:return O[T]=b}case o:switch(F){case 1:return T==="-"?O.push(b):O.splice(T,0,b);case 2:return O.set(T,b);case 3:return O.add(b);default:return O[T]=b}case i:switch(F){case 1:return O.splice(T,1);case 2:return O.delete(T);case 3:return O.delete(E.value);default:return delete O[T]}default:nt(17,_)}}),v}function R(v){if(!ft(v))return v;if(Li(v))return v.map(R);if(ji(v))return new Map(Array.from(v.entries()).map(([E,C])=>[E,R(C)]));if(co(v))return new Set(Array.from(v).map(R));let w=Object.create(ln(v));for(let E in v)w[E]=R(v[E]);return ao(v,ki)&&(w[ki]=v[ki]),w}function h(v){return yt(v)?R(v):v}Sx(is,{applyPatches_:y,generatePatches_:a,generateReplacementPatches_:g,getPath:t})}var kx=A.Iterator,EL=typeof kx?.from=="function";var Di=new _x,pn=Di.produce,hg=Di.produceWithPatches.bind(Di);var vd=Di.applyPatches.bind(Di);m();d();p();f();var Ox=class{constructor(e){this.value=e}deref(){return this.value}},Px=()=>typeof WeakRef>"u"?Ox:WeakRef,vg=Px(),Nx=0,ps=1;function Ui(){return{s:Nx,v:void 0,o:null,p:null}}function Fx(e){return e instanceof vg?e.deref():e}function uo(e,t={}){let r=Ui(),{resultEqualityCheck:n,maxSize:o}=t,i=o!==void 0;if(i&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let a=null,s=0,u,c=0,g=!1;function y(){s>=o&&(a=r,r=Ui(),s=0)}function R(){let h=r,{length:v}=arguments;for(let C=0,_=v;C<_;C++){let O=arguments[C];if(typeof O=="function"||typeof O=="object"&&O!==null){let F=h.o;F===null&&(h.o=F=new WeakMap);let b=F.get(O);b===void 0?(h=Ui(),F.set(O,h)):h=b}else{let F=h.p;F===null&&(h.p=F=new Map);let b=F.get(O);b===void 0?(h=Ui(),F.set(O,h),s++):h=b}}if(h.s===ps)return h.v;if(a!==null){let C=a;for(let _=0,O=v;_<O;_++){let F=arguments[_],b;if(typeof F=="function"||typeof F=="object"&&F!==null){let T=C.o;b=T!==null?T.get(F):void 0}else{let T=C.p;b=T!==null?T.get(F):void 0}if(b===void 0){C=null;break}C=b}if(C!==null&&C.s===ps){let _=h;return _.s=ps,_.v=C.v,y(),C.v}}let w=h,E=e.apply(null,arguments);if(c++,n){let C=Fx(u);C!=null&&n(C,E)&&(E=C,c!==0&&c--),u=typeof E=="object"&&E!==null||typeof E=="function"?new vg(E):E}return w.s=ps,w.v=E,i&&y(),E}return R.clearCache=()=>{r=Ui(),a=null,s=0,R.resetResultsCount()},R.resultsCount=()=>c,R.resetResultsCount=()=>{c=0},R}var Sd=Symbol("NOT_FOUND");function Dx(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Mx(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 yg=e=>Array.isArray(e)?e:[e];function qx(e){let t=Array.isArray(e[0])?e[0]:e;return Mx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ms(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),Dx(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...r,...u},{memoize:y,memoizeOptions:R=[],argsMemoize:h=uo,argsMemoizeOptions:v=[]}=g,w=yg(R),E=yg(v),C=qx(o),_=y(function(){return i++,c.apply(null,arguments)},...w),O=!0,F=h(function(){a++;let{length:T}=C,k=new Array(T);for(let P=0;P<T;P++)k[P]=C[P].apply(null,arguments);return s=_.apply(null,k),s},...E);return Object.assign(F,{resultFunc:c,memoizedResultFunc:_,dependencies:C,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:y,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Ye=ms(uo);function Lx(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Sd},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 jx(e,t){let r=[];function n(s){let u=r.findIndex(c=>t(c.key,s));if(u>-1){let c=r[u];return u>0&&(r.splice(u,1),r.unshift(c)),c.value}return Sd}function o(s,u){r.unshift({key:s,value:u}),r.length>e&&r.pop()}function i(s,u){let c=r,{length:g}=c;for(let y=0;y<g;y++){let R=c[y];if(u(R.value,s))return R}}function a(){r=[]}return{get:n,put:o,findMatchingEntry:i,clear:a}}var Ux=(e,t)=>e===t;function Vx(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 bd(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=Ux,maxSize:o=1,resultEqualityCheck:i}=r,a=Vx(n),s=0,u=o<=1?Lx(a):jx(o,a);function c(){let g=u.get(arguments);if(g===Sd){if(g=e.apply(null,arguments),s++,i){let y=u.findMatchingEntry(g,i);y&&(g=y.value,s!==0&&s--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}m();d();p();f();function Sg(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var bg=Sg(),Ag=Sg;var Bx=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ti:Ti.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Gx=e=>e&&typeof e.match=="function";function q(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(pt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>n!=null&&n.type===e&&_i(n),r}var _g=class Vi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Vi.prototype)}static get[Symbol.species](){return Vi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Vi(...t[0].concat(this)):new Vi(...t.concat(this))}};function wg(e){return ft(e)?pn(e,()=>{}):e}function gs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function $x(e){return typeof e=="boolean"}var Qx=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new _g;return r&&($x(r)?a.push(bg):a.push(Ag(r.extraArgument))),a},Bi="RTK_autoBatch",po=()=>e=>({payload:e,meta:{[Bi]:!0}}),Cg=e=>t=>{setTimeout(t,e)},Hx=(e,t,r)=>n=>{let o=!1,i,a,s=()=>{o||(o=!0,t?.(i),clearTimeout(a),n())};i=e(s),a=setTimeout(s,r)},zx=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Hx(window.requestAnimationFrame,window.cancelAnimationFrame,100):Cg(10):e.type==="callback"?e.queueNotification:Cg(e.timeout),c=()=>{a=!1,i&&(i=!1,s.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let y=()=>o&&g(),R=n.subscribe(y);return s.add(g),()=>{R(),s.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Bi],i=!o,i&&(a||(a=!0,u(c))),n.dispatch(g)}finally{o=!0}}})},Wx=e=>function(r){let{autoBatch:n=!0}=r??{},o=new _g(e);return n&&o.push(zx(typeof n=="object"?n:void 0)),o};function kg(e){let t=Qx(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},u;if(typeof r=="function")u=r;else if(Kt(r))u=cn(r);else throw new Error(pt(1));let c;typeof n=="function"?c=n(t):c=t();let g=Ti;o&&(g=Bx({trace:!1,...(typeof o=="object"&&o)}));let y=eg(...c),R=Wx(y),h=typeof s=="function"?s(R):R(),v=g(...h);return ad(u,a,v)}function Og(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(pt(28));if(s in t)throw new Error(pt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function Kx(e){return typeof e=="function"}function Qe(e,t){let[r,n,o]=Og(t),i;if(Kx(e))i=()=>wg(e());else{let u=wg(e);i=()=>u}function a(u,c,g){if(yt(u)){let y=c(u,g);return y===void 0?u:y}else{if(ft(u))return pn(u,y=>c(y,g));{let y=c(u,g);if(y===void 0){if(u===null)return u;throw new Error(pt(9))}return y}}}function s(u=i(),c){let g=r[c.type],y;for(let{matcher:R,reducer:h}of n)R(c)&&h&&(y??(y=[])).push(h);if(!g&&!y)return o?a(u,o,c):u;if(g&&(u=a(u,g,c)),y)for(let R of y)u=a(u,R,c);return u}return s.getInitialState=i,s}var Pg=(e,t)=>Gx(e)?e.match(t):e(t);function Yt(...e){return t=>e.some(r=>Pg(r,t))}function fo(...e){return t=>e.every(r=>Pg(r,t))}function Ss(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 Gi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function bs(...e){return e.length===0?t=>Ss(t,["pending"]):Gi(e)?Yt(...e.map(t=>t.pending)):bs()(e[0])}function gn(...e){return e.length===0?t=>Ss(t,["rejected"]):Gi(e)?Yt(...e.map(t=>t.rejected)):gn()(e[0])}function mo(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?fo(gn(...e),t):Gi(e)?fo(gn(...e),t):mo()(e[0])}function fr(...e){return e.length===0?t=>Ss(t,["fulfilled"]):Gi(e)?Yt(...e.map(t=>t.fulfilled)):fr()(e[0])}function As(...e){return e.length===0?t=>Ss(t,["pending","fulfilled","rejected"]):Gi(e)?Yt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):As()(e[0])}var Yx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",$i=(e=21)=>{let t="",r=e;for(;r--;)t+=Yx[Math.random()*64|0];return t},Xx=["name","message","stack","code"],Ad=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},xg=class{constructor(e,t){de(this,"payload");de(this,"meta");de(this,"_type");this.payload=e,this.meta=t}},Zx=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of Xx)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Eg="External signal was aborted",Fe=(()=>{function e(t,r,n){let o=q(t+"/fulfilled",(u,c,g,y)=>({payload:u,meta:{...(y||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=q(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),a=q(t+"/rejected",(u,c,g,y,R)=>({payload:y,error:(n&&n.serializeError||Zx)(u||"Rejected"),meta:{...(R||{}),arg:g,requestId:c,rejectedWithValue:y!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function s(u,{signal:c}={}){return(g,y,R)=>{let h=n?.idGenerator?n.idGenerator(u):$i(),v=new l.AbortController,w,E;function C(O){E=O,v.abort()}c&&(c.aborted?C(Eg):c.addEventListener("abort",()=>C(Eg),{once:!0}));let _=_asyncToGenerator(function*(){let O;try{let F=n?.condition?.(u,{getState:y,extra:R});if(eE(F)&&(F=yield F),F===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(v.signal.aborted)throw{name:"AbortError",message:E||"Aborted"};let b=new Promise((T,k)=>{w=()=>{k({name:"AbortError",message:E||"Aborted"})},v.signal.addEventListener("abort",w,{once:!0})});g(i(h,u,n?.getPendingMeta?.({requestId:h,arg:u},{getState:y,extra:R}))),O=yield Promise.race([b,Promise.resolve(r(u,{dispatch:g,getState:y,extra:R,requestId:h,signal:v.signal,abort:C,rejectWithValue:(T,k)=>new Ad(T,k),fulfillWithValue:(T,k)=>new xg(T,k)})).then(T=>{if(T instanceof Ad)throw T;return T instanceof xg?o(T.payload,h,u,T.meta):o(T,h,u)})])}catch(F){O=F instanceof Ad?a(null,h,u,F.payload,F.meta):a(F,h,u)}finally{w&&v.signal.removeEventListener("abort",w)}return n&&!n.dispatchConditionRejection&&a.match(O)&&O.meta.condition||g(O),O})();return Object.assign(_,{abort:C,requestId:h,arg:u,unwrap(){return _.then(Jx)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Yt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function Jx(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function eE(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var tE=Symbol.for("rtk-slice-createasyncthunk");function rE(e,t){return`${e}/${t}`}function nE({creators:e}={}){let t=e?.asyncThunk?.[tE];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(pt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(iE()):n.reducers)||{},s=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(O,F){let b=typeof O=="string"?O:O.type;if(!b)throw new Error(pt(12));if(b in u.sliceCaseReducersByType)throw new Error(pt(13));return u.sliceCaseReducersByType[b]=F,c},addMatcher(O,F){return u.sliceMatchers.push({matcher:O,reducer:F}),c},exposeAction(O,F){return u.actionCreators[O]=F,c},exposeCaseReducer(O,F){return u.sliceCaseReducersByName[O]=F,c}};s.forEach(O=>{let F=a[O],b={reducerName:O,type:rE(o,O),createNotation:typeof n.reducers=="function"};sE(F)?uE(b,F,c,t):aE(b,F,c)});function g(){let[O={},F=[],b=void 0]=typeof n.extraReducers=="function"?Og(n.extraReducers):[n.extraReducers],T={...O,...u.sliceCaseReducersByType};return Qe(n.initialState,k=>{for(let P in T)k.addCase(P,T[P]);for(let P of u.sliceMatchers)k.addMatcher(P.matcher,P.reducer);for(let P of F)k.addMatcher(P.matcher,P.reducer);b&&k.addDefaultCase(b)})}let y=O=>O,R=new Map,h=new WeakMap,v;function w(O,F){return v||(v=g()),v(O,F)}function E(){return v||(v=g()),v.getInitialState()}function C(O,F=!1){function b(k){let P=k[O];return typeof P>"u"&&F&&(P=gs(h,b,E)),P}function T(k=y){return gs(gs(R,F,()=>new WeakMap),k,()=>{let P={};for(let[N,M]of Object.entries(n.selectors??{}))P[N]=oE(M,k,()=>gs(h,k,E),F);return P})}return{reducerPath:O,getSelectors:T,get selectors(){return T(b)},selectSlice:b}}let _={name:o,reducer:w,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:E,...C(i),injectInto(O,{reducerPath:F,...b}={}){let T=F??i;return O.inject({reducerPath:T,reducer:w},b),{..._,...C(T,!0)}}};return _}}function oE(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var hn=nE();function iE(){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 aE({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!cE(n))throw new Error(pt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?q(e,a):q(e))}function sE(e){return e._reducerDefinitionType==="asyncThunk"}function cE(e){return e._reducerDefinitionType==="reducerWithPrepare"}function uE({type:e,reducerName:t},r,n,o){if(!o)throw new Error(pt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:u,settled:c,options:g}=r,y=o(e,i,g);n.exposeAction(t,y),a&&n.addCase(y.fulfilled,a),s&&n.addCase(y.pending,s),u&&n.addCase(y.rejected,u),c&&n.addMatcher(y.settled,c),n.exposeCaseReducer(t,{fulfilled:a||hs,pending:s||hs,rejected:u||hs,settled:c||hs})}function hs(){}var lE="task",Ng="listener",Fg="completed",xd="cancelled",dE=`task-${xd}`,fE=`task-${Fg}`,wd=`${Ng}-${xd}`,pE=`${Ng}-${Fg}`,ws=class{constructor(e){de(this,"code");de(this,"name","TaskAbortError");de(this,"message");this.code=e,this.message=`${lE} ${xd} (reason: ${e})`}},Ed=(e,t)=>{if(typeof e!="function")throw new TypeError(pt(32))},ys=()=>{},Rd=(e,t=ys)=>(e.catch(t),e),Dg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),mn=e=>{if(e.aborted)throw new ws(e.reason)};function Mg(e,t){let r=ys;return new Promise((n,o)=>{let i=()=>o(new ws(e.reason));if(e.aborted){i();return}r=Dg(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=ys})}var mE=/*#__PURE__*/function(){var _mE=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ws?"cancelled":"rejected",error:r}}finally{t?.()}});function mE(_x5,_x6){return _mE.apply(this,arguments)}return mE}(),vs=e=>t=>Rd(Mg(e,t).then(r=>(mn(e),r))),qg=e=>{let t=vs(e);return r=>{let n;return Rd(t(new Promise(o=>{n=setTimeout(o,r)})).finally(()=>clearTimeout(n)))}},{assign:lo}=Object,Rg={},Cs="listenerMiddleware",gE=(e,t)=>{let r=n=>Dg(e,()=>n.abort(e.reason));return(n,o)=>{Ed(n,"taskExecutor");let i=new l.AbortController;r(i);let a=mE(/*#__PURE__*/_asyncToGenerator(function*(){mn(e),mn(i.signal);let s=yield n({pause:vs(i.signal),delay:qg(i.signal),signal:i.signal});return mn(i.signal),s}),()=>i.abort(fE));return o?.autoJoin&&t.push(a.catch(ys)),{result:vs(e)(a),cancel(){i.abort(dE)}}}},hE=(e,t)=>{let r=/*#__PURE__*/function(){var _r2=_asyncToGenerator(function*(n,o){mn(t);let i=()=>{},a=[new Promise((u,c)=>{let g=e({predicate:n,effect:(y,R)=>{R.unsubscribe(),u([y,R.getState(),R.getOriginalState()])}});i=()=>{g(),c()}})],s;o!=null&&a.push(new Promise(u=>{s=setTimeout(u,o,null)}));try{let u=yield Mg(t,Promise.race(a));return mn(t),u}finally{clearTimeout(s),i()}});function r(_x7,_x8){return _r2.apply(this,arguments)}return r}();return(n,o)=>Rd(r(n,o))},Lg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=q(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(pt(21));return Ed(i,"options.listener"),{predicate:o,type:t,effect:i}},jg=lo(e=>{let{type:t,predicate:r,effect:n}=Lg(e);return{id:$i(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(pt(22))}}},{withTypes:()=>jg}),Ig=(e,t)=>{let{type:r,effect:n,predicate:o}=Lg(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Cd=e=>{e.pending.forEach(t=>{t.abort(wd)})},yE=(e,t)=>()=>{for(let r of t.keys())Cd(r);e.clear()},Tg=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Ug=lo(q(`${Cs}/add`),{withTypes:()=>Ug}),vE=q(`${Cs}/removeAll`),Vg=lo(q(`${Cs}/remove`),{withTypes:()=>Vg}),SE=(...e)=>{console.error(`${Cs}/error`,...e)},Bg=(e={})=>{let t=new Map,r=new Map,n=C=>{let _=r.get(C)??0;r.set(C,_+1)},o=C=>{let _=r.get(C)??1;_===1?r.delete(C):r.set(C,_-1)},{extra:i,onError:a=SE}=e;Ed(a,"onError");let s,u=()=>{if(!s){let C=Array.from(t.values()),_=new Set,O=!1;for(let F of C)typeof F.type=="string"?_.add(F.type):O=!0;s={entries:C,types:_,anyType:O}}return s},c=C=>{t.has(C.id)||(t.set(C.id,C),s=void 0)},g=C=>(C.unsubscribe=()=>{t.delete(C.id)&&(s=void 0)},c(C),_=>{C.unsubscribe(),_?.cancelActive&&Cd(C)}),y=C=>{let _=Ig(t,C)??jg(C);return g(_)};lo(y,{withTypes:()=>y});let R=C=>{let _=Ig(t,C);return _&&(_.unsubscribe(),C.cancelActive&&Cd(_)),!!_};lo(R,{withTypes:()=>R});let h=/*#__PURE__*/function(){var _h2=_asyncToGenerator(function*(C,_,O,F){let b=new l.AbortController,T=hE(y,b.signal),k=[];try{C.pending.add(b),n(C),yield Promise.resolve(C.effect(_,lo({},O,{getOriginalState:F,condition:(P,N)=>T(P,N).then(Boolean),take:T,delay:qg(b.signal),pause:vs(b.signal),extra:i,signal:b.signal,fork:gE(b.signal,k),unsubscribe:C.unsubscribe,subscribe:()=>{c(C)},cancelActiveListeners:()=>{C.pending.forEach((P,N,M)=>{P!==b&&(P.abort(wd),M.delete(P))})},cancel:()=>{b.abort(wd),C.pending.delete(b)},throwIfCancelled:()=>{mn(b.signal)}})))}catch(P){P instanceof ws||Tg(a,P,{raisedBy:"effect"})}finally{yield Promise.all(k),b.abort(pE),o(C),C.pending.delete(b)}});function h(_x9,_x0,_x1,_x10){return _h2.apply(this,arguments)}return h}(),v=yE(t,r),w=()=>{v(),s=void 0};return{middleware:C=>_=>O=>{if(!_i(O))return _(O);if(Ug.match(O))return y(O.payload);if(vE.match(O)){w();return}if(Vg.match(O))return R(O.payload);let F=C.getState(),b=()=>{if(F===Rg)throw new Error(pt(23));return F},T;try{T=_(O);let{entries:k,types:P,anyType:N}=u();if(N||P.has(O.type)){let M=C.getState();for(let Q of k){if(typeof Q.type=="string"&&Q.type!==O.type)continue;let U=!1;try{U=Q.predicate(O,M,F)}catch(L){U=!1,Tg(a,L,{raisedBy:"predicate"})}U&&h(Q,O,C,b)}}}finally{F=Rg}return T},startListening:y,stopListening:R,clearListeners:w}};function pt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();p();f();var X=new K({required:!0,emptyAllowed:!1}),ot=new K({required:!1,emptyAllowed:!1}),it=new K({required:!0,emptyAllowed:!0}),oj=new K({required:!1,emptyAllowed:!0}),xs=new be({each:X,required:!0}),Gg=new K({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),$g=new K({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),ij=new K({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),pr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Nt=(e,t)=>{if("required"in t)return{payload:new At({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new Ci(o);return{payload:e}},$=(e,t)=>{try{return Nt(e,t)}catch(r){return{payload:e,error:pr(r)}}},Qg=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return zg(e,t,r,o,"Controller initialization error")},Hg=(e,t,r,n)=>{let o=`Check the options of ${n}`;return zg(e,t,r,o,"Controller initialization error")},zg=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();p();f();var go="3.59.0",Wg=["@coveo/atomic","@coveo/quantic"];var Id=()=>ot,Kg=()=>X,_r=q("configuration/updateBasicConfiguration",e=>$(e,{accessToken:ot,environment:new K({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:ot})),Xt=q("configuration/updateSearchConfiguration",e=>$(e,{proxyBaseUrl:new K({required:!1,url:!0}),pipeline:new K({required:!1,emptyAllowed:!0}),searchHub:ot,timezone:ot,locale:ot,authenticationProviders:new be({required:!1,each:X})})),bE={enabled:new ge({default:!0}),originContext:Id(),originLevel2:Id(),originLevel3:Id(),proxyBaseUrl:new K({required:!1,url:!0}),runtimeEnvironment:new Ue,anonymous:new ge({default:!1}),deviceId:ot,userDisplayName:ot,documentLocation:ot,trackingId:$g,analyticsMode:new K({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Wg.reduce((e,t)=>(e[t]=Gg,e),{})})},ho=q("configuration/updateAnalyticsConfiguration",e=>$(e,bE)),yo=q("configuration/analytics/disable"),vo=q("configuration/analytics/enable"),Es=q("configuration/analytics/originlevel2",e=>$(e,{originLevel2:Kg()})),Rs=q("configuration/analytics/originlevel3",e=>$(e,{originLevel3:Kg()})),Yg=q("knowledge/setAgentId",e=>$(e,new K({required:!0})));m();d();p();f();m();d();p();f();m();d();p();f();var Xg={q:new K,enableQuerySyntax:new ge,aq:new K,cq:new K,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new K,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new ge,sf:new re,tab:new K,af:new re};var kr=q("searchParameters/restore",e=>$(e,Xg)),Zg=q("searchParameters/restoreTab",e=>$(e,X));m();d();p();f();var Is=q("debug/enable"),Ts=q("debug/disable");m();d();p();f();var _s=()=>!1;var ks=Qe(_s(),e=>{e.addCase(Is,()=>!0).addCase(Ts,()=>!1).addCase(kr,(t,r)=>r.payload.debug??t)});m();d();p();f();var So=q("pipeline/set",e=>$(e,new K({required:!0,emptyAllowed:!0})));m();d();p();f();m();d();p();f();var AE=q("history/undo"),wE=q("history/redo"),Zt=q("history/snapshot"),mU=Fe("history/back",/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,{dispatch:t}){t(AE()),yield t(Ct())});return function(_x11,_x12){return _ref3.apply(this,arguments)}}()),gU=Fe("history/forward",/*#__PURE__*/function(){var _ref4=_asyncToGenerator(function*(e,{dispatch:t}){t(wE()),yield t(Ct())});return function(_x13,_x14){return _ref4.apply(this,arguments)}}()),Ct=Fe("history/change",/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref5.apply(this,arguments)}}());m();d();p();f();var Or=()=>"";var bo=Qe(Or(),e=>{e.addCase(So,(t,r)=>r.payload).addCase(Ct.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Xt,(t,r)=>r.payload.pipeline||t)});m();d();p();f();m();d();p();f();var Os=q("app/setError");m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function CE(){return typeof navigator<"u"}function Jg(){try{return typeof localStorage<"u"}catch{return!1}}function eh(){try{return typeof sessionStorage<"u"}catch{return!1}}function th(){return CE()&&navigator.cookieEnabled}m();d();p();f();var yn=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Td(t,r,o,xE(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 xE(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(EE(n))return n}}function EE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Td(t,"1",void 0,e),yn.get(t)==="1"}catch{return!1}finally{try{Td(t,"",new Date(0),e)}catch{}}}function Td(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function rh(){return Jg()?localStorage:th()?new Ps:eh()?sessionStorage:new _d}var Ps=class e{getItem(t){return yn.get(`${e.prefix}${t}`)}removeItem(t){yn.erase(`${e.prefix}${t}`)}setItem(t,r,n){yn.set(`${e.prefix}${t}`,r,n)}};Ps.prefix="coveo_";var _d=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ns="__coveo.analytics.history",RE=20,IE=1e3*60,TE=75,Fs=class{constructor(t){this.store=t||rh()}addElement(t){t.internalTime=(new Date).getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=(new Date).getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ns);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Ns);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ns,JSON.stringify(t.slice(0,RE)))}catch{}}clear(){try{this.store.removeItem(Ns)}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,TE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>IE:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var vn=class vn extends Fs{static getInstance(t){return vn.instance||(vn.instance=new vn(t)),vn.instance}constructor(t){super(t)}};de(vn,"instance",null);var vt=vn;m();d();p();f();m();d();p();f();var Ao=Ye(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${go}`));m();d();p();f();m();d();p();f();function mr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function G(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(y){a(y)}}function u(g){try{c(n.throw(g))}catch(y){a(y)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}var Ce;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ce||(Ce={}));function Pd(){return typeof window<"u"}function Hd(){return typeof navigator<"u"}function wo(){return typeof document<"u"}function Nd(){try{return typeof localStorage<"u"}catch{return!1}}function _E(){try{return typeof sessionStorage<"u"}catch{return!1}}function mh(){return Hd()&&navigator.cookieEnabled}var kE=[Ce.click,Ce.custom,Ce.search,Ce.view],OE=(e,t)=>kE.indexOf(e)!==-1?Object.assign({language:wo()?document.documentElement.lang:"unknown",userAgent:Hd()?navigator.userAgent:"unknown"},t):t,Co=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Fd(t,r,o,PE(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 PE(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(NE(n))return n}}function NE(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Fd(t,"1",void 0,e),Co.get(t)==="1"}catch{return!1}finally{try{Fd(t,"",new Date(0),e)}catch{}}}function Fd(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function FE(){return Nd()?localStorage:mh()?new Hi:_E()?sessionStorage:new Eo}var Hi=class e{getItem(t){return Co.get(`${e.prefix}${t}`)}removeItem(t){Co.erase(`${e.prefix}${t}`)}setItem(t,r,n){Co.set(`${e.prefix}${t}`,r,n)}};Hi.prefix="coveo_";var Dd=class{constructor(){this.cookieStorage=new Hi}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)}},Eo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Ds="__coveo.analytics.history",DE=20,ME=1e3*60,qE=75,qs=class{constructor(t){this.store=t||FE()}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(Ds);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(Ds);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Ds,JSON.stringify(t.slice(0,DE)))}catch{}}clear(){try{this.store.removeItem(Ds)}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,qE)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>ME:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time: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 LE=(e,t)=>G(void 0,void 0,void 0,function*(){return e===Ce.view?(yield jE(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),jE=e=>G(void 0,void 0,void 0,function*(){let t=new qs,r={name:"PageView",value:e,time:(new Date).toISOString()};yield t.addElementAsync(r)}),UE=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Ls(e){return typeof e=="string"&&UE.test(e)}function nh(e){if(!Ls(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 at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function gh(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}var VE=new Uint8Array(16);function BE(){return crypto.getRandomValues(VE)}function GE(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 $E="6ba7b810-9dad-11d1-80b4-00c04fd430c8",QE="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function HE(e,t,r,n,o,i){let a=typeof r=="string"?GE(r):r,s=typeof n=="string"?nh(n):n;if(typeof n=="string"&&(n=nh(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);return u.set(s),u.set(a,s.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,gh(u)}function Sn(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():zE(e,t,r)}function zE(e,t,r){e=e||{};let n=e.random??e.rng?.()??BE();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 gh(n)}function WE(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 kd(e,t){return e<<t|e>>>32-t}function KE(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[s*64+c*4]<<24|e[s*64+c*4+1]<<16|e[s*64+c*4+2]<<8|e[s*64+c*4+3];a[s]=u}a[i-1][14]=(e.length-1)*8/2**32,a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let u=new Uint32Array(80);for(let v=0;v<16;++v)u[v]=a[s][v];for(let v=16;v<80;++v)u[v]=kd(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);let c=r[0],g=r[1],y=r[2],R=r[3],h=r[4];for(let v=0;v<80;++v){let w=Math.floor(v/20),E=kd(c,5)+WE(w,g,y,R)+h+t[w]+u[v]>>>0;h=R,R=y,y=kd(g,30)>>>0,g=c,c=E}r[0]=r[0]+c>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+R>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function js(e,t,r,n){return HE(80,KE,e,t)}js.DNS=$E;js.URL=QE;var hh="2.33.1",oh=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Qi={pageview:"pageview",event:"event"},Us=class{constructor({client:t,uuidGenerator:r=Sn}){this.client=t,this.uuidGenerator=r}},Md=class extends Us{constructor({client:t,uuidGenerator:r=Sn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=oh(window.location),this.lastReferrer=wo()?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:wo()?document.title:"",encoding:wo()?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===Qi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Qi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Qi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Qi.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 oh(window.location)}},Pr=class e{constructor(t,r){if(!Ls(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 Ls(i)?new e(i,Number.parseInt(o)*1e3):null}};Pr.cvo_cid="cvo_cid";Pr.expirationTime=120;var qd=class extends Us{constructor({client:t,uuidGenerator:r=Sn}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return 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(Pr.cvo_cid,new Pr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};qd.Id="link";var Dt=Object.keys;function Ms(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Od=128,yh=192,ih=224,ah=240;function YE(e){return(e&248)===ah?4:(e&ah)===ih?3:(e&ih)===yh?2:1}function XE(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Od)!=Od)break;if(r-=3,(n&yh)!=Od){t-r>=YE(n)*3&&(r=t);break}}return e.substring(0,r)}var Ld={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"},ZE=Dt(Ld).map(e=>Ld[e]),JE=[...ZE].join("|"),eR=new RegExp(`^(${JE}$)`),tR={svcAction:"svc_action",svcActionData:"svc_action_data"},rR=e=>Dt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Ld[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),nR=e=>eR.test(e),oR=[nR],sh={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},ch={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},mt={action:"pa",list:"pal",listSource:"pls"},Vs={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},iR=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],jd={id:"quoteId",affiliation:"quoteAffiliation"},Ud={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},aR={add:mt,bookmark_add:mt,bookmark_remove:mt,click:mt,checkout:mt,checkout_option:mt,detail:mt,impression:mt,remove:mt,refund:Object.assign(Object.assign({},mt),Vs),purchase:Object.assign(Object.assign({},mt),Vs),quickview:mt,quote:Object.assign(Object.assign({},mt),jd),review:Object.assign(Object.assign({},mt),Ud)},sR=Dt(sh).map(e=>sh[e]),cR=Dt(ch).map(e=>ch[e]),uR=Dt(mt).map(e=>mt[e]),lR=Dt(Vs).map(e=>Vs[e]),dR=Dt(Ud).map(e=>Ud[e]),fR=Dt(jd).map(e=>jd[e]),pR=[...sR,"custom"].join("|"),mR=[...cR,"custom"].join("|"),vh="(pr[0-9]+)",Sh="(il[0-9]+pi[0-9]+)",gR=new RegExp(`^${vh}(${pR})$`),hR=new RegExp(`^(${Sh}(${mR}))|(il[0-9]+nm)$`),yR=new RegExp(`^(${uR.join("|")})$`),vR=new RegExp(`^(${lR.join("|")})$`),SR=new RegExp(`^${vh}custom$`),bR=new RegExp(`^${Sh}custom$`),AR=new RegExp(`^(${[...iR,...dR,...fR].join("|")})$`),wR=e=>gR.test(e),CR=e=>hR.test(e),xR=e=>yR.test(e),ER=e=>vR.test(e),RR=e=>AR.test(e),IR=[CR,wR,xR,ER,RR],TR=[SR,bR],_R={anonymizeIp:"aip"},kR={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},OR={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},PR=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],NR=Object.assign(Object.assign(Object.assign(Object.assign({},_R),kR),OR),PR.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Vd=Object.assign(Object.assign({},NR),tR),FR=e=>{let t=!!e.action&&aR[e.action]||{};return Dt(e).reduce((r,n)=>{let o=t[n]||Vd[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},DR=Dt(Vd).map(e=>Vd[e]),MR=e=>DR.indexOf(e)!==-1,qR=e=>e==="custom",LR=e=>[...IR,...oR,MR,qR].some(t=>t(e)),jR=e=>Dt(e).reduce((t,r)=>{let n=UR(r);return n?Object.assign(Object.assign({},t),VR(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),UR=e=>{let t;return[...TR].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},VR=(e,t)=>Dt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Bd=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),u=this.encodeForEventType(t,s),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return G(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:u}=a;o=s||t;try{i=JSON.parse(u)}catch(c){console.error("Unable to process the request body as a JSON string",c)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return G(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Gd=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()})}},uh=A.fetch,Bs=class{constructor(t){this.opts=t}sendEvent(t,r){return G(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},u=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:c}=u,g=mr(u,["url"]),y;try{y=yield uh(c,g)}catch(R){console.error("An error has occurred when sending the event.",R);return}if(y.ok){let R=yield y.json();return R.visitorId&&o.setCurrentVisitorId(R.visitorId),R}else{try{y.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,y,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 uh(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ce.click,Ce.custom,Ce.search,Ce.view].indexOf(t)!==-1}getVisitorIdParam(){return G(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},$d=class{constructor(t,r){Nd()&&mh()?this.storage=new Dd:Nd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Eo),this.client=new Bs(t),this.beaconClient=new Bd(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}},Qd=class{constructor(t,r){this.storage=r||new Eo,this.client=new Bs(t)}getClientDependingOnEventType(t){return this.client}},Gs=class{constructor(){this.storage=new Eo,this.client=new Gd}getClientDependingOnEventType(t){return this.client}},BR="xx",GR=e=>e?.startsWith(BR)||!1,$R=`
|
|
28
28
|
We've detected you're using React Native but have not provided the corresponding runtime,
|
|
29
29
|
for an optimal experience please use the "coveo.analytics/react-native" subpackage.
|
|
30
30
|
Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
|
|
31
|
-
`;function SR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var bR=["1",1,"yes",!0];function AR(){let e=[];return Sd()&&e.push(window.doNotTrack),Nd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>bR.indexOf(t)!==-1)}function Ps(e){return e===!0?!1:AR()}var ah="v15",sh={default:"https://analytics.cloud.coveo.com/rest/ua"};function wR(e=sh.default,t=ah,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 xR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Xt=class{get defaultOptions(){return{endpoint:sh.default,isCustomEndpoint:!1,token:"",version:ah,beforeSendHooks:[],afterSendHooks:[]}}get version(){return rh}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=[pE,iE].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};Ps(this.options.disableBrowserPrivacySignals)?this.runtime=new Os:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ce.view,{newEventType:Ce.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.click,{newEventType:Ce.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.custom,{newEventType:Ce.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.search,{newEventType:Ce.search,addClientIdParameter:!0})}initRuntime(t){return Sd()&&go()?new Od(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(SR()&&console.warn(vR),new Pd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Sd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||mn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),mn()}})}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(Rs(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Is(t,Is(r,xR)))}})}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(mn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ps(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(_r.cvo_cid);if(r==null)return null;let n=_r.fromString(r);return!n||!go()||!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,b)=>U(this,void 0,void 0,function*(){let x=yield y;return yield b(t,x)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?cR(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,R)=>U(this,void 0,void 0,function*(){let h=yield v;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Es().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=pr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=pr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(Ce.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 C(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield C(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ce.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(pR(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=pr(t,["custom"]),o={};r&&Cs(r)&&(o=this.lowercaseKeys(r));let i=fR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=pr(t,["custom"]);if(r&&Cs(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=pr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ce.view||r==Ce.click||r==Ce.search||r==Ce.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ce.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=pr(t,["userId"]);return yR(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=pr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Cs(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Cs(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"?EE(t,r):t}get baseUrl(){return wR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},fr;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(fr||(fr={}));var $;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})($||($={}));var Yg={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[fr.expandToFullUI]:"interface",[fr.openUserActions]:"User Actions",[fr.showPrecedingSessions]:"User Actions",[fr.showFollowingSessions]:"User Actions",[fr.clickViewedDocument]:"User Actions",[fr.clickPageView]:"User Actions",[fr.createArticle]:"createArticle"},So=class{constructor(){this.runtime=new Os,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ce.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ce.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ce.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ce.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return rh}};function CR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function ER(e){return e.map(t=>t.replace(/;/g,""))}function ch(e){let r=e.join(";");return r.length<=256?r:ch(e.slice(1))}var Xg=e=>{let t=ER(e),r=CR(t);return ch(r)};function Zg(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Xg(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Xg(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ns=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new So:new Xt(t)}disable(){this.coveoAnalyticsClient=new So}enable(){this.coveoAnalyticsClient=new Xt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,Zg(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,Zg(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,i=Yg[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Fs=Object.assign({},Mi),Jg=Object.keys(Fs).map(e=>Fs[e]),yo=class extends xd{constructor({client:t,uuidGenerator:r=mn}){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])=>Jg.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Jg.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Fs.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Fs.event,{newEventType:Ce.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return kE(this.ticket)}};yo.Id="svc";var Ds;(function(e){e.click="click",e.flowStart="flowStart"})(Ds||(Ds={}));var Pt;(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"})(Pt||(Pt={}));var Ms;(function(e){e.quit="Quit",e.solved="Solved"})(Ms||(Ms={}));var Ls=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ps(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Xt(t):new So,this.svc=new yo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new So,this.svc=new yo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Xt(this.options),this.svc=new yo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Pt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Pt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Pt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Pt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Pt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Pt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Pt.caseCancelled,{reason:Ms.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Pt.caseSolved,{reason:Ms.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Pt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ds.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 Xt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var uh=e=>new Xt(e).getCurrentVisitorId(),qi=(e,t)=>typeof t=="function"?(...r)=>{let n=mi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,ji=(e,t)=>(...r)=>{let n=mi(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function qs(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function lh(e){let{activeValue:t,ancestryMap:r}=RR(e);return t?IR(t,r):[]}function RR(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 IR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var TR=(e,t)=>e.categoryFacetSet[t]?.request;var Md=(e,t)=>{let r=TR(e,t);return lh(r?.currentValues??[])};m();d();f();p();function js(){return{}}m();d();f();p();function Us(){return{}}m();d();f();p();function Vs(){return{}}m();d();f();p();function Gs(){return{}}function Ld(e){return{facetSet:e.facetSet??Gs(),categoryFacetSet:e.categoryFacetSet??js(),dateFacetSet:e.dateFacetSet??Us(),numericFacetSet:e.numericFacetSet??Vs(),automaticFacetSet:e.automaticFacetSet??qs()}}var qd=e=>{let t=[];return OR(e).forEach((r,n)=>{let o=jR(e,r.facetId),i=LR(r,n+1);if(kR(r)){if(!!!Md(e,r.facetId).length)return;t.push({...i,...DR(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=dh(a,s+1,o),c=_R(r)?ph(a):NR(a);t.push({...i,...u,...c})})}),PR(e).forEach((r,n)=>{let o=MR(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=dh(i,a+1,"specific"),u=ph(i);t.push({...o,...s,...u})})}),t},_R=e=>e.type==="specific",kR=e=>e.type==="hierarchical",OR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),PR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),dh=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),NR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),ph=e=>({displayValue:e.value,value:e.value}),FR=(e,t)=>Md(e,t).map(n=>n.value).join(";"),DR=(e,t)=>{let n=FR(e,t);return{value:n,valuePosition:1,displayValue:n}},MR=(e,t)=>({title:fh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),LR=(e,t)=>({title:fh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),fh=(e,t)=>`${e}_${t}`,qR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,jR=(e,t)=>{let r=qR(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var jd=e=>e.configuration.search.locale,mh=e=>e.configuration.search.timezone,gh=e=>e.configuration.accessToken,hh=e=>e.configuration.organizationId,yh=e=>e.configuration.environment,Bs=e=>e.configuration?.knowledge?.agentId,vh=e=>e.configuration.knowledge.debugAgentSession;var je=e=>{if(UR(e)||Ud(e))return e.generatedAnswer?.answerId;if(VR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},UR=e=>"answer"in e&&"generatedAnswer"in e&&!ce(e.generatedAnswer?.answerConfigurationId),Ud=e=>{let t=Bs(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},VR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Vd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,kr=e=>e.followUpAnswers?.conversationId,GR=e=>e.generatedAnswer?.citations,BR=e=>e.followUpAnswers?.followUpAnswers,$R=ze(BR,e=>e?.flatMap(t=>t.citations)),QR=(e,t)=>t,bo=ze(GR,$R,QR,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();f();p();var Et=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var Sh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Sh||{}),bh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(bh||{}),Gd=e=>{if(hm(e))return e.map(t=>Gd(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""}},Ah=()=>({by:"relevancy"});var xV=new re({values:{by:new Fl({enum:bh,required:!0}),order:new Fl({enum:Sh}),field:new H}});function $s(){return Gd(Ah())}m();d();f();p();m();d();f();p();var Ao=()=>"default";var HR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},mr=class{constructor(t){ue(this,"getState",t);ue(this,"state");this.state=t()}getLanguage(){return HR(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=so),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Ao()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Ui=class Ui extends mr{constructor(){super(...arguments);ue(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return qd(Ld(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Ui.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||Ht().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Ui.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=je(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??$s()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Et().q}get responseTime(){return this.state.search?.duration||Ht().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Ht().response.totalCountFiltered}};ue(Ui,"fallbackPipelineName","default");var Or=Ui,wh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ns({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v},Bd=()=>{let t=ht.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var Qs=/*#__PURE__*/function(){var _Qs=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield uh(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}),...(Bd()&&{pageId:Bd()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:mo(e)})}}});function Qs(_x17,_x18){return _Qs.apply(this,arguments)}return Qs}();m();d();f();p();m();d();f();p();m();d();f();p();var wo=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Vi=class extends mr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Et().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||wo().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||wo().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||wo().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function xh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();f();p();m();d();f();p();m();d();f();p();var Ch=/^(?:[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 zR(e){return typeof e=="string"&&Ch.test(e)}var $d=zR;m();d();f();p();var it=[];for(let e=0;e<256;++e)it.push((e+256).toString(16).slice(1));function Eh(e,t=0){return(it[e[t+0]]+it[e[t+1]]+it[e[t+2]]+it[e[t+3]]+"-"+it[e[t+4]]+it[e[t+5]]+"-"+it[e[t+6]]+it[e[t+7]]+"-"+it[e[t+8]]+it[e[t+9]]+"-"+it[e[t+10]]+it[e[t+11]]+it[e[t+12]]+it[e[t+13]]+it[e[t+14]]+it[e[t+15]]).toLowerCase()}m();d();f();p();var WR=new Uint8Array(16);function Qd(){return crypto.getRandomValues(WR)}m();d();f();p();function KR(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():YR(e,t,r)}function YR(e,t,r){e=e||{};let n=e.random??e.rng?.()??Qd();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 Eh(n)}var Hd=KR;function XR(_x19){return _XR.apply(this,arguments)}function _XR(){_XR=_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 _XR.apply(this,arguments)}var Oh="2.1.3",zd=128,Ph=192,Rh=224,Ih=240,ZR=248;function JR(e){return(e&ZR)===Ih?4:(e&Ih)===Rh?3:(e&Rh)===Ph?2:1}function eI(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&zd)!=zd)break;if(r-=3,(n&Ph)!=zd){t-r>=JR(n)*3&&(r=t);break}}return e.substring(0,r)}function tI(e){let{trackingId:t}=e;return{trackingId:t}}function rI(e){return(e.source||[]).concat([`relay@${Oh}`])}function Nh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=tI(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:rI(t),clientId:s,userAgent:i(),referrer:Th(n()),location:Th(o())})}function Th(e){return e!==null?eI(e,1024):null}function nI(e,t,r,n){return{...t,meta:Nh(e,r,n)}}var oI="*";function iI(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>s(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===oI)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function a(u){let c=t(u);c>=0&&e.splice(c,1)}function s(u,c){c?a({type:u,callback:c}):i(u)}return{add:n,call:o,remove:s}}function _h({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 aI(e){let t=_h(e);return{get:()=>t,update:r=>{t=_h({...t,...r})}}}var Wd=sI();function sI(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function cI(){return{getItem(e){return Wd.getItem(e)||localStorage.getItem(e)},removeItem(e){Wd.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Wd.setItem(e,t,31556952e3)}}}var kh="visitorId";function uI(){let e=document.referrer;return e===""?null:e}function Kd(){let e=cI();return{runtime:"browser",send:function(){var _send=_asyncToGenerator(function*(t,r,n){let o=C(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});xh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let u of s.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});function send(_x20,_x21,_x22){return _send.apply(this,arguments)}return send}(),getReferrer:()=>uI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(kh);if(t&&$d(t))return t;let r=Hd();return e.setItem(kh,r),r}}}function lI(){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 dI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function pI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=dI();return t&&r?{...r,runtime:"custom"}:t&&fI()&&lI()?Kd():n}function fI(){try{return typeof window=="object"}catch{return!1}}function mI(e){return{get:()=>Object.freeze(pI(e))}}function Fh(e){let t=aI(e),r=iI(),n=mI(t);return{emit:function(){var _emit=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=nI(o,i,a,s);return XR({config:a,environment:s,event:u,listenerManager:r})});function emit(_x23,_x24){return _emit.apply(this,arguments)}return emit}(),getMeta:o=>Nh(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:Oh}}m();d();f();p();function Dh(){return typeof window<"u"&&typeof document<"u"}var gI=50,hI=rs({memoize:cd,memoizeOptions:{maxSize:gI}}),Gi=hI(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>mo(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let u=vI(s);return Fh({mode:i?"emit":"disabled",url:o??Fa(e,t),token:r,trackingId:n??null,source:a,environment:u})}),yI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _send2=_asyncToGenerator(function*(){});function send(){return _send2.apply(this,arguments)}return send}()},vI=e=>{if(!e)return;let t=e();return{...(Dh()?Kd():yI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var Bi=class extends mr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Mh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Bi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??kt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,v=new Ls({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:qi(e,n),beforeSendHooks:[ji(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();function qh(e,t){return{...new Or(t).getBaseMetadata(),actionCause:e,type:e}}function SI(e){return Object.assign(e,{instantlyCallable:!0})}function bI(e,t){let r=i=>{let a=ke(e,i);return SI(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}=s;return yield(yield t({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref6.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _prepare=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:r(/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(R,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x28,_x29){return _ref7.apply(this,arguments)}}())}});function prepare(_x27){return _prepare.apply(this,arguments)}return prepare}()}),n}var jh=(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 xI(i)}return n},AI=e=>e.configuration.analytics.analyticsMode==="legacy",wI=e=>e.configuration.analytics.analyticsMode==="next",xI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),bI(e,/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}){let R=[],h={log:function(){var _log=_asyncToGenerator(function*({state:N}){for(let _ of R)yield _(N)});function log(_x31){return _log.apply(this,arguments)}return log}()},y=s(),b=i({getState:s,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:v,provider:r(s)}),x=yield t(b,s());h.description=x?.description,R.push(/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(N){AI(N)&&(yield CI(x,r,N,g,b.coveoAnalyticsClient))});return function(_x32){return _ref9.apply(this,arguments)}}());let{emit:I}=Gi(y);return R.push(/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(N){if(wI(N)&&o&&n){let _=n(N);yield OI(I,o,_)}});return function(_x33){return _ref0.apply(this,arguments)}}()),h});return function(_x30){return _ref8.apply(this,arguments)}}()));function CI(_x34,_x35,_x36,_x37,_x38){return _CI.apply(this,arguments)}function _CI(){_CI=_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 _CI.apply(this,arguments)}var EI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _log2=_asyncToGenerator(function*(i){r(n,o)});function log(_x39){return _log2.apply(this,arguments)}return log}()}),De=jh(e=>wh({...e,provider:e.provider||new Or(e.getState)}),e=>e,Or),IB=jh(Mh,EI("caseAssist"),Bi);var Yd=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return RI(e,r,t)},Uh=(e,t)=>({sourceName:Gh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()}),Vh=(e,t)=>({sourceName:Gh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Tr()});function Gh(e){let t=e.source;return ce(t)?"unknown":t}var Bh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function RI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:_I(e),...(Lh(e)?{documentCategory:Lh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:kI(e),queryPipeline:r.pipeline||Tr()}}function Lh(e){return e.raw?.objecttype||void 0}var Hs=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||""}),$h={urihash:new H,sourcetype:new H,permanentid:new H},Qh={uniqueId:Y,raw:new re({values:$h}),title:Y,uri:Y,clickUri:Y,rankingModifier:new H({required:!1,emptyAllowed:!0})};function II(e){return Object.assign({},...Object.keys($h).map(t=>({[t]:e[t]})))}function TI(e){return Object.assign({},...Object.keys(Qh).map(t=>({[t]:e[t]})),{raw:II(e.raw)})}function _I(e){let t=e.raw.author;return ce(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function kI(e){let t=e.raw.source;return ce(t)?"unknown":t}var Xd=e=>new yt(Qh).validate(TI(e));function OI(_x40,_x41,_x42){return _OI.apply(this,arguments)}function _OI(){_OI=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _OI.apply(this,arguments)}m();d();f();p();var Hh=()=>De("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Vi(e)),zh=()=>({actionCause:"recommendationInterfaceLoad"}),Ws=e=>De({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(Xd(e),t.makeRecommendationOpen(Yd(e,r),Hs(e))),__legacy__provider:t=>new Vi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Yd(e,t),n=Hs(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var xo=L("recommendation/set",e=>V(e,{id:Y})),Pr=ke("recommendation/get",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield PI(o),s=yield n.recommendations(a),u=Date.now()-i;return vt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:Hh(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref1.apply(this,arguments)}}()),PI=/*#__PURE__*/function(){var _PI=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield NI(e,zh()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});function PI(_x45){return _PI.apply(this,arguments)}return PI}(),NI=/*#__PURE__*/function(){var _NI=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield Qs(e.configuration.analytics,r)});function NI(_x46,_x47){return _NI.apply(this,arguments)}return NI}();var Co=Be(wo(),e=>{e.addCase(xo,(t,r)=>{t.id=r.payload.id}).addCase(Pr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Pr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Pr.pending,t=>{t.isLoading=!0}).addCase(Ss,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var Eo=L("searchHub/set",e=>V(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();var Ro=Be(Ao(),e=>{e.addCase(Eo,(t,r)=>r.payload).addCase(St.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Kt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Wh=class extends Error{constructor(t){super(t[0].message);ue(this,"issues");this.name="SchemaError",this.issues=t}};var sp="uninitialized",ep="pending",tp="fulfilled",rp="rejected";function Kh(e){return{status:e,isUninitialized:e===sp,isLoading:e===ep,isSuccess:e===tp,isError:e===rp}}var Yh=zt;function ly(e,t){if(e===t||!(Yh(e)&&Yh(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]=ly(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function np(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function FI(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function DI(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function cp(e){return e!=null}function Xh(e){return[...(e?.values()??[])].filter(cp)}function MI(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var LI=e=>e.replace(/\/$/,""),qI=e=>e.replace(/^\//,"");function jI(e,t){if(!e)return t;if(!t)return e;if(FI(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=LI(e),t=qI(t),`${e}${r}${t}`}function Zs(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var op=()=>new Map,UI=e=>{let t=new l.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},VI=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},Zh=(...e)=>C(...e),GI=e=>e.status>=200&&e.status<=299,BI=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Jh(e){if(!zt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var $I=e=>typeof e=="object"&&(zt(e)||Array.isArray(e)||typeof e.toJSON=="function");function dy({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=Zh,paramsSerializer:n,isJsonContentType:o=BI,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof C>"u"&&r===Zh&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(R,h,y){let{getState:b,extra:x,endpoint:I,forced:N,type:_}=h,P,{url:w,headers:O=new E(g.headers),params:k=void 0,responseHandler:T=u??"json",validateStatus:D=c??GI,timeout:G=s,...M}=typeof R=="string"?{url:R}:R,q={...g,signal:G?VI(h.signal,UI(G)):h.signal,...M};O=new E(Jh(O)),q.headers=(yield t(O,{getState:b,arg:R,extra:x,endpoint:I,forced:N,type:_,extraOptions:y}))||O;let B=$I(q.body);if(q.body!=null&&!B&&typeof q.body!="string"&&q.headers.delete("content-type"),!q.headers.has("content-type")&&B&&q.headers.set("content-type",i),B&&o(q.headers)&&(q.body=JSON.stringify(q.body,a)),q.headers.has("accept")||(T==="json"?q.headers.set("accept","application/json"):T==="text"&&q.headers.set("accept","text/plain, text/html, */*")),k){let Z=~w.indexOf("?")?"&":"?",se=n?n(k):new URLSearchParams(Jh(k));w+=Z+se}w=jI(e,w);let j=new Request(w,q);P={request:new Request(w,q)};let W;try{W=yield r(j)}catch(Z){return{error:{status:(Z instanceof Error||typeof DOMException<"u"&&Z instanceof DOMException)&&Z.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Z)},meta:P}}let Q=W.clone();P.response=Q;let X,z="";try{let Z;if(yield Promise.all([v(W,T).then(se=>X=se,se=>Z=se),Q.text().then(se=>z=se,()=>{})]),Z)throw Z}catch(Z){return{error:{status:"PARSING_ERROR",originalStatus:W.status,data:z,error:String(Z)},meta:P}}return D(W,X)?{data:X,meta:P}:{error:{status:W.status,data:X},meta:P}});return function(_x48,_x49,_x50){return _ref10.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(R,h){if(typeof h=="function")return h(R);if(h==="content-type"&&(h=o(R.headers)?"json":"text"),h==="json"){let y=yield R.text();return y.length?JSON.parse(y):null}return R.text()});return _v2.apply(this,arguments)}}var Io=class{constructor(e,t=void 0){ue(this,"value");ue(this,"meta");this.value=e,this.meta=t}};function QI(){return _QI.apply(this,arguments)}function _QI(){_QI=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _QI.apply(this,arguments)}function py(e,t){throw Object.assign(new Io({error:e,meta:t}),{throwImmediately:!0})}function Zd(e){e.aborted&&py({status:"CUSTOM_ERROR",error:"Aborted"})}var ey={},HI=(e,t)=>(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(r,n,o){let[i]=[5,(t||ey).maxRetries,(o||ey).maxRetries].filter(c=>c!==void 0).slice(-1),s={maxRetries:i,backoff:QI,retryCondition:(c,g,{attempt:v})=>v<=i,...t,...o},u=0;for(;;){Zd(n.signal);try{let c=yield e(r,n,o);if(c.error)throw new Io(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof Io)return c.value;throw c}if(c instanceof Io){if(!s.retryCondition(c.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return c.value}else if(u>s.maxRetries)return{error:c};Zd(n.signal);try{yield s.backoff(u,s.maxRetries,n.signal)}catch(g){throw Zd(n.signal),g}}}});return function(_x53,_x54,_x55){return _ref11.apply(this,arguments)}}()),fy=Object.assign(HI,{fail:py}),ec="__rtkq/",zI="online",WI="offline";var my="focused";var up=L(`${ec}${my}`),gy=L(`${ec}un${my}`),lp=L(`${ec}${zI}`),hy=L(`${ec}${WI}`);var Wi="query",yy="mutation",vy="infinitequery";function tc(e){return e.type===Wi}function KI(e){return e.type===yy}function Qi(e){return e.type===vy}function Js(e){return tc(e)||Qi(e)}function dp(e,t,r,n,o,i){let a=YI(e)?e(t,r,n,o):e;return a?np(a,cp,s=>i(Sy(s))):[]}function YI(e){return typeof e=="function"}function Sy(e){return typeof e=="string"?{type:e}:e}function XI(e,t){return e.catch(t)}var To=(e,t)=>e.endpointDefinitions[t],Hi=Symbol("forceQueryFn"),ip=e=>typeof e[Hi]=="function";function ZI({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=w=>a(w)?.runningQueries,u=w=>a(w)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:N,buildInitiateInfiniteQuery:_,buildInitiateMutation:P,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function R(w,O){return k=>{let T=e({queryArgs:O,endpointDefinition:To(i,w),endpointName:w});return s(k)?.get(T)}}function h(w,O){return k=>u(k)?.get(O)}function y(){return w=>Xh(s(w))}function b(){return w=>Xh(u(w))}function x(w){}function I(w,O){let k=(T,{subscribe:D=!0,forceRefetch:G,subscriptionOptions:M,[Hi]:q,...B}={})=>(j,W)=>{let Q=e({queryArgs:T,endpointDefinition:O,endpointName:w}),X,z={...B,type:Wi,subscribe:D,forceRefetch:G,subscriptionOptions:M,endpointName:w,originalArgs:T,queryCacheKey:Q,[Hi]:q};if(tc(O))X=t(z);else{let{direction:me,initialPageParam:we,refetchCachedPages:Se}=B;X=r({...z,direction:me,initialPageParam:we,refetchCachedPages:Se})}let Z=o.endpoints[w].select(T),se=j(X),ye=Z(W());let{requestId:_e,abort:Ge}=se,Fe=ye.requestId!==_e,Me=s(j)?.get(Q),Le=()=>Z(W()),ve=Object.assign(q?se.then(Le):Fe&&!Me?Promise.resolve(ye):Promise.all([Me,se]).then(Le),{arg:T,requestId:_e,subscriptionOptions:M,queryCacheKey:Q,abort:Ge,unwrap(){return _asyncToGenerator(function*(){let me=yield ve;if(me.isError)throw me.error;return me.data})()},refetch:me=>j(k(T,{subscribe:!1,forceRefetch:!0,...me})),unsubscribe(){D&&j(c({queryCacheKey:Q,requestId:_e}))},updateSubscriptionOptions(me){ve.subscriptionOptions=me,j(v({endpointName:w,requestId:_e,queryCacheKey:Q,options:me}))}});if(!Me&&!Fe&&!q){let me=s(j);me.set(Q,ve),ve.then(()=>{me.delete(Q)})}return ve};return k}function N(w,O){return I(w,O)}function _(w,O){return I(w,O)}function P(w){return(O,{track:k=!0,fixedCacheKey:T}={})=>(D,G)=>{let M=D(n({type:"mutation",endpointName:w,originalArgs:O,track:k,fixedCacheKey:T}));let{requestId:q,abort:B,unwrap:j}=M,W=XI(M.unwrap().then(Z=>({data:Z})),Z=>({error:Z})),Q=()=>{D(g({requestId:q,fixedCacheKey:T}))},X=Object.assign(W,{arg:M.arg,requestId:q,abort:B,unwrap:j,reset:Q}),z=u(D);return z.set(q,X),X.then(()=>{z.delete(q)}),T&&(z.set(T,X),X.then(()=>{z.get(T)===X&&z.delete(T)})),X}}}var by=class extends Wh{constructor(t,r,n,o){super(t);ue(this,"value");ue(this,"schemaName");ue(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},gn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function hn(_x56,_x57,_x58,_x59){return _hn.apply(this,arguments)}function _hn(){_hn=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new by(o.issues,t,r,n);return o.value});return _hn.apply(this,arguments)}function ty(e){return e}var $i=(e={})=>({...e,[Pi]:!0});function JI({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,q,B,j)=>(W,Q)=>{let X=r[M],z=n({queryArgs:q,endpointDefinition:X,endpointName:M});if(W(o.internalActions.queryResultPatched({queryCacheKey:z,patches:B})),!j)return;let Z=o.endpoints[M].select(q)(Q()),se=dp(X.providesTags,Z.data,void 0,q,{},i);W(o.internalActions.updateProvidedBy([{queryCacheKey:z,providedTags:se}]))};function v(M,q,B=0){let j=[q,...M];return B&&j.length>B?j.slice(0,-1):j}function R(M,q,B=0){let j=[...M,q];return B&&j.length>B?j.slice(1):j}let h=(M,q,B,j=!0)=>(W,Q)=>{let X=o.endpoints[M].select(q)(Q()),z={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(M,q,z.inversePatches,j))};if(X.status==="uninitialized")return z;let Z;if("data"in X)if(lt(X.data)){let[se,ye,_e]=id(X.data,B);z.patches.push(...ye),z.inversePatches.push(..._e),Z=se}else Z=B(X.data),z.patches.push({op:"replace",path:[],value:Z}),z.inversePatches.push({op:"replace",path:[],value:X.data});return z.patches.length===0||W(o.util.patchQueryData(M,q,z.patches,j)),z},y=(M,q,B)=>j=>j(o.endpoints[M].initiate(q,{subscribe:!1,forceRefetch:!0,[Hi]:()=>({data:B})})),b=(M,q)=>M.query&&M[q]?M[q]:ty,x=/*#__PURE__*/function(){var _x62=_asyncToGenerator(function*(M,{signal:q,abort:B,rejectWithValue:j,fulfillWithValue:W,dispatch:Q,getState:X,extra:z}){let Z=r[M.endpointName],{metaSchema:se,skipSchemaValidation:ye=c}=Z,_e=M.type===Wi;try{let Ge=ty,Fe={signal:q,abort:B,dispatch:Q,getState:X,extra:z,endpoint:M.endpointName,type:M.type,forced:_e?I(M,X()):void 0,queryCacheKey:_e?M.queryCacheKey:void 0},Me=_e?M[Hi]:void 0,Le,ve=/*#__PURE__*/function(){var _ve=_asyncToGenerator(function*(we,Se,He,Ye){if(Se==null&&we.pages.length)return Promise.resolve({data:we});let Tt=yield me({queryArg:M.originalArgs,pageParam:Se}),xt=Ye?v:R;return{data:{pages:xt(we.pages,Tt.data,He),pageParams:xt(we.pageParams,Se,He)},meta:Tt.meta}});function ve(_x63,_x64,_x65,_x66){return _ve.apply(this,arguments)}return ve}();function me(_x67){return _me2.apply(this,arguments)}function _me2(){_me2=_asyncToGenerator(function*(we){let Se,{extraOptions:He,argSchema:Ye,rawResponseSchema:Tt,responseSchema:xt}=Z;if(Ye&&!gn(ye,"arg")&&(we=yield hn(Ye,we,"argSchema",{})),Me?Se=Me():Z.query?(Ge=b(Z,"transformResponse"),Se=yield t(Z.query(we),Fe,He)):Se=yield Z.queryFn(we,Fe,He,ir=>t(ir,Fe,He)),typeof process<"u",Se.error)throw new Io(Se.error,Se.meta);let{data:qt}=Se;Tt&&!gn(ye,"rawResponse")&&(qt=yield hn(Tt,Se.data,"rawResponseSchema",Se.meta));let _t=yield Ge(qt,Se.meta,we);return xt&&!gn(ye,"response")&&(_t=yield hn(xt,_t,"responseSchema",Se.meta)),{...Se,data:_t}});return _me2.apply(this,arguments)}if(_e&&"infiniteQueryOptions"in Z){let{infiniteQueryOptions:we}=Z,{maxPages:Se=1/0}=we,He=M.refetchCachedPages??we.refetchCachedPages??!0,Ye,Tt={pages:[],pageParams:[]},xt=a.selectQueryEntry(X(),M.queryCacheKey)?.data,qt=I(M,X())&&!M.direction||!xt?Tt:xt;if("direction"in M&&M.direction&&qt.pages.length){let _t=M.direction==="backward";Ye=yield ve(qt,(_t?ap:Xs)(we,qt,M.originalArgs),Se,_t)}else{let{initialPageParam:_t=we.initialPageParam}=M,ir=xt?.pageParams??[],xl=ir[0]??_t,zf=ir.length;if(Ye=yield ve(qt,xl,Se),Me&&(Ye={data:Ye.data.pages[0]}),He)for(let Wf=1;Wf<zf;Wf++){let vw=Xs(we,Ye.data,M.originalArgs);Ye=yield ve(Ye.data,vw,Se)}}Le=Ye}else Le=yield me(M.originalArgs);return se&&!gn(ye,"meta")&&Le.meta&&(Le.meta=yield hn(se,Le.meta,"metaSchema",Le.meta)),W(Le.data,$i({fulfilledTimeStamp:Date.now(),baseQueryMeta:Le.meta}))}catch(Ge){let Fe=Ge;if(Fe instanceof Io){let Me=b(Z,"transformErrorResponse"),{rawErrorResponseSchema:Le,errorResponseSchema:ve}=Z,{value:me,meta:we}=Fe;try{Le&&!gn(ye,"rawErrorResponse")&&(me=yield hn(Le,me,"rawErrorResponseSchema",we)),se&&!gn(ye,"meta")&&(we=yield hn(se,we,"metaSchema",we));let Se=yield Me(me,we,M.originalArgs);return ve&&!gn(ye,"errorResponse")&&(Se=yield hn(ve,Se,"errorResponseSchema",we)),j(Se,$i({baseQueryMeta:we}))}catch(Se){Fe=Se}}try{if(Fe instanceof by){let Me={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:_e?M.queryCacheKey:void 0};Z.onSchemaFailure?.(Fe,Me),s?.(Fe,Me);let{catchSchemaFailure:Le=u}=Z;if(Le)return j(Le(Fe,Me),$i({baseQueryMeta:Fe._bqMeta}))}}catch(Me){Fe=Me}throw typeof process<"u",console.error(Fe),Fe}});function x(_x60,_x61){return _x62.apply(this,arguments)}return x}();function I(M,q){let B=a.selectQueryEntry(q,M.queryCacheKey),j=a.selectConfig(q).refetchOnMountOrArgChange,W=B?.fulfilledTimeStamp,Q=M.forceRefetch??(M.subscribe&&j);return Q?Q===!0||(Number(new Date)-Number(W))/1e3>=Q:!1}let N=()=>ke(`${e}/executeQuery`,x,{getPendingMeta({arg:M}){let q=r[M.endpointName];return $i({startedTimeStamp:Date.now(),...(Qi(q)?{direction:M.direction}:{})})},condition(M,{getState:q}){let B=q(),j=a.selectQueryEntry(B,M.queryCacheKey),W=j?.fulfilledTimeStamp,Q=M.originalArgs,X=j?.originalArgs,z=r[M.endpointName],Z=M.direction;if(ip(M))return!0;if(j?.status==="pending")return!1;if(I(M,B)||tc(z)&&z?.forceRefetch?.({currentArg:Q,previousArg:X,endpointState:j,state:B}))return!0;if(W&&!Z)return!1;if(Z&&Qi(z)){let se=j?.data;if(se?.pages.length){let{infiniteQueryOptions:ye}=z;if((Z==="forward"?Xs:ap)(ye,se,Q)==null)return!1}}return!0},dispatchConditionRejection:!0}),_=N(),P=N(),w=ke(`${e}/executeMutation`,x,{getPendingMeta(){return $i({startedTimeStamp:Date.now()})}}),O=M=>"force"in M,k=M=>"ifOlderThan"in M,T=(M,q,B={})=>(j,W)=>{let Q=O(B)&&B.force,X=k(B)&&B.ifOlderThan,z=(se=!0)=>{let ye={forceRefetch:se,subscribe:!1};return o.endpoints[M].initiate(q,ye)},Z=o.endpoints[M].select(q)(W());if(Q)j(z());else if(X){let se=Z?.fulfilledTimeStamp;if(!se){j(z());return}(Number(new Date)-Number(new Date(se)))/1e3>=X&&j(z())}else j(z(!1))};function D(M){return q=>q?.meta?.arg?.endpointName===M}function G(M,q){return{matchPending:io(cs(M),D(q)),matchFulfilled:io(lr(M),D(q)),matchRejected:io(ln(M),D(q))}}return{queryThunk:_,mutationThunk:w,infiniteQueryThunk:P,prefetch:T,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:G}}function Xs(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function ap(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ay(e,t,r,n){return dp(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,Fi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ry(e){return gt(e)?es(e):e}function Ks(e,t,r){let n=e[t];n&&r(n)}function zi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function ny(e,t,r){let n=e[zi(t)];n&&r(n)}var Ys={};function eT({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:u,config:c}){let g=L(`${e}/resetApiState`);function v(k,T,D,G){var M;k[M=T.queryCacheKey]??(k[M]={status:sp,endpointName:T.endpointName}),Ks(k,T.queryCacheKey,q=>{q.status=ep,q.requestId=D&&q.requestId?q.requestId:G.requestId,T.originalArgs!==void 0&&(q.originalArgs=T.originalArgs),q.startedTimeStamp=G.startedTimeStamp;let B=o[G.arg.endpointName];Qi(B)&&"direction"in T&&(q.direction=T.direction)})}function R(k,T,D,G){Ks(k,T.arg.queryCacheKey,M=>{if(M.requestId!==T.requestId&&!G)return;let{merge:q}=o[T.arg.endpointName];if(M.status=tp,q){if(M.data!==void 0){let{fulfilledTimeStamp:B,arg:j,baseQueryMeta:W,requestId:Q}=T;M.data=cn(M.data,X=>q(X,D,{arg:j.originalArgs,baseQueryMeta:W,fulfilledTimeStamp:B,requestId:Q}))}else M.data=D;}else M.data=o[T.arg.endpointName].structuralSharing??!0?ly(gt(M.data)?nd(M.data):M.data,D):D;delete M.error,M.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=dn({name:`${e}/queries`,initialState:Ys,reducers:{removeQueryResult:{reducer(k,{payload:{queryCacheKey:T}}){delete k[T]},prepare:ao()},cacheEntriesUpserted:{reducer(k,T){for(let D of T.payload){let{queryDescription:G,value:M}=D;v(k,G,!0,{arg:G,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),R(k,{arg:G,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},M,!0)}},prepare:k=>({payload:k.map(T=>{let{endpointName:D,arg:G,value:M}=T,q=o[D];return{queryDescription:{type:Wi,endpointName:D,originalArgs:T.arg,queryCacheKey:n({queryArgs:G,endpointDefinition:q,endpointName:D})},value:M}}),meta:{[Pi]:!0,requestId:Di(),timestamp:Date.now()}})},queryResultPatched:{reducer(k,{payload:{queryCacheKey:T,patches:D}}){Ks(k,T,G=>{G.data=ad(G.data,D.concat())})},prepare:ao()}},extraReducers(k){k.addCase(t.pending,(T,{meta:D,meta:{arg:G}})=>{v(T,G,ip(G),D)}).addCase(t.fulfilled,(T,{meta:D,payload:G})=>{R(T,D,G,ip(D.arg))}).addCase(t.rejected,(T,{meta:{condition:D,arg:G,requestId:M},error:q,payload:B})=>{Ks(T,G.queryCacheKey,j=>{if(!D){if(j.requestId!==M)return;j.status=rp,j.error=B??q}})}).addMatcher(s,(T,D)=>{let{queries:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&(T[M]=q)})}}),y=dn({name:`${e}/mutations`,initialState:Ys,reducers:{removeMutationResult:{reducer(k,{payload:T}){let D=zi(T);D in k&&delete k[D]},prepare:ao()}},extraReducers(k){k.addCase(r.pending,(T,{meta:D,meta:{requestId:G,arg:M,startedTimeStamp:q}})=>{M.track&&(T[zi(D)]={requestId:G,status:ep,endpointName:M.endpointName,startedTimeStamp:q})}).addCase(r.fulfilled,(T,{payload:D,meta:G})=>{G.arg.track&&ny(T,G,M=>{M.requestId===G.requestId&&(M.status=tp,M.data=D,M.fulfilledTimeStamp=G.fulfilledTimeStamp)})}).addCase(r.rejected,(T,{payload:D,error:G,meta:M})=>{M.arg.track&&ny(T,M,q=>{q.requestId===M.requestId&&(q.status=rp,q.error=D??G)})}).addMatcher(s,(T,D)=>{let{mutations:G}=a(D);for(let[M,q]of Object.entries(G))(q?.status==="fulfilled"||q?.status==="rejected")&&M!==q?.requestId&&(T[M]=q)})}}),b=dn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(k,T){var D,G,M;for(let{queryCacheKey:q,providedTags:B}of T.payload){x(k,q);for(let{type:j,id:W}of B){let Q=(G=(D=k.tags)[j]??(D[j]={}))[M=W??"__internal_without_id"]??(G[M]=[]);Q.includes(q)||Q.push(q)}k.keys[q]=B}},prepare:ao()}},extraReducers(k){k.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:D}})=>{x(T,D)}).addMatcher(s,(T,D)=>{var M,q,B;let{provided:G}=a(D);for(let[j,W]of Object.entries(G.tags??{}))for(let[Q,X]of Object.entries(W)){let z=(q=(M=T.tags)[j]??(M[j]={}))[B=Q??"__internal_without_id"]??(q[B]=[]);for(let Z of X)z.includes(Z)||z.push(Z),T.keys[Z]=G.keys[Z]}}).addMatcher(Wt(lr(t),Fi(t)),(T,D)=>{I(T,[D])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,D)=>{I(T,D.payload.map(({queryDescription:G,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:G}})))})}});function x(k,T){let D=ry(k.keys[T]??[]);for(let G of D){let M=G.type,q=G.id??"__internal_without_id",B=k.tags[M]?.[q];B&&(k.tags[M][q]=ry(B).filter(j=>j!==T))}delete k.keys[T]}function I(k,T){let D=T.map(G=>{let M=Ay(G,"providesTags",o,u),{queryCacheKey:q}=G.meta.arg;return{queryCacheKey:q,providedTags:M}});b.caseReducers.updateProvidedBy(k,b.actions.updateProvidedBy(D))}let N=dn({name:`${e}/subscriptions`,initialState:Ys,reducers:{updateSubscriptionOptions(k,T){},unsubscribeQueryResult(k,T){},internal_getRTKQSubscriptions(){}}}),_=dn({name:`${e}/internalSubscriptions`,initialState:Ys,reducers:{subscriptionsUpdated:{reducer(k,T){return ad(k,T.payload)},prepare:ao()}}}),P=dn({name:`${e}/config`,initialState:{online:MI(),focused:DI(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(k,{payload:T}){k.middlewareRegistered=k.middlewareRegistered==="conflict"||i!==T?"conflict":!0}},extraReducers:k=>{k.addCase(lp,T=>{T.online=!0}).addCase(hy,T=>{T.online=!1}).addCase(up,T=>{T.focused=!0}).addCase(gy,T=>{T.focused=!1}).addMatcher(s,T=>({...T}))}}),w=rn({queries:h.reducer,mutations:y.reducer,provided:b.reducer,subscriptions:_.reducer,config:P.reducer});return{reducer:(k,T)=>w(g.match(T)?void 0:k,T),actions:{...P.actions,...h.actions,...N.actions,..._.actions,...y.actions,...b.actions,resetApiState:g}}}var Jd=Symbol.for("RTKQ/skipToken"),wy={status:sp},oy=cn(wy,()=>{}),iy=cn(wy,()=>{});function tT({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=_=>oy,o=_=>iy;return{buildQuerySelector:R,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:x,selectApiState:a,selectQueries:s,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(_){return{..._,...Kh(_.status)}}function a(_){return _[t]}function s(_){return a(_)?.queries}function u(_,P){return s(_)?.[P]}function c(_){return a(_)?.mutations}function g(_){return a(_)?.config}function v(_,P,w){return O=>{if(O===Jd)return r(n,w);let k=e({queryArgs:O,endpointDefinition:P,endpointName:_});return r(D=>u(D,k)??oy,w)}}function R(_,P){return v(_,P,i)}function h(_,P){let{infiniteQueryOptions:w}=P;function O(k){let T={...k,...Kh(k.status)},{isLoading:D,isError:G,direction:M}=T,q=M==="forward",B=M==="backward";return{...T,hasNextPage:I(w,T.data,T.originalArgs),hasPreviousPage:N(w,T.data,T.originalArgs),isFetchingNextPage:D&&q,isFetchingPreviousPage:D&&B,isFetchNextPageError:G&&q,isFetchPreviousPageError:G&&B}}return v(_,P,O)}function y(){return _=>{let P;return typeof _=="object"?P=zi(_)??Jd:P=_,r(P===Jd?o:O=>a(O)?.mutations?.[P]??iy,i)}}function b(_,P){let w=_[t],O=new Set,k=np(P,cp,Sy);for(let T of k){let D=w.provided.tags[T.type];if(!D)continue;let G=(T.id!==void 0?D[T.id]:Object.values(D).flat())??[];for(let M of G)O.add(M)}return Array.from(O.values()).flatMap(T=>{let D=w.queries[T];return D?{queryCacheKey:T,endpointName:D.endpointName,originalArgs:D.originalArgs}:[]})}function x(_,P){return np(Object.values(s(_)),w=>w?.endpointName===P&&w.status!=="uninitialized",w=>w.originalArgs)}function I(_,P,w){return P?Xs(_,P,w)!=null:!1}function N(_,P,w){return!P||!_.getPreviousPageParam?!1:ap(_,P,w)!=null}}var ay=WeakMap?new WeakMap:void 0,sy=({endpointName:e,queryArgs:t})=>{let r="",n=ay?.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=zt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));zt(t)&&ay?.set(t,o),r=o}return`${e}(${r})`};function rT(...e){return function(r){let n=no(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=sy;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=v(R);return typeof h=="string"?h:sy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Di(),extractRehydrationInfo:n,hasRehydrationInfo:no(c=>n(c)!=null)},a={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let v of c)o.tagTypes.includes(v)||o.tagTypes.push(v);if(g)for(let[v,R]of Object.entries(g))typeof R=="function"?R(To(i,v)):Object.assign(To(i,v)||{},R);return a}},s=e.map(c=>c.init(a,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:Wi}),mutation:v=>({...v,type:yy}),infiniteQuery:v=>({...v,type:vy})});for(let[v,R]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(dt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=R;for(let h of s)h.injectEndpoint(v,R)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function gr(e,...t){return Object.assign(e,...t)}var nT=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=null,a=null,{updateSubscriptionOptions:s,unsubscribeQueryResult:u}=e.internalActions,c=(b,x)=>{if(s.match(x)){let{queryCacheKey:N,requestId:_,options:P}=x.payload,w=b.get(N);return w?.has(_)&&w.set(_,P),!0}if(u.match(x)){let{queryCacheKey:N,requestId:_}=x.payload,P=b.get(N);return P&&P.delete(_),!0}if(e.internalActions.removeQueryResult.match(x))return b.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:N,requestId:_}}=x,P=Zs(b,N.queryCacheKey,op);return N.subscribe&&P.set(_,N.subscriptionOptions??P.get(_)??{}),!0}let I=!1;if(t.rejected.match(x)){let{meta:{condition:N,arg:_,requestId:P}}=x;if(N&&_.subscribe){let w=Zs(b,_.queryCacheKey,op);w.set(P,_.subscriptionOptions??w.get(P)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,x)=>!!g()?.get(b)?.get(x)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([x,I])=>[x,Object.fromEntries(I)]))))}return(b,x)=>{if(i||(i=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return i={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=c(r.currentSubscriptions,b),N=!0;if(I){a||(a=setTimeout(()=>{let w=y(r.currentSubscriptions),[,O]=id(i,()=>w);x.next(e.internalActions.subscriptionsUpdated(O)),i=w,a=null},500));let _=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;N=!_&&!P}return[N,!1]}},oT=2147483647/1e3-1,iT=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,R=Wt(g.match,r.fulfilled,r.rejected,v.match);function h(_){let P=o.currentSubscriptions.get(_);return P?P.size>0:!1}let y={};function b(_){for(let P of _.values())P?.abort?.()}let x=(_,P)=>{let w=a(P.getState());if(R(_)){let O;if(v.match(_))O=_.payload.map(k=>k.queryDescription.queryCacheKey);else{let{queryCacheKey:k}=g.match(_)?_.payload:_.meta.arg;O=[k]}I(O,P,w)}if(t.util.resetApiState.match(_)){for(let[O,k]of Object.entries(y))k&&clearTimeout(k),delete y[O];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(_)){let{queries:O}=n.extractRehydrationInfo(_);I(Object.keys(O),P,w)}};function I(_,P,w){let O=P.getState();for(let k of _){let T=i(O,k);T?.endpointName&&N(k,T.endpointName,P,w)}}function N(_,P,w,O){let k=To(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(k===1/0)return;let T=Math.max(0,Math.min(k,oT));if(!h(_)){let D=y[_];D&&clearTimeout(D),y[_]=setTimeout(()=>{if(!h(_)){let G=i(w.getState(),_);G?.endpointName&&w.dispatch(s(G.endpointName,G.originalArgs))?.abort(),w.dispatch(c({queryCacheKey:_}))}delete y[_]},T*1e3)}}return x},cy=new Error("Promise never resolved before cacheEntryRemoved."),aT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=us(n),c=us(o),g=lr(n,o),v={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(w,O,k){let T=v[w];T?.valueResolved&&(T.valueResolved({data:O,meta:k}),delete T.valueResolved)}function x(w){let O=v[w];O&&(delete v[w],O.cacheEntryRemoved())}function I(w){let{arg:O,requestId:k}=w.meta,{endpointName:T,originalArgs:D}=O;return[T,D,k]}let N=(w,O,k)=>{let T=_(w);function D(G,M,q,B){let j=a(k,M),W=a(O.getState(),M);!j&&W&&P(G,B,M,O,q)}if(n.pending.match(w)){let[G,M,q]=I(w);D(G,T,q,M)}else if(y.match(w))for(let{queryDescription:G,value:M}of w.payload){let{endpointName:q,originalArgs:B,queryCacheKey:j}=G;D(q,j,w.meta.requestId,B),b(j,M,{})}else if(o.pending.match(w)){if(O.getState()[t].mutations[T]){let[G,M,q]=I(w);P(G,M,T,O,q)}}else if(g(w))b(T,w.payload,w.meta.baseQueryMeta);else if(R.match(w)||h.match(w))x(T);else if(e.util.resetApiState.match(w))for(let G of Object.keys(v))x(G)};function _(w){return u(w)?w.meta.arg.queryCacheKey:c(w)?w.meta.arg.fixedCacheKey??w.meta.requestId:R.match(w)?w.payload.queryCacheKey:h.match(w)?zi(w.payload):""}function P(w,O,k,T,D){let G=To(r,w),M=G?.onCacheEntryAdded;if(!M)return;let q={},B=new Promise(z=>{q.cacheEntryRemoved=z}),j=Promise.race([new Promise(z=>{q.valueResolved=z}),B.then(()=>{throw cy})]);j.catch(()=>{}),v[k]=q;let W=e.endpoints[w].select(Js(G)?O:k),Q=T.dispatch((z,Z,se)=>se),X=M(O,{...T,getCacheEntry:()=>W(T.getState()),requestId:D,extra:Q,updateCachedData:Js(G)?z=>T.dispatch(e.util.updateQueryData(w,O,z)):void 0,cacheDataLoaded:j,cacheEntryRemoved:B});Promise.resolve(X).catch(z=>{if(z!==cy)throw z})}return N},sT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},cT=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Wt(lr(n),Fi(n)),v=Wt(lr(o,n),ln(o,n)),R=[],h=0,y=(I,N)=>{(o.pending.match(I)||n.pending.match(I))&&h++,v(I)&&!(o.rejected.match(I)&&I.meta.condition)&&(h=Math.max(0,h-1)),g(I)?x(Ay(I,"invalidatesTags",r,a),N):v(I)?x([],N):i.util.invalidateTags.match(I)&&x(dp(I.payload,void 0,void 0,void 0,void 0,a),N)};function b(){return h>0}function x(I,N){let _=N.getState(),P=_[e];if(R.push(...I),P.config.invalidationBehavior==="delayed"&&b())return;let w=R;if(R=[],w.length===0)return;let O=i.util.selectInvalidatedBy(_,w);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:T}of k){let D=P.queries[T],G=Zs(u.currentSubscriptions,T,op);D&&(G.size===0?N.dispatch(c({queryCacheKey:T})):D.status!=="uninitialized"&&N.dispatch(s(D)))}})}return y},uT=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,u=null,c=(x,I)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,I),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,I),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&v(x.meta.arg,I),r.util.resetApiState.match(x)&&(y(),u&&(clearTimeout(u),u=null),s.clear())};function g(x,I){s.add(x),u||(u=setTimeout(()=>{for(let N of s)R({queryCacheKey:N},I);s.clear(),u=null},0))}function v({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P,skipPollingIfUnfocused:w}=b(_);if(!Number.isFinite(P))return;let O=i.get(x);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let k=Date.now()+P;i.set(x,{nextPollTimestamp:k,pollingInterval:P,timeout:setTimeout(()=>{let T=I.getState()[e],D=T.queries[x];if(!D||D.status==="uninitialized"){h(x);return}(T.config.focused||!w)&&I.dispatch(n(D)),v({queryCacheKey:x},I)},P)})}function R({queryCacheKey:x},I){let N=I.getState()[e].queries[x],_=a.get(x);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P}=b(_);if(!Number.isFinite(P)){h(x);return}let w=i.get(x),O=Date.now()+P;(!w||O<w.nextPollTimestamp)&&v({queryCacheKey:x},I)}function h(x){let I=i.get(x);I?.timeout&&clearTimeout(I.timeout),i.delete(x)}function y(){for(let x of i.keys())h(x)}function b(x=new Map){let I=!1,N=Number.POSITIVE_INFINITY;for(let _ of x.values())_.pollingInterval&&(N=Math.min(_.pollingInterval,N),I=_.skipPollingIfUnfocused||I);return{lowestPollingInterval:N,skipPollingIfUnfocused:I}}return c},lT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=cs(r,n),i=ln(r,n),a=lr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:R,originalArgs:h}}=c.meta,y=To(t,R),b=y?.onQueryStarted;if(b){let x={},I=new Promise((P,w)=>{x.resolve=P,x.reject=w});I.catch(()=>{}),s[v]=x;let N=e.endpoints[R].select(Js(y)?h:v),_=g.dispatch((P,w,O)=>O);b(h,{...g,getCacheEntry:()=>N(g.getState()),requestId:v,extra:_,updateCachedData:Js(y)?P=>g.dispatch(e.util.updateQueryData(R,h,P)):void 0,queryFulfilled:I})}}else if(a(c)){let{requestId:v,baseQueryMeta:R}=c.meta;s[v]?.resolve({data:c.payload,meta:R}),delete s[v]}else if(i(c)){let{requestId:v,rejectedWithValue:R,baseQueryMeta:h}=c.meta;s[v]?.reject({error:c.payload??c.error,isUnhandledError:!R,meta:h}),delete s[v]}}},dT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{up.match(u)&&s(c,"refetchOnFocus"),lp.match(u)&&s(c,"refetchOnReconnect")};function s(u,c){let g=u.getState()[e],v=g.queries,R=o.currentSubscriptions;t.batch(()=>{for(let h of R.keys()){let y=v[h],b=R.get(h);if(!b||!y)continue;let x=[...b.values()];(x.some(I=>I[c]===!0)||x.every(I=>I[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!=="uninitialized"&&u.dispatch(n(y)))}})}return a};function pT(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:L(`${t}/invalidateTags`)},u=R=>R.type.startsWith(`${t}/`),c=[sT,iT,cT,uT,aT,lT];return{middleware:R=>{let h=!1,y=i(R.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:R},x=c.map(_=>_(b)),I=nT(b),N=dT(b);return _=>P=>{if(!Si(P))return _(P);h||(h=!0,R.dispatch(n.internalActions.middlewareRegistered(a)));let w={...R,next:_},O=R.getState(),[k,T]=I(P,w,O),D;if(k?D=_(P):D=T,R.getState()[t]&&(N(P,w,O),u(P)||o.hasRehydrationInfo(P)))for(let G of x)G(P,w,O);return D}},actions:s};function v(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var uy=Symbol(),fT=({createSelector:e=ze}={})=>({name:uy,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h},y){eg();let b=ve=>(typeof process<"u",ve);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:lp,onOffline:hy,onFocus:up,onFocusLost:gy},util:{}});let x=tT({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:N,buildQuerySelector:_,buildInfiniteQuerySelector:P,buildMutationSelector:w}=x;gr(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:N});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,buildMatchThunkActions:B}=JI({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:x,onSchemaFailure:v,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:j,actions:W}=eT({context:y,queryThunk:O,infiniteQueryThunk:k,mutationThunk:T,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});gr(t.util,{patchQueryData:D,updateQueryData:G,upsertQueryData:M,prefetch:q,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),gr(t.internalActions,W);let Q=new WeakMap,X=ve=>Zs(Q,ve,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:z,buildInitiateInfiniteQuery:Z,buildInitiateMutation:se,getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueriesThunk:Ge,getRunningQueryThunk:Fe}=ZI({queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,serializeQueryArgs:i,context:y,getInternalState:X});gr(t.util,{getRunningMutationThunk:ye,getRunningMutationsThunk:_e,getRunningQueryThunk:Fe,getRunningQueriesThunk:Ge});let{middleware:Me,actions:Le}=pT({reducerPath:o,context:y,queryThunk:O,mutationThunk:T,infiniteQueryThunk:k,api:t,assertTagType:b,selectors:x,getRunningQueryThunk:Fe,getInternalState:X});return gr(t.util,Le),gr(t,{reducer:j,middleware:Me}),{name:uy,injectEndpoint(ve,me){var He;let Se=(He=t.endpoints)[ve]??(He[ve]={});tc(me)&&gr(Se,{name:ve,select:_(ve,me),initiate:z(ve,me)},B(O,ve)),KI(me)&&gr(Se,{name:ve,select:w(),initiate:se(ve)},B(T,ve)),Qi(me)&&gr(Se,{name:ve,select:P(ve,me),initiate:Z(ve,me)},B(O,ve))}}}}),xy=rT(fT());m();d();f();p();m();d();f();p();var yn=e=>e.query,Cy=e=>e.query?.enableQuerySyntax;var n$=ze(e=>yn(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})),mT=ze(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var rc=e=>{if(e==="yes")return!0;if(e==="no")return!1},gT=()=>De("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function hT(e,t){return De({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??je(n),i=bo(n,e);if(!o||!i)return null;let a=kr(n);return r.makeGeneratedAnswerCitationClick(Uh(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Bh(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=bo(r,e);return{answerId:t??je(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function yT(e,t,r){return De({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??je(o),a=bo(o,e);if(!i||!a)return null;let s=kr(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=bo(n,e);return{answerId:r??je(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function vT(e,t){return De({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function ST(e){return De({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"like"})})}function bT(e){return De({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"dislike"})})}var AT=e=>De({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=je(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=je(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:u,details:c}=e;return{answerId:r??"",helpful:n,details:{readable:rc(o),documented:rc(i),correctTopic:rc(s),hallucinationFree:rc(a)},additionalNotes:c,correctAnswerUrl:u}}}),pp=(e,t,r)=>De({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??je(o);if(!i)return null;let a=kr(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??je(n)??"",answerGenerated:e??!1})}),_o=e=>De({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),wT=()=>De({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"show"})}),xT=()=>De({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"hide"})}),CT=()=>De({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"expand"})}),ET=()=>De({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=je(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:je(e)??"",action:"collapse"})});function RT(e){return De({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??je(r);if(!n)return null;let o=kr(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??je(t)??"",action:"copyToClipboard"})})}function IT(e,t){return De({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=bo(n,e);if(!o)return null;let i=kr(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...Vh(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var nc={logCopyGeneratedAnswer:RT,logGeneratedAnswerHideAnswers:xT,logGeneratedAnswerShowAnswers:wT,logGeneratedAnswerStreamEnd:pp,logGeneratedAnswerFeedback:AT,logDislikeGeneratedAnswer:bT,logLikeGeneratedAnswer:ST,logGeneratedAnswerOpenInlineLink:vT,logHoverCitation:yT,logOpenGeneratedAnswerSource:hT,logOpenGeneratedAnswerFollowUpSource:IT,logRetryGeneratedAnswer:gT,logGeneratedAnswerExpand:CT,logGeneratedAnswerCollapse:ET};m();d();f();p();m();d();f();p();var Ey=ze(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Ki=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:mo(e)}});m();d();f();p();var fp=e=>e.context;m();d();f();p();var mp=e=>e.pipeline;m();d();f();p();m();d();f();p();var Yi=jt(oc(),1),Oy=jt(Ry(),1);m();d();f();p();var ic=jt(oc(),1),Ty=jt(Iy(),1);ic.default.extend(Ty.default);var _y="YYYY/MM/DD@HH:mm:ss",TT="1401-01-01";function ko(e,t){let r=(0,ic.default)(e,t);return!r.isValid()&&!t?(0,ic.default)(e,_y):r}function ac(e){return e.format(_y)}function ky(e,t){let r=ko(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}`)}Ap(r)}function Ap(e){if(e.isBefore(TT))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Yi.default.extend(Oy.default);var Py=["past","now","next"],Ny=["minute","hour","day","week","month","quarter","year"],_T=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new H({required:!t,constrainTo:Ny}),period:new H({required:!0,constrainTo:Py})}};function wp(e){if(typeof e=="string"&&!Nr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?qy(e):e;new yt(_T(t.period)).validate(t);let r=Dy(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Ap(r)}function Fy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Dy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Yi.default)().subtract(r,n);case"next":return(0,Yi.default)().add(r,n);case"now":return(0,Yi.default)()}}function Xi(e){return ac(Dy(qy(e)))}function My(e){return e.toLocaleLowerCase().split("-")}function Nr(e){let[t,r,n]=My(e);if(t==="now")return!0;if(!Py.includes(t)||!Ny.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Ly(e){return!!e&&typeof e=="object"&&"period"in e}function qy(e){let[t,r,n]=My(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function jy(e){return e.type==="dateRange"}function Uy(e){return`start${e}`}function Vy(e){return`end${e}`}var xp=()=>({dateFacetValueMap:{}});function kT(e,t,r){let n=e.start,o=e.end;return Nr(n)&&(n=Xi(n),r.dateFacetValueMap[t][Uy(n)]=e.start),Nr(o)&&(o=Xi(o),r.dateFacetValueMap[t][Vy(o)]=e.end),{...e,start:n,end:o}}function Cp(e,t){if(jy(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>kT(o,r,t))}}return e}function Fr(e){let t=xp();return{request:{...e,facets:e.facets?.map(n=>Cp(n,t))},mappings:t}}function OT(e,t,r){return{...e,start:r.dateFacetValueMap[t][Uy(e.start)]||e.start,end:r.dateFacetValueMap[t][Vy(e.end)]||e.end}}function PT(e,t){return e.facetId in t.dateFacetValueMap}function NT(e,t){return PT(e,t)?{...e,values:e.values.map(r=>OT(r,e.facetId,t))}:e}function sc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>NT(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function Dr(e){return Object.values(e).map(t=>t.request)}function Ep(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 Gy(e){return Dr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Rp={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function FT(e){return Dr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function DT(e){return[...FT(e.facetSet??{}),...Gy(e.numericFacetSet??{}),...Gy(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function MT(e){return DT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function cc(e){return Ep(MT(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var Mr=/*#__PURE__*/function(){var _Mr=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:ht.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Qs(e.configuration.analytics,t))),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});function Mr(_x68,_x69){return _Mr.apply(this,arguments)}return Mr}();m();d();f();p();var Oo=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??wr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Ki(e.configuration.analytics,t,r)),...(e.excerptLength&&!ce(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var By=ze(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Lr=/*#__PURE__*/function(){var _Lr=_asyncToGenerator(function*(e,t,r){let n=Tp(e),o=LT(e),i=qT(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield Mr(e,r):Oo(e,t,r);return Fr({...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:Ip(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}}})})});function Lr(_x70,_x71,_x72){return _Lr.apply(this,arguments)}return Lr}();function Ip(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function LT(e){return Ep(UT(e),e.facetOrder??[])}function qT(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(jT).filter(r=>r.currentValues.length>0):void 0}function jT(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function UT(e){return VT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function VT(e){return[...GT(e.facetSet??{}),...$y(e.numericFacetSet??{}),...$y(e.dateFacetSet??{}),...Dr(e.categoryFacetSet??{})]}function GT(e){return Dr(e).map(t=>{let r=Rp[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $y(e){return Dr(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 Tp(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=By(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Zi=(e,t)=>{let r=e;return ce(r[t])?ce(e.raw[t])?null:e.raw[t]:r[t]},BT=e=>t=>e.every(r=>!ce(Zi(t,r))),$T=e=>t=>e.every(r=>ce(Zi(t,r))),QT=(e,t)=>r=>{let n=Qy(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},HT=(e,t)=>r=>{let n=Qy(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},Qy=(e,t)=>{let r=Zi(t,e);return ym(r)?r:[r]},Hy={getResultProperty:Zi,fieldsMustBeDefined:BT,fieldsMustNotBeDefined:$T,fieldMustMatch:QT,fieldMustNotMatch:HT};var _p=ze(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var kp=e=>e.searchHub;m();d();f();p();var uc=ze(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),qH=ze(e=>e,e=>{let t=uc(e);return t&&e?e[t].expression:""});m();d();f();p();var zy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var Wy=e=>e.excerptLength?.length;m();d();f();p();var Ky=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var Yy=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();f();p();var Xy=e=>e.sortCriteria;var Zy=/*#__PURE__*/function(){var _Zy=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Jn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});function Zy(_x73){return _Zy.apply(this,arguments)}return Zy}(),Jy=(e,t)=>{let r=yn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=rv(e),s=fp(e),u=Ki(e.configuration.analytics,t,{actionCause:_p(e)}),c=kp(e),g=mp(e),v=Vd(e)??[],R=tv(e),h=uc(e.tabSet)||"default",y=jd(e),b=mh(e),x=t.referrer||"",I=Ky(e),N=Xy(e),_=zT(e),P=Wy(e),w=Yy(e),O=zy(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Cy(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(R.length&&{facets:R}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Ip(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,..._,...(w??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:N,...(I&&{facetOptions:I}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},ev=(e,t)=>{let r=yn(e)?.q,n=tv(e),o=Ki(e.configuration.analytics,t,{actionCause:_p(e)}),i=jd(e),a=uc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=rv(e),g=kp(e),v=mp(e),R=fp(e),h=Vd(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(R?.contextValues&&{context:R.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},tv=e=>cc(e)?.map(t=>Cp(t,xp())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),zT=e=>({actionsHistory:e.configuration.analytics.enabled?ht.getInstance().getHistory():[]}),rv=e=>{let t=Ey(e),r=Tp(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var lc=["searching","thinking","answering"];function dc(e){return e.toLowerCase()}var pc=["search","generic"];m();d();f();p();var nv=["text/plain","text/markdown"];var Po=new H({required:!0}),ov=new H,No=new fe({required:!0}),Op={id:Po,title:Po,uri:Po,permanentid:Po,clickUri:ov},fc=new H({required:!0,constrainTo:nv}),iv=new H({required:!0,constrainTo:lc}),av=e=>({...e,name:dc(e.name)}),oz=L("generatedAnswer/setIsVisible",e=>V(e,No)),mc=L("generatedAnswer/setAnswerId",e=>V(e,Y)),iz=L("generatedAnswer/setAnswerGenerationMode",e=>V(e,new H({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),az=L("generatedAnswer/setIsEnabled",e=>V(e,No)),ea=L("generatedAnswer/updateMessage",e=>V(e,{textDelta:Po})),ta=L("generatedAnswer/updateCitations",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Op})})})),ra=L("generatedAnswer/updateError",e=>V(e,{message:ov,code:new ne({min:0})})),gc=L("generatedAnswer/resetAnswer"),sz=L("generatedAnswer/like"),cz=L("generatedAnswer/dislike"),uz=L("generatedAnswer/feedbackModal/open"),lz=L("generatedAnswer/expand"),dz=L("generatedAnswer/collapse"),pz=L("generatedAnswer/setId",e=>V(e,{id:new H({required:!0})})),fz=L("generatedAnswer/feedbackModal/close"),mz=L("generatedAnswer/sendFeedback"),qr=L("generatedAnswer/setIsLoading",e=>V(e,No)),Ji=L("generatedAnswer/setIsStreaming",e=>V(e,No)),na=L("generatedAnswer/setAnswerContentFormat",e=>V(e,fc)),gz=L("generatedAnswer/updateResponseFormat",e=>V(e,{contentFormat:new Ae({each:fc,default:["text/plain"]})})),hz=L("knowledge/updateAnswerConfigurationId",e=>V(e,Po)),yz=L("generatedAnswer/registerFieldsToIncludeInCitations",e=>V(e,ps)),Pp=L("generatedAnswer/setIsAnswerGenerated",e=>V(e,No)),oa=L("generatedAnswer/setCannotAnswer",e=>V(e,No)),WT=L("generatedAnswer/setAnswerApiQueryParams",e=>V(e,new re({}))),sv=L("generatedAnswer/startStep",e=>V(av(e),{name:iv,startedAt:new ne({min:0,required:!0})})),cv=L("generatedAnswer/finishStep",e=>V(av(e),{name:iv,finishedAt:new ne({min:0,required:!0})})),uv=L("generatedAnswer/startToolCall",e=>V(e,{toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),lv=L("generatedAnswer/finishToolCall",e=>V(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),hc=L("generatedAnswer/toolCallArgs",e=>V(e,{toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})})),vz=ke("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:u}=s,{setAbortControllerRef:c}=e,g=yield Zy(r),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let x=JSON.parse(b);n(na(x.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(b)));break;case"genqa.citationsType":n(ta(JSON.parse(b)));break;case"genqa.endOfStreamType":{let x=JSON.parse(b).answerGenerated,{answerId:I,answer:N}=i().generatedAnswer,P=u.length!==0&&!x,w=!N?.trim();n(oa(P)),n(Ji(!1)),n(Pp(x)),n((a??nc).logGeneratedAnswerStreamEnd(x,I,x?w:void 0)),n(_o());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};n(qr(!0));let R=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{R(g)&&(n(qr(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{R(g)&&n(ra(y))},close:()=>{R(g)&&n(Ji(!1))},resetAnswer:()=>{R(g)&&n(gc())}});h?c(h):n(qr(!1))});return function(_x74,_x75){return _ref12.apply(this,arguments)}}()),Sz=ke("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(gc());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=Jy(i,n);r(WT(a)),yield r(dv(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(_x76,_x77){return _ref13.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function fv(_x78,_x79){return _fv.apply(this,arguments)}function _fv(){_fv=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _fv.apply(this,arguments)}function mv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=YT(t,a);let s=t.length,u=0;for(;r<s;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===s?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function gv(e,t,r){let n=pv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=pv();else if(s>0){let u=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
|
|
32
|
-
${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":KT(g,n,t);break}}}}function KT(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function YT(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function pv(){return{data:"",event:"",id:"",retry:void 0}}var Np="text/event-stream",XT=1e3,hv="last-event-id";function yv(){return typeof window<"u"}function vv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:u,...c}){return new Promise((g,v)=>{let R={...r};R.accept||(R.accept=Np);let h;function y(){h?.abort(),document.hidden||P()}!s&&yv()&&document.addEventListener("visibilitychange",y);let b=XT,x;function I(){yv()&&document.removeEventListener("visibilitychange",y),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let N=u??C,_=n??ZT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let w=yield N(e,{...c,headers:R,signal:h?.signal});yield _(w),yield fv(w.body,mv(gv(O=>{O?R[hv]=O:delete R[hv]},O=>{b=O},o))),i?.(),I(),g()}catch(w){if(!h?.signal?.aborted)try{let O=a?.(w)??b;clearTimeout(x),x=setTimeout(P,O)}catch(O){I(),v(O)}}});return _P2.apply(this,arguments)}P()})}function ZT(e){let t=e.headers.get("content-type");if(!t?.startsWith(Np))throw new Error(`Expected content-type to be ${Np}, Actual: ${t}`)}m();d();f();p();var JT=/*#__PURE__*/function(){var _JT=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Jn(n.configuration.search?.apiBaseUrl,a,i);return dy({baseUrl:`${c}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _fetchFn=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let v=g.url,R={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{R[h]=g[h]}),R.duplex="half",R.body=yield g.text(),C(v,R)});function fetchFn(_x83){return _fetchFn.apply(this,arguments)}return fetchFn}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});function JT(_x80,_x81,_x82){return _JT.apply(this,arguments)}return JT}(),Sv=xy({reducerPath:"answer",baseQuery:fy(JT,{maxRetries:3}),endpoints:()=>({})});var e0=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},t0=(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)},r0=(e,t)=>{delete e.error,e.citations=t.citations},n0=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},o0=(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})`)},i0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&o0(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(e0(t,i),r(na(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(t0(t,i),r(ea({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(r0(t,i),r(ta({citations:i.citations})));break;case"genqa.endOfStreamType":{n0(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(_o());break}}},a0=(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`},Fp=Sv.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(_x84,_x85){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:u,insightConfiguration:c}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:v,environment:R,accessToken:h}=s,y=Jn(s.search.apiBaseUrl,v,R),b=a0(y,v,u.answerConfigurationId,c?.insightId);yield vv(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:C,onopen:function(){var _onopen=_asyncToGenerator(function*(x){let I=x.headers.get("x-answer-id");I&&o(N=>{N.answerId=I,i(mc(I))})});function onopen(_x86){return _onopen.apply(this,arguments)}return onopen}(),onmessage:x=>{o(I=>{i0(x,I,i,g??nc)})},onerror:x=>{throw x},onclose:()=>{o(x=>{i(oa(!x.generated))})}})}).apply(this,arguments)}})})}),dv=e=>Fp.endpoints.getAnswer.initiate(e);m();d();f();p();var bv=Be(so,e=>e);m();d();f();p();function s0(e){let t=e.payload?.analyticsAction;return Av(e)&&!ce(t)}function Av(e){return"type"in e}var wv=e=>t=>r=>{let n;s0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Av(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var hW=L("tab/register",e=>{let t=new re({values:{id:Y,expression:nt}});return V(e,t)}),yc=L("tab/updateActiveTab",e=>V(e,Y));m();d();f();p();var vc=jt(oc(),1),Ev=jt(xv(),1),Rv=jt(Cv(),1);vc.default.extend(Rv.default);vc.default.extend(Ev.default);var Iv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:vc.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();f();p();var c0=/(^|; )Coveo-Pendragon=([^;]*)/,u0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Tv(){return typeof window>"u"?!1:c0.exec(document.cookie)?.pop()||null}function _v(){return typeof window>"u"?!1:u0.test(document.cookie)}var kv=Be(Iv(),e=>e.addCase(Rr,(t,r)=>{l0(t,r.payload)}).addCase(Kt,(t,r)=>{d0(t,r.payload)}).addCase(co,(t,r)=>{p0(t,r.payload)}).addCase(uo,t=>{t.analytics.enabled=!1}).addCase(lo,t=>{t.analytics.enabled=!0}).addCase(fs,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(ms,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(yc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(qg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Ir,(t,r)=>{ce(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Mg,(t,{payload:r})=>{f0(t,r)}));function l0(e,t){ce(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ce(t.organizationId)||(e.organizationId=t.organizationId)}function d0(e,t){ce(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ce(t.locale)||(e.search.locale=t.locale),ce(t.timezone)||(e.search.timezone=t.timezone),ce(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function p0(e,t){ce(t.enabled)||(e.analytics.enabled=t.enabled),ce(t.originContext)||(e.analytics.originContext=t.originContext),ce(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ce(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ce(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ce(t.trackingId)||(e.analytics.trackingId=t.trackingId),ce(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ce(t.source)||(e.analytics.source=t.source);try{let r=Tv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ce(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ce(t.anonymous)||(e.analytics.anonymous=t.anonymous),ce(t.deviceId)||(e.analytics.deviceId=t.deviceId),ce(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ce(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function f0(e,t){e.knowledge.agentId=t;try{_v()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Vt=kv;m();d();f();p();function m0(e){return e.instantlyCallable}var Ov=()=>e=>t=>e(m0(t)?t():t);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var at=[];for(let e=0;e<256;++e)at.push((e+256).toString(16).slice(1));function Pv(e,t=0){return(at[e[t+0]]+at[e[t+1]]+at[e[t+2]]+at[e[t+3]]+"-"+at[e[t+4]]+at[e[t+5]]+"-"+at[e[t+6]]+at[e[t+7]]+"-"+at[e[t+8]]+at[e[t+9]]+"-"+at[e[t+10]]+at[e[t+11]]+at[e[t+12]]+at[e[t+13]]+at[e[t+14]]+at[e[t+15]]).toLowerCase()}m();d();f();p();var jp,g0=new Uint8Array(16);function Up(){if(!jp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jp=crypto.getRandomValues.bind(crypto)}return jp(g0)}m();d();f();p();m();d();f();p();var h0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vp={randomUUID:h0};function y0(e,t,r){if(Vp.randomUUID&&!t&&!e)return Vp.randomUUID();e=e||{};let n=e.random??e.rng?.()??Up();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 Pv(n)}var jr=y0;m();d();f();p();m();d();f();p();var S={};ui(S,{BRAND:()=>B0,DIRTY:()=>Sn,EMPTY_PATH:()=>A0,INVALID:()=>de,NEVER:()=>I_,OK:()=>ft,ParseStatus:()=>st,Schema:()=>xe,ZodAny:()=>Gr,ZodArray:()=>Sr,ZodBigInt:()=>An,ZodBoolean:()=>wn,ZodBranded:()=>aa,ZodCatch:()=>Nn,ZodDate:()=>xn,ZodDefault:()=>Pn,ZodDiscriminatedUnion:()=>Ac,ZodEffects:()=>Mt,ZodEnum:()=>kn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>pe,ZodFunction:()=>xc,ZodIntersection:()=>In,ZodIssueCode:()=>K,ZodLazy:()=>Tn,ZodLiteral:()=>_n,ZodMap:()=>jo,ZodNaN:()=>Vo,ZodNativeEnum:()=>On,ZodNever:()=>Gt,ZodNull:()=>En,ZodNullable:()=>er,ZodNumber:()=>bn,ZodObject:()=>At,ZodOptional:()=>Ft,ZodParsedType:()=>te,ZodPipeline:()=>sa,ZodPromise:()=>Br,ZodReadonly:()=>Fn,ZodRecord:()=>wc,ZodSchema:()=>xe,ZodSet:()=>Uo,ZodString:()=>Vr,ZodSymbol:()=>Lo,ZodTransformer:()=>Mt,ZodTuple:()=>Jt,ZodType:()=>xe,ZodUndefined:()=>Cn,ZodUnion:()=>Rn,ZodUnknown:()=>vr,ZodVoid:()=>qo,addIssueToContext:()=>ee,any:()=>Z0,array:()=>r_,bigint:()=>z0,boolean:()=>Bv,coerce:()=>R_,custom:()=>Uv,date:()=>W0,datetimeRegex:()=>qv,defaultErrorMap:()=>hr,discriminatedUnion:()=>a_,effect:()=>v_,enum:()=>g_,function:()=>p_,getErrorMap:()=>Fo,getParsedType:()=>Zt,instanceof:()=>Q0,intersection:()=>s_,isAborted:()=>Sc,isAsync:()=>Do,isDirty:()=>bc,isValid:()=>Ur,late:()=>$0,lazy:()=>f_,literal:()=>m_,makeIssue:()=>ia,map:()=>l_,nan:()=>H0,nativeEnum:()=>h_,never:()=>e_,null:()=>X0,nullable:()=>b_,number:()=>Gv,object:()=>n_,objectUtil:()=>Gp,oboolean:()=>E_,onumber:()=>C_,optional:()=>S_,ostring:()=>x_,pipeline:()=>w_,preprocess:()=>A_,promise:()=>y_,quotelessJson:()=>v0,record:()=>u_,set:()=>d_,setErrorMap:()=>b0,strictObject:()=>o_,string:()=>Vv,symbol:()=>K0,transformer:()=>v_,tuple:()=>c_,undefined:()=>Y0,union:()=>i_,unknown:()=>J0,util:()=>Re,void:()=>t_});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Re||(Re={}));var Gp;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Gp||(Gp={}));var te=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zt=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var K=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),v0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var S0=(e,t)=>{let r;switch(e.code){case K.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case K.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Re.jsonStringifyReplacer)}`;break;case K.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(e.keys,", ")}`;break;case K.invalid_union:r="Invalid input";break;case K.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(e.options)}`;break;case K.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(e.options)}, received '${e.received}'`;break;case K.invalid_arguments:r="Invalid function arguments";break;case K.invalid_return_type:r="Invalid function return type";break;case K.invalid_date:r="Invalid date";break;case K.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case K.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case K.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case K.custom:r="Invalid input";break;case K.invalid_intersection_types:r="Intersection results could not be merged";break;case K.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case K.not_finite:r="Number must be finite";break;default:r=t.defaultError,Re.assertNever(e)}return{message:r}},hr=S0;var Nv=hr;function b0(e){Nv=e}function Fo(){return Nv}m();d();f();p();var ia=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},A0=[];function ee(e,t){let r=Fo(),n=ia({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===hr?void 0:hr].filter(o=>!!o)});e.common.issues.push(n)}var st=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return de;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return de;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},de=Object.freeze({status:"aborted"}),Sn=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),Sc=e=>e.status==="aborted",bc=e=>e.status==="dirty",Ur=e=>e.status==="valid",Do=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ie||(ie={}));var Dt=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}},Fv=(e,t)=>{if(Ur(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bt(e.common.issues);return this._error=r,this._error}}};function be(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var xe=class{get description(){return this._def.description}_getType(t){return Zt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Do(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:Zt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Fv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ur(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=>Ur(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Zt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Do(o)?o:Promise.resolve(o);return Fv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:K.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Mt({schema:this,typeName:pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ft.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Br.create(this,this._def)}or(t){return Rn.create([this,t],this._def)}and(t){return In.create(this,t,this._def)}transform(t){return new Mt({...be(this._def),schema:this,typeName:pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Pn({...be(this._def),innerType:this,defaultValue:r,typeName:pe.ZodDefault})}brand(){return new aa({typeName:pe.ZodBranded,type:this,...be(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Nn({...be(this._def),innerType:this,catchValue:r,typeName:pe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return sa.create(this,t)}readonly(){return Fn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w0=/^c[^\s-]{8,}$/i,x0=/^[0-9a-z]+$/,C0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E0=/^[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,R0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T0=/^[-+]?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)?)??$/,_0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,k0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Bp,O0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P0=/^(?:(?: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])$/,N0=/^(([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]))$/,F0=/^(([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])$/,D0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mv="((\\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])))",L0=new RegExp(`^${Mv}$`);function Lv(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 q0(e){return new RegExp(`^${Lv(e)}$`)}function qv(e){let t=`${Mv}T${Lv(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 j0(e,t){return!!((t==="v4"||!t)&&O0.test(e)||(t==="v6"||!t)&&N0.test(e))}function U0(e,t){if(!I0.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 V0(e,t){return!!((t==="v4"||!t)&&P0.test(e)||(t==="v6"||!t)&&F0.test(e))}var Vr=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.string,received:i.parsedType}),de}let n=new st,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:K.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:K.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")_0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Bp||(Bp=new RegExp(k0,"u")),Bp.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")E0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")R0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")w0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")x0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")C0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:K.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:K.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:K.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?qv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?L0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?q0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:K.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?T0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?j0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?U0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?V0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?D0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:K.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?M0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:K.invalid_string,message:i.message}),n.dirty()):Re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:K.invalid_string,...ie.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ie.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ie.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ie.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ie.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ie.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ie.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ie.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ie.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ie.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ie.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ie.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ie.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ie.errToObj(r)})}nonempty(t){return this.min(1,ie.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Vr.create=e=>new Vr({checks:[],typeName:pe.ZodString,coerce:e?.coerce??!1,...be(e)});function G0(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 bn=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.number,received:i.parsedType}),de}let n,o=new st;for(let i of this._def.checks)i.kind==="int"?Re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?G0(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_finite,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bn.create=e=>new bn({checks:[],typeName:pe.ZodNumber,coerce:e?.coerce||!1,...be(e)});var An=class e extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new st;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:K.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.bigint,received:r.parsedType}),de}gte(t,r){return this.setLimit("min",t,!0,ie.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ie.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ie.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ie.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ie.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};An.create=e=>new An({checks:[],typeName:pe.ZodBigInt,coerce:e?.coerce??!1,...be(e)});var wn=class extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.boolean,received:n.parsedType}),de}return ft(t.data)}};wn.create=e=>new wn({typeName:pe.ZodBoolean,coerce:e?.coerce||!1,...be(e)});var xn=class e extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_type,expected:te.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:K.invalid_date}),de}let n=new st,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:K.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};xn.create=e=>new xn({checks:[],coerce:e?.coerce||!1,typeName:pe.ZodDate,...be(e)});var Lo=class extends xe{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.symbol,received:n.parsedType}),de}return ft(t.data)}};Lo.create=e=>new Lo({typeName:pe.ZodSymbol,...be(e)});var Cn=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.undefined,received:n.parsedType}),de}return ft(t.data)}};Cn.create=e=>new Cn({typeName:pe.ZodUndefined,...be(e)});var En=class extends xe{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.null,received:n.parsedType}),de}return ft(t.data)}};En.create=e=>new En({typeName:pe.ZodNull,...be(e)});var Gr=class extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}};Gr.create=e=>new Gr({typeName:pe.ZodAny,...be(e)});var vr=class extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}};vr.create=e=>new vr({typeName:pe.ZodUnknown,...be(e)});var Gt=class extends xe{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:K.invalid_type,expected:te.never,received:r.parsedType}),de}};Gt.create=e=>new Gt({typeName:pe.ZodNever,...be(e)});var qo=class extends xe{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.void,received:n.parsedType}),de}return ft(t.data)}};qo.create=e=>new qo({typeName:pe.ZodVoid,...be(e)});var Sr=class e extends xe{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return ee(r,{code:K.invalid_type,expected:te.array,received:r.parsedType}),de;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?K.too_big:K.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:K.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:K.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Dt(r,a,r.path,s)))).then(a=>st.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Dt(r,a,r.path,s)));return st.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ie.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ie.toString(r)}})}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pe.ZodArray,...be(t)});function Mo(e){if(e instanceof At){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ft.create(Mo(n))}return new At({...e._def,shape:()=>t})}else return e instanceof Sr?new Sr({...e._def,type:Mo(e.element)}):e instanceof Ft?Ft.create(Mo(e.unwrap())):e instanceof er?er.create(Mo(e.unwrap())):e instanceof Jt?Jt.create(e.items.map(t=>Mo(t))):e}var At=class e extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return ee(c,{code:K.invalid_type,expected:te.object,received:c.parsedType}),de}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let u=[];for(let c of a){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new Dt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")s.length>0&&(ee(o,{code:K.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new Dt(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let v=yield g.key,R=yield g.value;c.push({key:v,value:R,alwaysSet:g.alwaysSet})}return c})).then(c=>st.mergeObjectSync(n,c)):st.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ie.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Mo(this)}partial(t){let r={};for(let n of Re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ft;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return jv(Re.objectKeys(this.shape))}};At.create=(e,t)=>new At({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.strictCreate=(e,t)=>new At({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});At.lazycreate=(e,t)=>new At({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:pe.ZodObject,...be(t)});var Rn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new bt(s.ctx.common.issues));return ee(r,{code:K.invalid_union,unionErrors:a}),de}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref15=_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(_x87){return _ref15.apply(this,arguments)}}())).then(o);{let i,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new bt(u));return ee(r,{code:K.invalid_union,unionErrors:s}),de}}get options(){return this._def.options}};Rn.create=(e,t)=>new Rn({options:e,typeName:pe.ZodUnion,...be(t)});var yr=e=>e instanceof Tn?yr(e.schema):e instanceof Mt?yr(e.innerType()):e instanceof _n?[e.value]:e instanceof kn?e.options:e instanceof On?Re.objectValues(e.enum):e instanceof Pn?yr(e._def.innerType):e instanceof Cn?[void 0]:e instanceof En?[null]:e instanceof Ft?[void 0,...yr(e.unwrap())]:e instanceof er?[null,...yr(e.unwrap())]:e instanceof aa||e instanceof Fn?yr(e.unwrap()):e instanceof Nn?yr(e._def.innerType):[],Ac=class e extends xe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return ee(r,{code:K.invalid_type,expected:te.object,received:r.parsedType}),de;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:K.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=yr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:pe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...be(n)})}};function $p(e,t){let r=Zt(e),n=Zt(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Re.objectKeys(t),i=Re.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=$p(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=$p(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var In=class extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Sc(i)||Sc(a))return de;let s=$p(i.value,a.value);return s.valid?((bc(i)||bc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:K.invalid_intersection_types}),de)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};In.create=(e,t,r)=>new In({left:e,right:t,typeName:pe.ZodIntersection,...be(r)});var Jt=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return ee(n,{code:K.invalid_type,expected:te.array,received:n.parsedType}),de;if(n.data.length<this._def.items.length)return ee(n,{code:K.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:K.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Dt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>st.mergeArray(r,a)):st.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jt({items:e,typeName:pe.ZodTuple,rest:null,...be(t)})};var wc=class e extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return ee(n,{code:K.invalid_type,expected:te.object,received:n.parsedType}),de;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Dt(n,s,n.path,s)),value:a._parse(new Dt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?st.mergeObjectAsync(r,o):st.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof xe?new e({keyType:t,valueType:r,typeName:pe.ZodRecord,...be(n)}):new e({keyType:Vr.create(),valueType:t,typeName:pe.ZodRecord,...be(r)})}},jo=class extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return ee(n,{code:K.invalid_type,expected:te.map,received:n.parsedType}),de;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new Dt(n,s,n.path,[c,"key"])),value:i._parse(new Dt(n,u,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of a){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let u of a){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};jo.create=(e,t,r)=>new jo({valueType:t,keyType:e,typeName:pe.ZodMap,...be(r)});var Uo=class e extends xe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return ee(n,{code:K.invalid_type,expected:te.set,received:n.parsedType}),de;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:K.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:K.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let c=new Set;for(let g of u){if(g.status==="aborted")return de;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((u,c)=>i._parse(new Dt(n,u,n.path,c)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:ie.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ie.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Uo.create=(e,t)=>new Uo({valueType:e,minSize:null,maxSize:null,typeName:pe.ZodSet,...be(t)});var xc=class e extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return ee(r,{code:K.invalid_type,expected:te.function,received:r.parsedType}),de;function n(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_arguments,argumentsError:u}})}function o(s,u){return ia({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fo(),hr].filter(c=>!!c),issueData:{code:K.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Br){let s=this;return ft(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new bt([]),g=yield s._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),v=yield Reflect.apply(a,this,g);return yield s._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let s=this;return ft(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new bt([n(u,c.error)]);let g=Reflect.apply(a,this,c.data),v=s._def.returns.safeParse(g,i);if(!v.success)throw new bt([o(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Jt.create(t).rest(vr.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||Jt.create([]).rest(vr.create()),returns:r||vr.create(),typeName:pe.ZodFunction,...be(n)})}},Tn=class extends xe{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Tn.create=(e,t)=>new Tn({getter:e,typeName:pe.ZodLazy,...be(t)});var _n=class extends xe{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:K.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};_n.create=(e,t)=>new _n({value:e,typeName:pe.ZodLiteral,...be(t)});function jv(e,t){return new kn({values:e,typeName:pe.ZodEnum,...be(t)})}var kn=class e extends xe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Re.joinValues(n),received:r.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:K.invalid_enum_value,options:n}),de}return ft(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})}};kn.create=jv;var On=class extends xe{_parse(t){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Re.objectValues(r);return ee(n,{expected:Re.joinValues(o),received:n.parsedType,code:K.invalid_type}),de}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Re.objectValues(r);return ee(n,{received:n.data,code:K.invalid_enum_value,options:o}),de}return ft(t.data)}get enum(){return this._def.values}};On.create=(e,t)=>new On({values:e,typeName:pe.ZodNativeEnum,...be(t)});var Br=class extends xe{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return ee(r,{code:K.invalid_type,expected:te.promise,received:r.parsedType}),de;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return ft(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:pe.ZodPromise,...be(t)});var Mt=class extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(s){if(r.value==="aborted")return de;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?de:u.status==="dirty"?Sn(u.value):r.value==="dirty"?Sn(u.value):u});return function(_x88){return _ref18.apply(this,arguments)}}());{if(r.value==="aborted")return de;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?de:s.status==="dirty"?Sn(s.value):r.value==="dirty"?Sn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?de:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ur(a))return de;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Ur(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):de);Re.assertNever(o)}};Mt.create=(e,t,r)=>new Mt({schema:e,typeName:pe.ZodEffects,effect:t,...be(r)});Mt.createWithPreprocess=(e,t,r)=>new Mt({schema:t,effect:{type:"preprocess",transform:e},typeName:pe.ZodEffects,...be(r)});var Ft=class extends xe{_parse(t){return this._getType(t)===te.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ft.create=(e,t)=>new Ft({innerType:e,typeName:pe.ZodOptional,...be(t)});var er=class extends xe{_parse(t){return this._getType(t)===te.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};er.create=(e,t)=>new er({innerType:e,typeName:pe.ZodNullable,...be(t)});var Pn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pn.create=(e,t)=>new Pn({innerType:e,typeName:pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...be(t)});var Nn=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Do(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...be(t)});var Vo=class extends xe{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:K.invalid_type,expected:te.nan,received:n.parsedType}),de}return{status:"valid",value:t.data}}};Vo.create=e=>new Vo({typeName:pe.ZodNaN,...be(e)});var B0=Symbol("zod_brand"),aa=class extends xe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},sa=class e extends xe{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?de:i.status==="dirty"?(r.dirty(),Sn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?de:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:pe.ZodPipeline})}},Fn=class extends xe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ur(o)&&(o.value=Object.freeze(o.value)),o);return Do(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Fn.create=(e,t)=>new Fn({innerType:e,typeName:pe.ZodReadonly,...be(t)});function Dv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Uv(e,t={},r){return e?Gr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Dv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Dv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Gr.create()}var $0={object:At.lazycreate},pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(pe||(pe={}));var Q0=(e,t={message:`Input not instance of ${e.name}`})=>Uv(r=>r instanceof e,t),Vv=Vr.create,Gv=bn.create,H0=Vo.create,z0=An.create,Bv=wn.create,W0=xn.create,K0=Lo.create,Y0=Cn.create,X0=En.create,Z0=Gr.create,J0=vr.create,e_=Gt.create,t_=qo.create,r_=Sr.create,n_=At.create,o_=At.strictCreate,i_=Rn.create,a_=Ac.create,s_=In.create,c_=Jt.create,u_=wc.create,l_=jo.create,d_=Uo.create,p_=xc.create,f_=Tn.create,m_=_n.create,g_=kn.create,h_=On.create,y_=Br.create,v_=Mt.create,S_=Ft.create,b_=er.create,A_=Mt.createWithPreprocess,w_=sa.create,x_=()=>Vv().optional(),C_=()=>Gv().optional(),E_=()=>Bv().optional(),R_={string:e=>Vr.create({...e,coerce:!0}),number:e=>bn.create({...e,coerce:!0}),boolean:e=>wn.create({...e,coerce:!0}),bigint:e=>An.create({...e,coerce:!0}),date:e=>xn.create({...e,coerce:!0})};var I_=de;var T_=S.record(S.any()),Dn=T_.optional();function $v(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var __=S.object({name:S.string(),arguments:S.string()}),k_=S.object({id:S.string(),type:S.literal("function"),function:__,encryptedValue:S.string().optional(),metadata:Dn}),Cc=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),O_=S.object({type:S.literal("text"),text:S.string()}),P_=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),N_=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Ec=S.discriminatedUnion("type",[P_,N_]),F_=S.object({type:S.literal("image"),source:Ec,metadata:S.unknown().optional()}),D_=S.object({type:S.literal("audio"),source:Ec,metadata:S.unknown().optional()}),M_=S.object({type:S.literal("video"),source:Ec,metadata:S.unknown().optional()}),L_=S.object({type:S.literal("document"),source:Ec,metadata:S.unknown().optional()});var Qv=S.object({type:S.literal("binary"),mimeType:S.string(),id:S.string().optional(),url:S.string().optional(),data:S.string().optional(),filename:S.string().optional()}),Hv=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:S.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},z8=Qv.superRefine((e,t)=>{Hv(e,t)}),q_=S.discriminatedUnion("type",[O_,F_,D_,M_,L_,Qv]),j_=q_.superRefine((e,t)=>{e.type==="binary"&&Hv(e,t)}),U_=Cc.extend({role:S.literal("developer"),content:S.string()}),V_=Cc.extend({role:S.literal("system"),content:S.string()}),G_=Cc.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(k_).optional()}),B_=Cc.extend({role:S.literal("user"),content:S.union([S.string(),S.array(j_)])}),$_=S.object({id:S.string(),content:S.string(),role:S.literal("tool"),toolCallId:S.string(),error:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),Q_=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Dn}),H_=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Dn}),zv=S.discriminatedUnion("role",[U_,V_,G_,B_,$_,Q_,H_]),W8=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),z_=S.object({description:S.string(),value:S.string()}),Wv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),W_=S.object({id:S.string(),reason:S.string(),message:S.string().optional(),toolCallId:S.string().optional(),responseSchema:S.record(S.any()).optional(),expiresAt:S.string().optional(),metadata:S.record(S.any()).optional(),subagentRunId:S.string().optional()}),K_=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Dn}),Y_=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(zv),tools:S.array(Wv),context:S.array(z_),forwardedProps:S.any(),resume:S.array(K_).optional()}),X_=S.any(),ge=class extends Error{constructor(e){super(e)}},Qp=class extends ge{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Z_=S.object({name:S.string(),description:S.string().optional()}),J_=S.object({name:S.string().optional(),type:S.string().optional(),description:S.string().optional(),version:S.string().optional(),provider:S.string().optional(),documentationUrl:S.string().optional(),metadata:S.record(S.unknown()).optional()}),ek=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),tk=S.object({supported:S.boolean().optional(),items:S.array(Wv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),rk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),nk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),ok=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(Z_).optional()}),ik=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),ak=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),sk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),ck=S.object({input:ak.optional(),output:sk.optional()}),uk=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),lk=S.object({supported:S.boolean().optional(),approvals:S.boolean().optional(),interventions:S.boolean().optional(),feedback:S.boolean().optional(),interrupts:S.boolean().optional(),approveWithEdits:S.boolean().optional()}),K8=S.object({identity:J_.optional(),transport:ek.optional(),tools:tk.optional(),output:rk.optional(),state:nk.optional(),multiAgent:ok.optional(),reasoning:ik.optional(),multimodal:ck.optional(),execution:uk.optional(),humanInTheLoop:lk.optional(),custom:S.record(S.unknown()).optional()}),Kv=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user")]),F=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Ie=S.object({type:S.nativeEnum(F),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Dn}).passthrough(),dk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:Kv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Yv=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),pk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),fk=Ie.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:Kv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),mk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),gk=Yv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),hk=Ie.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),yk=Ie.extend({type:S.literal(F.TOOL_CALL_START),toolCallId:S.string(),toolCallName:S.string(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),subagentRunId:S.string().optional()}),vk=Ie.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Sk=Ie.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),bk=Ie.extend({messageId:S.string(),type:S.literal(F.TOOL_CALL_RESULT),toolCallId:S.string(),content:S.string(),role:S.literal("tool").optional(),subagentRunId:S.string().optional()}),Ak=Ie.extend({type:S.literal(F.TOOL_CALL_CHUNK),toolCallId:S.string().optional(),toolCallName:S.string().optional(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),delta:S.string().optional(),subagentRunId:S.string().optional()}),wk=Ie.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),xk=Ie.extend({type:S.literal(F.THINKING_END)}),Ck=Ie.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:X_,subagentRunId:S.string().optional()}),Ek=Ie.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),Rk=Ie.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(zv)}),Ik=Ie.extend({type:S.literal(F.ACTIVITY_SNAPSHOT),messageId:S.string(),activityType:S.string(),content:S.record(S.any()),replace:S.boolean().optional().default(!0),subagentRunId:S.string().optional()}),Tk=Ie.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),_k=Ie.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),kk=Ie.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Ok=Ie.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Y_.optional()}),Pk=S.object({type:S.literal("success")}).strict(),Nk=S.object({type:S.literal("interrupt"),interrupts:S.array(W_).min(1)}).strict(),Fk=S.discriminatedUnion("type",[Pk,Nk]),Xv=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),Dk=Ie.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:Fk.nullable().optional().transform(e=>e??void 0),usage:S.array(Xv).optional()}),Mk=Ie.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(Xv).optional()}),Lk=Ie.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),qk=Ie.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),jk=S.union([S.literal("tool-call"),S.literal("message")]),Uk=Ie.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),Gk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Bk=Ie.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),$k=Ie.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),Qk=Ie.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),Hk=Ie.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:jk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),zk=Ie.extend({type:S.literal(F.SUBAGENT_STARTED),subagentRunId:S.string(),name:S.string(),description:S.string().optional(),parentSubagentRunId:S.string().optional(),parentToolCallId:S.string().optional(),parentMessageId:S.string().optional()}),Wk=S.object({type:S.literal("success")}).strict(),Kk=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),Yk=S.discriminatedUnion("type",[Wk,Kk]),Xk=Ie.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:Yk.optional()}),Zk=Ie.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),Rc=S.discriminatedUnion("type",[dk,Yv,pk,fk,wk,xk,mk,gk,hk,yk,vk,Sk,Ak,bk,Ck,Ek,Rk,Ik,Tk,_k,kk,Ok,Dk,Mk,Lk,qk,Uk,Vk,Gk,Bk,$k,Qk,Hk,zk,Xk,Zk]);m();d();f();p();var Hp={};ui(Hp,{JsonPatchError:()=>$e,_areEquals:()=>la,applyOperation:()=>Mn,applyPatch:()=>Nc,applyReducer:()=>nO,deepClone:()=>tO,getValueByPointer:()=>Oc,validate:()=>Jv,validator:()=>Pc});m();d();f();p();m();d();f();p();var Jk=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)}}(),eO=Object.prototype.hasOwnProperty;function Tc(e,t){return eO.call(e,t)}function _c(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)Tc(e,o)&&n.push(o);return n}function ct(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function kc(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 tr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ca(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ic(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ic(e[t]))return!0}else if(typeof e=="object"){for(var n=_c(e),o=n.length,i=0;i<o;i++)if(Ic(e[n[i]]))return!0}}return!1}function Zv(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 ua=function(e){Jk(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,Zv(r,{name:n,index:o,operation:i,tree:a}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=a,Object.setPrototypeOf(u,s.prototype),u.message=Zv(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var $e=ua,tO=ct,Go={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=Oc(r,this.path);n&&(n=ct(n));var o=Mn(r,{op:"remove",path:this.from}).removed;return Mn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Oc(r,this.from);return Mn(r,{op:"add",path:this.path,value:ct(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:la(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rO={add:function(e,t,r){return kc(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:Go.move,copy:Go.copy,test:Go.test,_get:Go._get};function Oc(e,t){if(t=="")return e;var r={op:"_get",path:t};return Mn(e,r),r.value}function Mn(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):Pc(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=Oc(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=la(e,t.value),a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=ct(e));var s=t.path||"",u=s.split("/"),c=e,g=1,v=u.length,R=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Pc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=ca(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&R===void 0&&(c[h]===void 0?R=u.slice(0,g).join("/"):g==v-1&&(R=t.path),R!==void 0&&y(t,0,e,R)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!kc(h))throw new $e("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);kc(h)&&(h=~~h)}if(g>=v){if(r&&t.op==="add"&&h>c.length)throw new $e("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=rO[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=v){var a=Go[t.op].call(t,c,h,e);if(a.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<v&&(!c||typeof c!="object"))throw new $e("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Nc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ct(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Mn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function nO(e,t,r){var n=Mn(e,t);if(n.test===!1)throw new $e("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Pc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new $e("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Go[e.op]){if(typeof e.path!="string")throw new $e("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new $e("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new $e("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new $e("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ic(e.value))throw new $e("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new $e("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new $e("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=Jv([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $e("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new $e("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function Jv(e,t,r){try{if(!Array.isArray(e))throw new $e("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Nc(ct(t),ct(e),r||!0);else{r=r||Pc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof $e)return o;throw o}}function la(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(!la(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!la(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Yp={};ui(Yp,{compare:()=>dO,generate:()=>zp,observe:()=>lO,unobserve:()=>uO});m();d();f();p();var Wp=new WeakMap,oO=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),iO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function aO(e){return Wp.get(e)}function sO(e,t){return e.observers.get(t)}function cO(e,t){e.observers.delete(t.callback)}function uO(e,t){t.unobserve()}function lO(e,t){var r=[],n,o=aO(e);if(!o)o=new oO(e),Wp.set(e,o);else{var i=sO(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=ct(e),t){n.callback=t,n.next=null;var a=function(){zp(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){zp(n),clearTimeout(n.next),cO(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new iO(t,n)),n}function zp(e,t){t===void 0&&(t=!1);var r=Wp.get(e.object);Kp(r.value,e.object,e.patches,"",t),e.patches.length&&Nc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Kp(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=_c(t),a=_c(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],v=e[g];if(Tc(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var R=t[g];typeof v=="object"&&v!=null&&typeof R=="object"&&R!=null&&Array.isArray(v)===Array.isArray(R)?Kp(v,R,r,n+"/"+tr(g),o):v!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"replace",path:n+"/"+tr(g),value:ct(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+tr(g),value:ct(v)}),r.push({op:"remove",path:n+"/"+tr(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!Tc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+tr(g),value:ct(t[g])})}}}function dO(e,t,r){r===void 0&&(r=!1);var n=[];return Kp(e,t,n,"",r),n}var Fc=Object.assign({},Hp,Yp,{JsonPatchError:ua,deepClone:ct,escapePathComponent:tr,unescapePathComponent:ca});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Xp=function(e,t){return Xp=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])},Xp(e,t)};function rr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Xp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function eS(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(v){a(v)}}function u(g){try{c(n.throw(g))}catch(v){a(v)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}function Dc(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function br(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 Bo(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function $o(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 Ln(e){return this instanceof Ln?(this.v=e,this):new Ln(e)}function tS(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(y){return Promise.resolve(y).then(h,v)}}function s(h,y){n[h]&&(o[h]=function(b){return new Promise(function(x,I){i.push([h,b,x,I])>1||u(h,b)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(n[h](y))}catch(b){R(i[0][3],b)}}function c(h){h.value instanceof Ln?Promise.resolve(h.value.v).then(g,v):R(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function R(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function rS(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 br=="function"?br(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}m();d();f();p();function Ee(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Qo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Mc=Qo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
31
|
+
`;function QR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var HR=["1",1,"yes",!0];function zR(){let e=[];return Pd()&&e.push(window.doNotTrack),Hd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>HR.indexOf(t)!==-1)}function $s(e){return e===!0?!1:zR()}var bh="v15",Ah={default:"https://analytics.cloud.coveo.com/rest/ua"};function WR(e=Ah.default,t=bh,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 KR="38824e1f-37f5-42d3-8372-a4b8fa9df946",Jt=class{get defaultOptions(){return{endpoint:Ah.default,isCustomEndpoint:!1,token:"",version:bh,beforeSendHooks:[],afterSendHooks:[]}}get version(){return hh}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=[LE,OE].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};$s(this.options.disableBrowserPrivacySignals)?this.runtime=new Gs:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ce.view,{newEventType:Ce.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.click,{newEventType:Ce.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.custom,{newEventType:Ce.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ce.search,{newEventType:Ce.search,addClientIdParameter:!0})}initRuntime(t){return Pd()&&wo()?new $d(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(QR()&&console.warn($R),new Qd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return Pd()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Sn()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Sn()}})}getCurrentVisitorId(){return 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(Ls(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(js(t,js(r,KR)))}})}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(Sn()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if($s(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Pr.cvo_cid);if(r==null)return null;let n=Pr.fromString(r);return!n||!wo()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((v,w)=>G(this,void 0,void 0,function*(){let E=yield v;return yield w(t,E)}),h)].reduce((h,v)=>G(this,void 0,void 0,function*(){let w=yield h;return yield v(w)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[y=>this.setTrackingIdIfTrackingIdNotPresent(y),y=>this.removeEmptyPayloadValues(y,t),y=>this.validateParams(y,t),y=>n?FR(y):y,y=>n?this.removeUnknownParameters(y):y,y=>n?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,R)=>G(this,void 0,void 0,function*(){let h=yield y;return yield R(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>G(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),(new qs).clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.search,t)})}sendSearchEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=mr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.click,t)})}sendClickEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=mr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.custom,t)})}sendCustomEvent(t){return G(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=mr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Ce.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield x(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(this,void 0,void 0,function*(){return yield(yield x(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[Ce.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(LR(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=mr(t,["custom"]),o={};r&&Ms(r)&&(o=this.lowercaseKeys(r));let i=jR(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=mr(t,["custom"]);if(r&&Ms(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=mr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ce.view||r==Ce.click||r==Ce.search||r==Ce.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ce.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=mr(t,["userId"]);return GR(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=mr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Ms(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Ms(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"?XE(t,r):t}get baseUrl(){return WR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},gr;(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"})(gr||(gr={}));var H;(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"})(H||(H={}));var lh={[H.triggerNotify]:"queryPipelineTriggers",[H.triggerExecute]:"queryPipelineTriggers",[H.triggerQuery]:"queryPipelineTriggers",[H.triggerRedirect]:"queryPipelineTriggers",[H.queryErrorBack]:"errors",[H.queryErrorClear]:"errors",[H.queryErrorRetry]:"errors",[H.pagerNext]:"getMoreResults",[H.pagerPrevious]:"getMoreResults",[H.pagerNumber]:"getMoreResults",[H.pagerResize]:"getMoreResults",[H.pagerScrolling]:"getMoreResults",[H.facetSearch]:"facet",[H.facetShowLess]:"facet",[H.facetShowMore]:"facet",[H.recommendation]:"recommendation",[H.likeSmartSnippet]:"smartSnippet",[H.dislikeSmartSnippet]:"smartSnippet",[H.expandSmartSnippet]:"smartSnippet",[H.collapseSmartSnippet]:"smartSnippet",[H.openSmartSnippetFeedbackModal]:"smartSnippet",[H.closeSmartSnippetFeedbackModal]:"smartSnippet",[H.sendSmartSnippetReason]:"smartSnippet",[H.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[H.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[H.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[H.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[H.clearRecentQueries]:"recentQueries",[H.recentResultClick]:"recentlyClickedDocuments",[H.clearRecentResults]:"recentlyClickedDocuments",[H.showLessFoldedResults]:"folding",[H.caseDetach]:"case",[H.likeGeneratedAnswer]:"generatedAnswer",[H.dislikeGeneratedAnswer]:"generatedAnswer",[H.openGeneratedAnswerSource]:"generatedAnswer",[H.generatedAnswerOpenInlineLink]:"generatedAnswer",[H.generatedAnswerFollowupOpenSource]:"generatedAnswer",[H.generatedAnswerStreamEnd]:"generatedAnswer",[H.generatedAnswerSourceHover]:"generatedAnswer",[H.generatedAnswerCopyToClipboard]:"generatedAnswer",[H.generatedAnswerHideAnswers]:"generatedAnswer",[H.generatedAnswerShowAnswers]:"generatedAnswer",[H.generatedAnswerExpand]:"generatedAnswer",[H.generatedAnswerCollapse]:"generatedAnswer",[H.generatedAnswerFeedbackSubmit]:"generatedAnswer",[H.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[gr.expandToFullUI]:"interface",[gr.openUserActions]:"User Actions",[gr.showPrecedingSessions]:"User Actions",[gr.showFollowingSessions]:"User Actions",[gr.clickViewedDocument]:"User Actions",[gr.clickPageView]:"User Actions",[gr.createArticle]:"createArticle"},Ro=class{constructor(){this.runtime=new Gs,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(Ce.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ce.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ce.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ce.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return hh}};function YR(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function XR(e){return e.map(t=>t.replace(/;/g,""))}function wh(e){let r=e.join(";");return r.length<=256?r:wh(e.slice(1))}var dh=e=>{let t=XR(e),r=YR(t);return wh(r)};function fh(e){let t=typeof e.partialQueries=="string"?e.partialQueries:dh(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:dh(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Qs=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||$s(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Ro:new Jt(t)}disable(){this.coveoAnalyticsClient=new Ro}enable(){this.coveoAnalyticsClient=new Jt(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(H.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(H.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(H.didyoumeanClick)}logDidYouMeanClick(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(H.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(H.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(H.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(H.searchboxAsYouType)}logSearchboxAsYouType(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(H.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(H.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(H.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(H.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(H.omniboxAnalytics,fh(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(H.omniboxFromLink,fh(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(H.searchFromLink)}logSearchFromLink(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.pagerScrolling)}logPagerScrolling(){return G(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(H.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(H.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(H.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(H.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(H.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(H.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(H.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(H.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(H.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(H.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(H.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(H.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(H.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(H.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(H.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(H.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(H.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(H.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(H.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(H.showLessFoldedResults)}logShowLessFoldedResults(){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,i=lh[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),u=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(u,n),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,r){return G(this,arguments,void 0,function*(n,o,i=lh[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Jt?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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.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(H.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(H.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Hs=Object.assign({},Qi),ph=Object.keys(Hs).map(e=>Hs[e]),xo=class extends Md{constructor({client:t,uuidGenerator:r=Sn}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>ph.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(ph.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Hs.pageview,{newEventType:Ce.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Hs.event,{newEventType:Ce.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return rR(this.ticket)}};xo.Id="svc";var zs;(function(e){e.click="click",e.flowStart="flowStart"})(zs||(zs={}));var Ft;(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"})(Ft||(Ft={}));var Ws;(function(e){e.quit="Quit",e.solved="Solved"})(Ws||(Ws={}));var Ks=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!$s(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Jt(t):new Ro,this.svc=new xo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Ro,this.svc=new xo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Jt(this.options),this.svc=new xo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Ft.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Ft.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Ft.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Ft.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Ft.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Ft.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Ft.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Ft.caseCancelled,{reason:Ws.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Ft.caseSolved,{reason:Ws.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Ft.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",zs.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",zs.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 Jt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return G(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var Ch=e=>new Jt(e).getCurrentVisitorId(),zi=(e,t)=>typeof t=="function"?(...r)=>{let n=xi(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Wi=(e,t)=>(...r)=>{let n=xi(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function Ys(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();p();f();m();d();p();f();m();d();p();f();function xh(e){let{activeValue:t,ancestryMap:r}=ZR(e);return t?JR(t,r):[]}function ZR(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 JR(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var eI=(e,t)=>e.categoryFacetSet[t]?.request;var Kd=(e,t)=>{let r=eI(e,t);return xh(r?.currentValues??[])};m();d();p();f();function Xs(){return{}}m();d();p();f();function Zs(){return{}}m();d();p();f();function Js(){return{}}m();d();p();f();function ec(){return{}}function Yd(e){return{facetSet:e.facetSet??ec(),categoryFacetSet:e.categoryFacetSet??Xs(),dateFacetSet:e.dateFacetSet??Zs(),numericFacetSet:e.numericFacetSet??Js(),automaticFacetSet:e.automaticFacetSet??Ys()}}var Xd=e=>{let t=[];return nI(e).forEach((r,n)=>{let o=dI(e,r.facetId),i=uI(r,n+1);if(rI(r)){if(!!!Kd(e,r.facetId).length)return;t.push({...i,...sI(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let u=Eh(a,s+1,o),c=tI(r)?Rh(a):iI(a);t.push({...i,...u,...c})})}),oI(e).forEach((r,n)=>{let o=cI(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Eh(i,a+1,"specific"),u=Rh(i);t.push({...o,...s,...u})})}),t},tI=e=>e.type==="specific",rI=e=>e.type==="hierarchical",nI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),oI=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Eh=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),iI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Rh=e=>({displayValue:e.value,value:e.value}),aI=(e,t)=>Kd(e,t).map(n=>n.value).join(";"),sI=(e,t)=>{let n=aI(e,t);return{value:n,valuePosition:1,displayValue:n}},cI=(e,t)=>({title:Ih(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),uI=(e,t)=>({title:Ih(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Ih=(e,t)=>`${e}_${t}`,lI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,dI=(e,t)=>{let r=lI(e,t);return r?r.type:"specific"};m();d();p();f();m();d();p();f();var Zd=e=>e.configuration.search.locale,Th=e=>e.configuration.search.timezone,_h=e=>e.configuration.accessToken,kh=e=>e.configuration.organizationId,Oh=e=>e.configuration.environment,tc=e=>e.configuration?.knowledge?.agentId,Ph=e=>e.configuration.knowledge.debugAgentSession;var Ve=e=>{if(fI(e)||Jd(e))return e.generatedAnswer?.answerId;if(pI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},fI=e=>"answer"in e&&"generatedAnswer"in e&&!ue(e.generatedAnswer?.answerConfigurationId),Jd=e=>{let t=tc(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},pI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",ef=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Nr=e=>e.followUpAnswers?.conversationId,mI=e=>e.generatedAnswer?.citations,gI=e=>e.followUpAnswers?.followUpAnswers,hI=Ye(gI,e=>e?.flatMap(t=>t.citations)),yI=(e,t)=>t,Io=Ye(mI,hI,yI,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));m();d();p();f();var Tt=()=>({q:"",enableQuerySyntax:!1});m();d();p();f();m();d();p();f();var Nh=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Nh||{}),Fh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Fh||{}),tf=e=>{if(Om(e))return e.map(t=>tf(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""}},Dh=()=>({by:"relevancy"});var c2=new re({values:{by:new zl({enum:Fh,required:!0}),order:new zl({enum:Nh}),field:new K}});function rc(){return tf(Dh())}m();d();p();f();m();d();p();f();var To=()=>"default";var vI=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},hr=class{constructor(t){de(this,"getState",t);de(this,"state");this.state=t()}getLanguage(){return vI(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=go),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||To()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Ki=class Ki extends hr{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 Xd(Yd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Ki.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||Wt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Ki.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ve(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??rc()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(c=>c.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:u}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||Tt().q}get responseTime(){return this.state.search?.duration||Wt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Wt().response.totalCountFiltered}};de(Ki,"fallbackPipelineName","default");var Fr=Ki,Mh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??Pt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,y=new Qs({token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:zi(e,n),beforeSendHooks:[Wi(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||y.disable(),y},rf=()=>{let t=vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var nc=/*#__PURE__*/function(){var _nc=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Ch(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}),...(rf()&&{pageId:rf()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Ao(e)})}}});function nc(_x17,_x18){return _nc.apply(this,arguments)}return nc}();m();d();p();f();m();d();p();f();m();d();p();f();var _o=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Yi=class extends hr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:Tt().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||_o().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||_o().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||_o().recommendations.length}};m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function qh(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}m();d();p();f();m();d();p();f();m();d();p();f();var Lh=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function SI(e){return typeof e=="string"&&Lh.test(e)}var nf=SI;m();d();p();f();var st=[];for(let e=0;e<256;++e)st.push((e+256).toString(16).slice(1));function jh(e,t=0){return(st[e[t+0]]+st[e[t+1]]+st[e[t+2]]+st[e[t+3]]+"-"+st[e[t+4]]+st[e[t+5]]+"-"+st[e[t+6]]+st[e[t+7]]+"-"+st[e[t+8]]+st[e[t+9]]+"-"+st[e[t+10]]+st[e[t+11]]+st[e[t+12]]+st[e[t+13]]+st[e[t+14]]+st[e[t+15]]).toLowerCase()}m();d();p();f();var bI=new Uint8Array(16);function of(){return crypto.getRandomValues(bI)}m();d();p();f();function AI(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():wI(e,t,r)}function wI(e,t,r){e=e||{};let n=e.random??e.rng?.()??of();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 jh(n)}var af=AI;function CI(_x19){return _CI.apply(this,arguments)}function _CI(){_CI=_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 _CI.apply(this,arguments)}var Qh="2.1.3",sf=128,Hh=192,Uh=224,Vh=240,xI=248;function EI(e){return(e&xI)===Vh?4:(e&Vh)===Uh?3:(e&Uh)===Hh?2:1}function RI(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&sf)!=sf)break;if(r-=3,(n&Hh)!=sf){t-r>=EI(n)*3&&(r=t);break}}return e.substring(0,r)}function II(e){let{trackingId:t}=e;return{trackingId:t}}function TI(e){return(e.source||[]).concat([`relay@${Qh}`])}function zh(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=II(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:TI(t),clientId:s,userAgent:i(),referrer:Bh(n()),location:Bh(o())})}function Bh(e){return e!==null?RI(e,1024):null}function _I(e,t,r,n){return{...t,meta:zh(e,r,n)}}var kI="*";function OI(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function r(u,c){return u.type==="*"||c===u.type}function n(u){return t(u)<0&&e.push(u),()=>s(u.type,u.callback)}function o(u){e.forEach(c=>{if(r(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===kI)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function a(u){let c=t(u);c>=0&&e.splice(c,1)}function s(u,c){c?a({type:u,callback:c}):i(u)}return{add:n,call:o,remove:s}}function Gh({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function PI(e){let t=Gh(e);return{get:()=>t,update:r=>{t=Gh({...t,...r})}}}var cf=NI();function NI(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date((new Date).getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function FI(){return{getItem(e){return cf.getItem(e)||localStorage.getItem(e)},removeItem(e){cf.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),cf.setItem(e,t,31556952e3)}}}var $h="visitorId";function DI(){let e=document.referrer;return e===""?null:e}function uf(){let e=FI();return{runtime:"browser",send:function(){var _send=_asyncToGenerator(function*(t,r,n){let o=x(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});qh().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let u of s.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});function send(_x20,_x21,_x22){return _send.apply(this,arguments)}return send}(),getReferrer:()=>DI(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem($h);if(t&&nf(t))return t;let r=af();return e.setItem($h,r),r}}}function MI(){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 qI(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function LI(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=qI();return t&&r?{...r,runtime:"custom"}:t&&jI()&&MI()?uf():n}function jI(){try{return typeof window=="object"}catch{return!1}}function UI(e){return{get:()=>Object.freeze(LI(e))}}function Wh(e){let t=PI(e),r=OI(),n=UI(t);return{emit:function(){var _emit=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),u=_I(o,i,a,s);return CI({config:a,environment:s,event:u,listenerManager:r})});function emit(_x23,_x24){return _emit.apply(this,arguments)}return emit}(),getMeta:o=>zh(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:Qh}}m();d();p();f();function Kh(){return typeof window<"u"&&typeof document<"u"}var VI=50,BI=ms({memoize:bd,memoizeOptions:{maxSize:VI}}),Xi=BI(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Ao(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let u=$I(s);return Wh({mode:i?"emit":"disabled",url:o??Ha(e,t),token:r,trackingId:n??null,source:a,environment:u})}),GI={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _send2=_asyncToGenerator(function*(){});function send(){return _send2.apply(this,arguments)}return send}()},$I=e=>{if(!e)return;let t=e();return{...(Kh()?uf():GI),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();p();f();var Zi=class extends hr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Yh=({logger:e,getState:t,analyticsClientMiddleware:r=(a,s)=>s,preprocessRequest:n,provider:o=new Zi(t),disableBrowserPrivacySignals:i})=>{let a=t(),s=a.configuration.accessToken,u=a.configuration.analytics.apiBaseUrl??Pt(a.configuration.organizationId,a.configuration.environment,"analytics"),c=a.configuration.analytics.runtimeEnvironment,g=a.configuration.analytics.enabled,y=new Ks({enableAnalytics:g,token:s,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:zi(e,n),beforeSendHooks:[Wi(e,r),(R,h)=>(e.info({...h,type:R,endpoint:u,token:s},"Analytics request"),h)]},o);return g||y.disable(),y};m();d();p();f();m();d();p();f();function Zh(e,t){return{...new Fr(t).getBaseMetadata(),actionCause:e,type:e}}function QI(e){return Object.assign(e,{instantlyCallable:!0})}function HI(e,t){let r=i=>{let a=Fe(e,i);return QI(Object.assign(a,{type:a.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y}=s;return yield(yield t({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref6.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _prepare=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:y}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:r(/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(R,{getState:h,extra:v}){return yield y({state:h(),extra:v})});return function(_x28,_x29){return _ref7.apply(this,arguments)}}())}});function prepare(_x27){return _prepare.apply(this,arguments)}return prepare}()}),n}var Jh=(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 KI(i)}return n},zI=e=>e.configuration.analytics.analyticsMode==="legacy",WI=e=>e.configuration.analytics.analyticsMode==="next",KI=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),HI(e,/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y}){let R=[],h={log:function(){var _log=_asyncToGenerator(function*({state:_}){for(let O of R)yield O(_)});function log(_x31){return _log.apply(this,arguments)}return log}()},v=s(),w=i({getState:s,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:y,provider:r(s)}),E=yield t(w,s());h.description=E?.description,R.push(/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(_){zI(_)&&(yield YI(E,r,_,g,w.coveoAnalyticsClient))});return function(_x32){return _ref9.apply(this,arguments)}}());let{emit:C}=Xi(v);return R.push(/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(_){if(WI(_)&&o&&n){let O=n(_);yield nT(C,o,O)}});return function(_x33){return _ref0.apply(this,arguments)}}()),h});return function(_x30){return _ref8.apply(this,arguments)}}()));function YI(_x34,_x35,_x36,_x37,_x38){return _YI.apply(this,arguments)}function _YI(){_YI=_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 _YI.apply(this,arguments)}var XI=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _log2=_asyncToGenerator(function*(i){r(n,o)});function log(_x39){return _log2.apply(this,arguments)}return log}()}),Le=Jh(e=>Mh({...e,provider:e.provider||new Fr(e.getState)}),e=>e,Fr),f3=Jh(Yh,XI("caseAssist"),Zi);var lf=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return ZI(e,r,t)},ey=(e,t)=>({sourceName:ry(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Or()}),ty=(e,t)=>({sourceName:ry(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Or()});function ry(e){let t=e.source;return ue(t)?"unknown":t}var ny=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function ZI(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:tT(e),...(Xh(e)?{documentCategory:Xh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:rT(e),queryPipeline:r.pipeline||Or()}}function Xh(e){return e.raw?.objecttype||void 0}var oc=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||""}),oy={urihash:new K,sourcetype:new K,permanentid:new K},iy={uniqueId:X,raw:new re({values:oy}),title:X,uri:X,clickUri:X,rankingModifier:new K({required:!1,emptyAllowed:!0})};function JI(e){return Object.assign({},...Object.keys(oy).map(t=>({[t]:e[t]})))}function eT(e){return Object.assign({},...Object.keys(iy).map(t=>({[t]:e[t]})),{raw:JI(e.raw)})}function tT(e){let t=e.raw.author;return ue(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function rT(e){let t=e.raw.source;return ue(t)?"unknown":t}var df=e=>new At(iy).validate(eT(e));function nT(_x40,_x41,_x42){return _nT.apply(this,arguments)}function _nT(){_nT=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _nT.apply(this,arguments)}m();d();p();f();var ay=()=>Le("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Yi(e)),sy=()=>({actionCause:"recommendationInterfaceLoad"}),ac=e=>Le({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(df(e),t.makeRecommendationOpen(lf(e,r),oc(e))),__legacy__provider:t=>new Yi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=lf(e,t),n=oc(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var ko=q("recommendation/set",e=>$(e,{id:X})),Dr=Fe("recommendation/get",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield oT(o),s=yield n.recommendations(a),u=Date.now()-i;return wt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:ay(),duration:u,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref1.apply(this,arguments)}}()),oT=/*#__PURE__*/function(){var _oT=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Er(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?vt.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield iT(e,sy()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});function oT(_x45){return _oT.apply(this,arguments)}return oT}(),iT=/*#__PURE__*/function(){var _iT=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield nc(e.configuration.analytics,r)});function iT(_x46,_x47){return _iT.apply(this,arguments)}return iT}();var Oo=Qe(_o(),e=>{e.addCase(ko,(t,r)=>{t.id=r.payload.id}).addCase(Dr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Dr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Dr.pending,t=>{t.isLoading=!0}).addCase(Os,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();p();f();var Po=q("searchHub/set",e=>$(e,new K({required:!0,emptyAllowed:!0})));m();d();p();f();var No=Qe(To(),e=>{e.addCase(Po,(t,r)=>r.payload).addCase(Ct.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Xt,(t,r)=>r.payload.searchHub||t)});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var cy=class extends Error{constructor(t){super(t[0].message);de(this,"issues");this.name="SchemaError",this.issues=t}};var Af="uninitialized",mf="pending",gf="fulfilled",hf="rejected";function uy(e){return{status:e,isUninitialized:e===Af,isLoading:e===mf,isSuccess:e===gf,isError:e===hf}}var ly=Kt;function Iy(e,t){if(e===t||!(ly(e)&&ly(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]=Iy(e[a],t[a]),o&&(o=Object.is(e[a],i[a]));return o?e:i}function yf(e,t,r){return e.reduce((n,o,i)=>(t(o,i)&&n.push(r(o,i)),n),[]).flat()}function aT(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function sT(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function wf(e){return e!=null}function dy(e){return[...(e?.values()??[])].filter(wf)}function cT(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var uT=e=>e.replace(/\/$/,""),lT=e=>e.replace(/^\//,"");function dT(e,t){if(!e)return t;if(!t)return e;if(aT(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=uT(e),t=lT(t),`${e}${r}${t}`}function dc(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var vf=()=>new Map,fT=e=>{let t=new l.AbortController,r=setTimeout(()=>{let n="signal timed out",o="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(n,o):Object.assign(new Error(n),{name:o}))},e);return{signal:t.signal,clear:()=>clearTimeout(r)}},pT=(...e)=>{for(let r of e)if(r.aborted)return l.AbortSignal.abort(r.reason);let t=new l.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},fy=(...e)=>x(...e),mT=e=>e.status>=200&&e.status<=299,py=e=>/ion\/(vnd\.api\+)?json/i.test(e.get("content-type")||""),my=e=>(e instanceof Error||typeof DOMException<"u"&&e instanceof DOMException)&&e.name==="TimeoutError";function gy(e){if(!Kt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var hy=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`,gT=e=>hy(e,"FormData")||hy(e,"URLSearchParams"),hT=e=>typeof e=="object"&&e!==null&&(Kt(e)||Array.isArray(e)||typeof e.toJSON=="function");function Ty({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:r=fy,paramsSerializer:n,isJsonContentType:o=py,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:u,validateStatus:c,...g}={}){return typeof x>"u"&&r===fy&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(R,h,v){let{getState:w,extra:E,endpoint:C,forced:_,type:O}=h,F,{url:b,headers:T=new I(g.headers),params:k=void 0,responseHandler:P=u??"json",validateStatus:N=c??mT,timeout:M=s,...Q}=typeof R=="string"?{url:R}:R,U=M?fT(M):void 0;try{let L={...g,signal:U?pT(h.signal,U.signal):h.signal,...Q};T=new I(gy(T)),L.headers=(yield t(T,{getState:w,arg:R,extra:E,endpoint:C,forced:_,type:O,extraOptions:v}))||T;let B=hT(L.body);if(L.body!=null&&!B&&typeof L.body!="string"&&(gT(L.body)||py(L.headers)||o(L.headers))&&L.headers.delete("content-type"),!L.headers.has("content-type")&&B&&L.headers.set("content-type",i),B&&o(L.headers)&&(L.body=JSON.stringify(L.body,a)),L.headers.has("accept")||(P==="json"?L.headers.set("accept","application/json"):P==="text"&&L.headers.set("accept","text/plain, text/html, */*")),k){let ie=~b.indexOf("?")?"&":"?",ae=n?n(k):new URLSearchParams(gy(k));b+=ie+ae}b=dT(e,b);let j=new Request(b,L);F={request:new Request(b,L)};let V;try{V=yield r(j)}catch(ie){return{error:{status:my(ie)?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ie)},meta:F}}let z=V.clone();F.response=z;let W,J="";try{let ie,ae=!1;if(yield Promise.all([y(V,P).then(le=>W=le,le=>{ae=!0,ie=le}),z.text().then(le=>J=le,()=>{})]),ae)throw ie}catch(ie){return L.signal?.aborted&&my(L.signal.reason)?{error:{status:"TIMEOUT_ERROR",error:String(L.signal.reason)},meta:F}:{error:{status:"PARSING_ERROR",originalStatus:V.status,data:J,error:String(ie)},meta:F}}return N(V,W)?{data:W,meta:F}:{error:{status:V.status,data:W},meta:F}}finally{U?.clear()}});return function(_x48,_x49,_x50){return _ref10.apply(this,arguments)}}());function y(_x51,_x52){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(R,h){if(typeof h=="function")return h(R);if(h==="content-type"&&(h=o(R.headers)?"json":"text"),h==="json"){let v=yield R.text();return v.length?JSON.parse(v):null}return R.text()});return _y2.apply(this,arguments)}}var Fo=class{constructor(e,t=void 0){de(this,"value");de(this,"meta");this.value=e,this.meta=t}};function yT(){return _yT.apply(this,arguments)}function _yT(){_yT=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((i,a)=>{let s=setTimeout(()=>i(),o);if(r){let u=()=>{clearTimeout(s),a(new Error("Aborted"))};r.aborted?(clearTimeout(s),a(new Error("Aborted"))):r.addEventListener("abort",u,{once:!0})}})});return _yT.apply(this,arguments)}function _y(e,t){throw Object.assign(new Fo({error:e,meta:t}),{throwImmediately:!0})}function ff(e){e.aborted&&_y({status:"CUSTOM_ERROR",error:"Aborted"})}var yy={},vT=(e,t)=>(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(r,n,o){let[i]=[5,(t||yy).maxRetries,(o||yy).maxRetries].filter(c=>c!==void 0).slice(-1),s={maxRetries:i,backoff:yT,retryCondition:(c,g,{attempt:y})=>y<=i,...t,...o},u=0;for(;;){ff(n.signal);try{let c=yield e(r,n,o);if(c.error)throw new Fo(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof Fo)return c.value;throw c}if(c instanceof Fo){if(!s.retryCondition(c.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return c.value}else if(u>s.maxRetries)return{error:c};ff(n.signal);try{yield s.backoff(u,s.maxRetries,n.signal)}catch(g){throw ff(n.signal),g}}}});return function(_x53,_x54,_x55){return _ref11.apply(this,arguments)}}()),ky=Object.assign(vT,{fail:_y}),fc="__rtkq/",Oy="online",Py="offline",ST="focus",Ny="focused",bT="visibilitychange",ta=q(`${fc}${Ny}`),Cf=q(`${fc}un${Ny}`),pc=q(`${fc}${Oy}`),xf=q(`${fc}${Py}`);var AT=new Map,Ji=e=>{for(let t of[...AT.keys()])t(e())},I$={[ST]:()=>Ji(ta),[bT]:()=>{window.document.visibilityState==="visible"?Ji(ta):Ji(Cf)},[Oy]:()=>Ji(pc),[Py]:()=>Ji(xf)};var ia="query",Fy="mutation",Dy="infinitequery";function mc(e){return e.type===ia}function wT(e){return e.type===Fy}function ra(e){return e.type===Dy}function na(e){return mc(e)||ra(e)}function Ef(e,t,r,n,o,i){let a=CT(e)?e(t,r,n,o):e;return a?yf(a,wf,s=>i(My(s))):[]}function CT(e){return typeof e=="function"}function My(e){return typeof e=="string"?{type:e}:e}var Do=Symbol.for("RTKQ/skipToken");function xT(e,t){return e.catch(t)}var aa=(e,t)=>e.endpointDefinitions[t],oa=Symbol("forceQueryFn"),uc=e=>typeof e[oa]=="function";function ET({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i,getInternalState:a}){let s=b=>a(b)?.runningQueries,u=b=>a(b)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:_,buildInitiateInfiniteQuery:O,buildInitiateMutation:F,getRunningQueryThunk:R,getRunningMutationThunk:h,getRunningQueriesThunk:v,getRunningMutationsThunk:w};function R(b,T){return k=>{let P=e({queryArgs:T,endpointDefinition:aa(i,b),endpointName:b});return s(k)?.get(P)}}function h(b,T){return k=>u(k)?.get(T)}function v(){return b=>dy(s(b))}function w(){return b=>dy(u(b))}function E(b){}function C(b,T){let k=(P,{subscribe:N=!0,forceRefetch:M,subscriptionOptions:Q,[oa]:U,...L}={})=>(B,j)=>{let V=P===Do?`${b}(skipToken)`:e({queryArgs:P,endpointDefinition:T,endpointName:b}),z,W={...L,type:ia,subscribe:N,forceRefetch:M,subscriptionOptions:Q,endpointName:b,originalArgs:P,queryCacheKey:V,[oa]:U};if(mc(T))z=t(W);else{let{direction:Ae,initialPageParam:Se,refetchCachedPages:Re}=L;z=r({...W,direction:Ae,initialPageParam:Se,refetchCachedPages:Re})}let J=o.endpoints[b].select(P),ie=B(z),ae=J(j());let{requestId:le,abort:ke}=ie,Me=ae.requestId!==le,_e=P===Do?void 0:s(B)?.get(V),Ke=()=>J(j()),je=Object.assign(U?ie.then(Ke):Me&&!_e?Promise.resolve(ae):Promise.all([_e,ie]).then(Ke),{arg:P,requestId:le,subscriptionOptions:Q,queryCacheKey:V,abort:ke,unwrap(){return _asyncToGenerator(function*(){let Ae=yield je;if(Ae.isError)throw Ae.error;return Ae.data})()},refetch:Ae=>B(k(P,{subscribe:!1,forceRefetch:!0,...Ae})),unsubscribe(){N&&B(c({queryCacheKey:V,requestId:le}))},updateSubscriptionOptions(Ae){je.subscriptionOptions=Ae,B(y({endpointName:b,requestId:le,queryCacheKey:V,options:Ae}))}});if(!Me&&!U){let Ae=s(B);Ae.set(V,je);let Se=()=>{Ae.get(V)===je&&Ae.delete(V)};je.then(Se,Se)}return je};return k}function _(b,T){return C(b,T)}function O(b,T){return C(b,T)}function F(b){return(T,{track:k=!0,fixedCacheKey:P}={})=>(N,M)=>{let Q=N(n({type:"mutation",endpointName:b,originalArgs:T,track:k,fixedCacheKey:P}));let{requestId:U,abort:L,unwrap:B}=Q,j=xT(Q.unwrap().then(J=>({data:J})),J=>({error:J})),V=()=>{N(g({requestId:U,fixedCacheKey:P}))},z=Object.assign(j,{arg:Q.arg,requestId:U,abort:L,unwrap:B,reset:V}),W=u(N);return W.set(U,z),z.then(()=>{W.delete(U)}),P&&(W.set(P,z),z.then(()=>{W.get(P)===z&&W.delete(P)})),z}}}var qy=class extends cy{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}},bn=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function An(_x56,_x57,_x58,_x59){return _An.apply(this,arguments)}function _An(){_An=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new qy(o.issues,t,r,n);return o.value});return _An.apply(this,arguments)}function vy(e){return e}var ea=(e={})=>({...e,[Bi]:!0});function RT({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a,onSchemaFailure:s,catchSchemaFailure:u,skipSchemaValidation:c}){let g=new WeakMap,y=new Map;function R(j,V){let z=(g.get(V)??0)+1;g.set(V,z);let W={startedTimeStamp:Date.now(),seq:z};return y.set(j,W),W}function h(j,V){let z=y.get(j)??R(j,V);return y.delete(j),z}let v=(j,V,z,W)=>(J,ie)=>{let ae=r[j],le=n({queryArgs:V,endpointDefinition:ae,endpointName:j});if(J(o.internalActions.queryResultPatched({queryCacheKey:le,patches:z})),!W)return;let ke=o.endpoints[j].select(V)(ie()),Me=Ef(ae.providesTags,ke.data,void 0,V,{},i);J(o.internalActions.updateProvidedBy([{queryCacheKey:le,providedTags:Me}]))};function w(j,V,z=0){let W=[V,...j];return z&&W.length>z?W.slice(0,-1):W}function E(j,V,z=0){let W=[...j,V];return z&&W.length>z?W.slice(1):W}let C=(j,V,z,W=!0)=>(J,ie)=>{let ae=o.endpoints[j].select(V)(ie()),le={patches:[],inversePatches:[],undo:()=>J(o.util.patchQueryData(j,V,le.inversePatches,W))};if(ae.status==="uninitialized")return le;let ke;if("data"in ae)if(ft(ae.data)){let[Me,_e,Ke]=hg(ae.data,z);le.patches.push(..._e),le.inversePatches.push(...Ke),ke=Me}else ke=z(ae.data),le.patches.push({op:"replace",path:[],value:ke}),le.inversePatches.push({op:"replace",path:[],value:ae.data});return le.patches.length===0||J(o.util.patchQueryData(j,V,le.patches,W)),le},_=(j,V,z)=>W=>W(o.endpoints[j].initiate(V,{subscribe:!1,forceRefetch:!0,[oa]:()=>({data:z})})),O=(j,V)=>j.query&&j[V]?j[V]:vy,F=/*#__PURE__*/function(){var _F=_asyncToGenerator(function*(j,{signal:V,abort:z,rejectWithValue:W,fulfillWithValue:J,dispatch:ie,getState:ae,extra:le,requestId:ke}){let Me=h(ke,ae),_e=r[j.endpointName],{metaSchema:Ke,skipSchemaValidation:je=c}=_e,Ae=j.type===ia;try{let Se=vy,Re={signal:V,abort:z,dispatch:ie,getState:ae,extra:le,endpoint:j.endpointName,type:j.type,forced:Ae?b(j,ae()):void 0,queryCacheKey:Ae?j.queryCacheKey:void 0},We=Ae?j[oa]:void 0,$e,St=/*#__PURE__*/function(){var _St=_asyncToGenerator(function*(qe,De,Ot,bt){if(De==null&&qe.pages.length)return Promise.resolve({data:qe});let nn=yield Ht({queryArg:j.originalArgs,pageParam:De}),sr=bt?w:E;return{data:{pages:sr(qe.pages,nn.data,Ot),pageParams:sr(qe.pageParams,De,Ot)},meta:nn.meta}});function St(_x62,_x63,_x64,_x65){return _St.apply(this,arguments)}return St}();function Ht(_x66){return _Ht.apply(this,arguments)}function _Ht(){_Ht=_asyncToGenerator(function*(qe){let De,{extraOptions:Ot,argSchema:bt,rawResponseSchema:nn,responseSchema:sr}=_e;if(bt&&!bn(je,"arg")&&(qe=yield An(bt,qe,"argSchema",{})),We?De=We():_e.query?(Se=O(_e,"transformResponse"),De=yield t(_e.query(qe),Re,Ot)):De=yield _e.queryFn(qe,Re,Ot,yi=>t(yi,Re,Ot)),typeof process<"u",De.error)throw new Fo(De.error,De.meta);let{data:on}=De;nn&&!bn(je,"rawResponse")&&(on=yield An(nn,De.data,"rawResponseSchema",De.meta));let xr=yield Se(on,De.meta,qe);return sr&&!bn(je,"response")&&(xr=yield An(sr,xr,"responseSchema",De.meta)),{...De,data:xr}});return _Ht.apply(this,arguments)}if(Ae&&"infiniteQueryOptions"in _e){let{infiniteQueryOptions:qe}=_e,{maxPages:De=1/0}=qe,Ot=j.refetchCachedPages??qe.refetchCachedPages??!0,bt,nn={pages:[],pageParams:[]},sr=a.selectQueryEntry(ae(),j.queryCacheKey)?.data,on=b(j,ae())&&!j.direction||!sr?nn:sr;if("direction"in j&&j.direction&&on.pages.length){let xr=j.direction==="backward";bt=yield St(on,(xr?Sf:lc)(qe,on,j.originalArgs),De,xr)}else{let{initialPageParam:xr=qe.initialPageParam}=j,yi=sr?.pageParams??[],sm=yi[0]??xr,cm=yi.length;if(bt=yield St(on,sm,De),We&&(bt={data:bt.data.pages[0]}),Ot)for(let um=1;um<cm;um++){let Gw=lc(qe,bt.data,j.originalArgs);bt=yield St(bt.data,Gw,De)}}$e=bt}else $e=yield Ht(j.originalArgs);return Ke&&!bn(je,"meta")&&$e.meta&&($e.meta=yield An(Ke,$e.meta,"metaSchema",$e.meta)),J($e.data,ea({...Me,fulfilledTimeStamp:Date.now(),baseQueryMeta:$e.meta}))}catch(Se){let Re=Se;if(Re instanceof Fo){let We=O(_e,"transformErrorResponse"),{rawErrorResponseSchema:$e,errorResponseSchema:St}=_e,{value:Ht,meta:qe}=Re;try{$e&&!bn(je,"rawErrorResponse")&&(Ht=yield An($e,Ht,"rawErrorResponseSchema",qe)),Ke&&!bn(je,"meta")&&(qe=yield An(Ke,qe,"metaSchema",qe));let De=yield We(Ht,qe,j.originalArgs);return St&&!bn(je,"errorResponse")&&(De=yield An(St,De,"errorResponseSchema",qe)),W(De,ea({...Me,baseQueryMeta:qe}))}catch(De){Re=De}}try{if(Re instanceof qy){let We={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:Ae?j.queryCacheKey:void 0};_e.onSchemaFailure?.(Re,We),s?.(Re,We);let{catchSchemaFailure:$e=u}=_e;if($e)return W($e(Re,We),ea({...Me,baseQueryMeta:Re._bqMeta}))}}catch(We){Re=We}throw typeof process<"u",console.error(Re),Re}});function F(_x60,_x61){return _F.apply(this,arguments)}return F}();function b(j,V){let z=a.selectQueryEntry(V,j.queryCacheKey),W=a.selectConfig(V).refetchOnMountOrArgChange,J=z?.fulfilledTimeStamp,ie=j.forceRefetch??(j.subscribe&&W);return ie?ie===!0||(Number(new Date)-Number(J))/1e3>=ie:!1}let T=()=>Fe(`${e}/executeQuery`,F,{getPendingMeta({arg:j,requestId:V},{getState:z}){let W=r[j.endpointName];return ea({...R(V,z),...(ra(W)?{direction:j.direction}:{})})},condition(j,{getState:V}){let z=V(),W=a.selectQueryEntry(z,j.queryCacheKey),J=W?.fulfilledTimeStamp,ie=j.originalArgs,ae=W?.originalArgs,le=r[j.endpointName],ke=j.direction;if(uc(j))return!0;if(j.originalArgs===Do||W?.status==="pending")return!1;if(b(j,z)||mc(le)&&le?.forceRefetch?.({currentArg:ie,previousArg:ae,endpointState:W,state:z}))return!0;if(J&&!ke)return!1;if(ke&&ra(le)){let Me=W?.data;if(Me?.pages.length){let{infiniteQueryOptions:_e}=le;if((ke==="forward"?lc:Sf)(_e,Me,ie)==null)return!1}}return!0},dispatchConditionRejection:!0}),k=T(),P=T(),N=Fe(`${e}/executeMutation`,F,{getPendingMeta({requestId:j},{getState:V}){return ea(R(j,V))}}),M=j=>"force"in j,Q=j=>"ifOlderThan"in j,U=(j,V,z={})=>(W,J)=>{let ie=M(z)&&z.force,ae=Q(z)&&z.ifOlderThan,le=(Me=!0)=>{let _e={forceRefetch:Me,subscribe:!1};return o.endpoints[j].initiate(V,_e)},ke=o.endpoints[j].select(V)(J());if(ie)W(le());else if(ae){let Me=ke?.fulfilledTimeStamp;if(!Me){W(le());return}(Number(new Date)-Number(new Date(Me)))/1e3>=ae&&W(le())}else W(le(!1))};function L(j){return V=>V?.meta?.arg?.endpointName===j}function B(j,V){return{matchPending:fo(bs(j),L(V)),matchFulfilled:fo(fr(j),L(V)),matchRejected:fo(gn(j),L(V))}}return{queryThunk:k,mutationThunk:N,infiniteQueryThunk:P,prefetch:U,updateQueryData:C,upsertQueryData:_,patchQueryData:v,buildMatchThunkActions:B}}function lc(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Sf(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function bf(e,t,r,n){return Ef(r[e.meta.arg.endpointName][t],fr(e)?e.payload:void 0,mo(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function pf(e){return yt(e)?fs(e):e}function sc(e,t,r){let n=e[t];n&&r(n)}function Mo(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Sy(e,t,r){let n=e[Mo(t)];n&&r(n)}function IT(e,t){if(!e||e.length!==t.length)return!1;for(let r=0;r<t.length;r++)if(e[r].type!==t[r].type||e[r].id!==t[r].id)return!1;return!0}var cc={};function TT({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:u,config:c}){let g=q(`${e}/resetApiState`);function y(N,M,Q,U){var L;N[L=M.queryCacheKey]??(N[L]={status:Af,endpointName:M.endpointName}),sc(N,M.queryCacheKey,B=>{Q&&B.requestId||(B.status=mf,B.requestId=U.requestId),M.originalArgs!==void 0&&(B.originalArgs=M.originalArgs),B.startedTimeStamp=U.startedTimeStamp;let j=o[U.arg.endpointName];ra(j)&&"direction"in M&&(B.direction=M.direction)})}function R(N,M,Q,U){sc(N,M.arg.queryCacheKey,L=>{if(L.requestId!==M.requestId&&!U)return;let{merge:B}=o[M.arg.endpointName];if(L.status=gf,B){if(L.data!==void 0){let{fulfilledTimeStamp:j,arg:V,baseQueryMeta:z,requestId:W}=M;L.data=pn(L.data,J=>B(J,Q,{arg:V.originalArgs,baseQueryMeta:z,fulfilledTimeStamp:j,requestId:W}))}else L.data=Q;}else L.data=o[M.arg.endpointName].structuralSharing??!0?Iy(yt(L.data)?hd(L.data):L.data,Q):Q;delete L.error,L.fulfilledTimeStamp=M.fulfilledTimeStamp})}let h=hn({name:`${e}/queries`,initialState:cc,reducers:{removeQueryResult:{reducer(N,{payload:{queryCacheKey:M}}){delete N[M]},prepare:po()},cacheEntriesUpserted:{reducer(N,M){for(let Q of M.payload){let{queryDescription:U,value:L}=Q;y(N,U,!0,{arg:U,requestId:M.meta.requestId,startedTimeStamp:M.meta.timestamp}),R(N,{arg:U,requestId:M.meta.requestId,fulfilledTimeStamp:M.meta.timestamp,baseQueryMeta:{}},L,!0)}},prepare:N=>{let M=[];for(let{endpointName:Q,arg:U,value:L}of N){let B=o[Q];if(!B||!na(B))continue;let j={type:ia,endpointName:Q,originalArgs:U,queryCacheKey:n({queryArgs:U,endpointDefinition:B,endpointName:Q})},V;try{V=bf({type:"UNKNOWN",payload:L,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}},"providesTags",o,u)}catch{continue}M.push({queryDescription:j,value:L,providedTags:V})}return{payload:M,meta:{[Bi]:!0,requestId:$i(),timestamp:Date.now()}}}},queryResultPatched:{reducer(N,{payload:{queryCacheKey:M,patches:Q}}){sc(N,M,U=>{U.data=vd(U.data,Q.concat())})},prepare:po()}},extraReducers(N){N.addCase(t.pending,(M,{meta:Q,meta:{arg:U}})=>{y(M,U,uc(U),Q)}).addCase(t.fulfilled,(M,{meta:Q,payload:U})=>{R(M,Q,U,uc(Q.arg))}).addCase(t.rejected,(M,{meta:{condition:Q,arg:U,requestId:L},error:B,payload:j})=>{sc(M,U.queryCacheKey,V=>{if(!Q){if(V.requestId!==L)return;V.status=hf,V.error=j??B}})}).addMatcher(s,(M,Q)=>{let{queries:U}=a(Q);for(let[L,B]of Object.entries(U))(B?.status==="fulfilled"||B?.status==="rejected")&&(M[L]=B)})}}),v=hn({name:`${e}/mutations`,initialState:cc,reducers:{removeMutationResult:{reducer(N,{payload:M}){let Q=Mo(M);Q in N&&delete N[Q]},prepare:po()}},extraReducers(N){N.addCase(r.pending,(M,{meta:Q,meta:{requestId:U,arg:L,startedTimeStamp:B}})=>{L.track&&(M[Mo(Q)]={requestId:U,status:mf,endpointName:L.endpointName,startedTimeStamp:B})}).addCase(r.fulfilled,(M,{payload:Q,meta:U})=>{U.arg.track&&Sy(M,U,L=>{L.requestId===U.requestId&&(L.status=gf,L.data=Q,L.fulfilledTimeStamp=U.fulfilledTimeStamp)})}).addCase(r.rejected,(M,{payload:Q,error:U,meta:L})=>{L.arg.track&&Sy(M,L,B=>{B.requestId===L.requestId&&(B.status=hf,B.error=Q??U)})}).addMatcher(s,(M,Q)=>{let{mutations:U}=a(Q);for(let[L,B]of Object.entries(U))(B?.status==="fulfilled"||B?.status==="rejected")&&L!==B?.requestId&&(M[L]=B)})}}),w=hn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(N,M){var L,B,j;let Q=pf(N.keys),U=new Set;for(let{queryCacheKey:V,providedTags:z}of M.payload)if(!(!U.has(V)&&IT(Q[V],z))){U.add(V),E(N,V);for(let{type:W,id:J}of z){let ie=(B=(L=N.tags)[W]??(L[W]={}))[j=J??"__internal_without_id"]??(B[j]=[]);ie.includes(V)||ie.push(V)}N.keys[V]=z}},prepare:po()}},extraReducers(N){N.addCase(h.actions.removeQueryResult,(M,{payload:{queryCacheKey:Q}})=>{E(M,Q)}).addMatcher(s,(M,Q)=>{var L,B,j;let{provided:U}=a(Q);for(let[V,z]of Object.entries(U.tags??{}))for(let[W,J]of Object.entries(z)){let ie=(B=(L=M.tags)[V]??(L[V]={}))[j=W??"__internal_without_id"]??(B[j]=[]);for(let ae of J)ie.includes(ae)||ie.push(ae),M.keys[ae]=U.keys[ae]}}).addMatcher(Yt(fr(t),mo(t)),(M,Q)=>{mo(Q)&&uc(Q.meta.arg)||C(M,[Q])}).addMatcher(h.actions.cacheEntriesUpserted.match,(M,Q)=>{w.caseReducers.updateProvidedBy(M,w.actions.updateProvidedBy(Q.payload.map(({queryDescription:U,providedTags:L})=>({queryCacheKey:U.queryCacheKey,providedTags:L}))))})}});function E(N,M){let Q=pf(N.keys[M]??[]);for(let U of Q){let L=U.type,B=U.id??"__internal_without_id",j=N.tags[L]?.[B];j&&(N.tags[L][B]=pf(j).filter(V=>V!==M))}delete N.keys[M]}function C(N,M){let Q=M.map(U=>{let L=bf(U,"providesTags",o,u),{queryCacheKey:B}=U.meta.arg;return{queryCacheKey:B,providedTags:L}});w.caseReducers.updateProvidedBy(N,w.actions.updateProvidedBy(Q))}let _=hn({name:`${e}/subscriptions`,initialState:cc,reducers:{updateSubscriptionOptions(N,M){},unsubscribeQueryResult(N,M){},internal_getRTKQSubscriptions(){}}}),O=hn({name:`${e}/internalSubscriptions`,initialState:cc,reducers:{subscriptionsUpdated:{reducer(N,M){return vd(N,M.payload)},prepare:po()}}}),F=hn({name:`${e}/config`,initialState:{online:cT(),focused:sT(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(N,{payload:M}){N.middlewareRegistered=N.middlewareRegistered==="conflict"||i!==M?"conflict":!0}},extraReducers:N=>{N.addCase(pc,M=>{M.online=!0}).addCase(xf,M=>{M.online=!1}).addCase(ta,M=>{M.focused=!0}).addCase(Cf,M=>{M.focused=!1}).addMatcher(s,M=>({...M}))}}),b=cn({queries:h.reducer,mutations:v.reducer,provided:w.reducer,subscriptions:O.reducer,config:F.reducer}),T=`${e}/`;function k(N){let{type:M}=N;return typeof M!="string"||M.startsWith(T)||M.startsWith("__rtkq/")||M.startsWith("@@redux/")||s(N)}return{reducer:(N,M)=>N!==void 0&&!k(M)?N:b(g.match(M)?void 0:N,M),actions:{...F.actions,...h.actions,..._.actions,...O.actions,...v.actions,...w.actions,resetApiState:g}}}var Ly={status:Af},by=pn(Ly,()=>{}),Ay=pn(Ly,()=>{});function _T({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>by,o=T=>Ay,i=new WeakMap,a=new Map,s=r(g,T=>{let k=[];for(let[P,N]of Object.entries(T??{}))if(N&&N.status!=="uninitialized"){let M=i.get(N);M||(M={...N,queryCacheKey:P},i.set(N,M)),k.push(M)}return k});return{buildQuerySelector:w,buildInfiniteQuerySelector:E,buildMutationSelector:C,selectInvalidatedBy:_,selectCachedArgsForQuery:O,selectAllQueryEntries:s,selectEntriesForEndpoint:r(s,(T,k)=>k,(T,k)=>{let P=T.filter(M=>M.endpointName===k),N=a.get(k);return N&&N.length===P.length&&N.every((M,Q)=>M===P[Q])?N:(a.set(k,P),P)}),selectApiState:c,selectQueries:g,selectMutations:R,selectQueryEntry:y,selectConfig:h};function u(T){return{...T,...uy(T.status)}}function c(T){return T[t]}function g(T){return c(T)?.queries}function y(T,k){return g(T)?.[k]}function R(T){return c(T)?.mutations}function h(T){return c(T)?.config}function v(T,k,P){return N=>{if(N===Do)return r(n,P);let M=e({queryArgs:N,endpointDefinition:k,endpointName:T});return r(U=>y(U,M)??by,P)}}function w(T,k){return v(T,k,u)}function E(T,k){let{infiniteQueryOptions:P}=k;function N(M){let Q={...M,...uy(M.status)},{isLoading:U,isError:L,direction:B}=Q,j=B==="forward",V=B==="backward";return{...Q,hasNextPage:F(P,Q.data,Q.originalArgs),hasPreviousPage:b(P,Q.data,Q.originalArgs),isFetchingNextPage:U&&j,isFetchingPreviousPage:U&&V,isFetchNextPageError:L&&j,isFetchPreviousPageError:L&&V}}return v(T,k,N)}function C(){return T=>{let k;return typeof T=="object"?k=Mo(T)??Do:k=T,r(k===Do?o:N=>c(N)?.mutations?.[k]??Ay,u)}}function _(T,k){let P=T[t],N=new Set,M=yf(k,wf,My);for(let Q of M){let U=P.provided.tags[Q.type];if(!U)continue;let L=(Q.id!==void 0?U[Q.id]:Object.values(U).flat())??[];for(let B of L)N.add(B)}return Array.from(N.values()).flatMap(Q=>{let U=P.queries[Q];return U?{queryCacheKey:Q,endpointName:U.endpointName,originalArgs:U.originalArgs}:[]})}function O(T,k){return yf(Object.values(g(T)),P=>P?.endpointName===k&&P.status!=="uninitialized",P=>P.originalArgs)}function F(T,k,P){return k?lc(T,k,P)!=null:!1}function b(T,k,P){return!k||!T.getPreviousPageParam?!1:Sf(T,k,P)!=null}}var wy=WeakMap?new WeakMap:void 0,Cy=({endpointName:e,queryArgs:t})=>{let r="",n=wy?.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=Kt(a)?Object.keys(a).sort().reduce((s,u)=>(s[u]=a[u],s),{}):a,a));Kt(t)&&wy?.set(t,o),r=o}return`${e}(${r})`};function kT(...e){return function(r){let n=uo(c=>r.extractRehydrationInfo?.(c,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(c){let g=Cy;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let y=c.endpointDefinition.serializeQueryArgs;g=R=>{let h=y(R);return typeof h=="string"?h:Cy({...R,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(c)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:$i(),extractRehydrationInfo:n,hasRehydrationInfo:uo(c=>n(c)!=null)},a={injectEndpoints:u,enhanceEndpoints({addTagTypes:c,endpoints:g}){if(c)for(let y of c)o.tagTypes.includes(y)||o.tagTypes.push(y);if(g)for(let[y,R]of Object.entries(g)){let h=aa(i,y);!h&&typeof process<"u",typeof R=="function"?R(h):Object.assign(h||{},R)}return a}},s=e.map(c=>c.init(a,o,i));function u(c){let g=c.endpoints({query:y=>({...y,type:ia}),mutation:y=>({...y,type:Fy}),infiniteQuery:y=>({...y,type:Dy})});for(let[y,R]of Object.entries(g)){if(c.overrideExisting!==!0&&y in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(pt(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[y]=R;for(let h of s)h.injectEndpoint(y,R)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function yr(e,...t){return Object.assign(e,...t)}var OT=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,i=new Set,a=new Set,s=null,{updateSubscriptionOptions:u,unsubscribeQueryResult:c}=e.internalActions,g=()=>{let C=[];for(let _ of i){let O=r.currentSubscriptions.get(_);O?(a.add(_),C.push({op:"add",path:[_],value:Object.fromEntries(O)})):(a.delete(_),C.push({op:"remove",path:[_]}))}return i.clear(),C},y=(C,_,O,F)=>{let b=dc(C,_,vf),T=F??b.get(O)??{};b.set(O,T),i.add(_)},R=(C,_)=>{if(u.match(_)){let{queryCacheKey:O,requestId:F,options:b}=_.payload,T=C.get(O);return T?.has(F)?(T.set(F,b),i.add(O),!0):!1}if(c.match(_)){let{queryCacheKey:O,requestId:F}=_.payload;return C.get(O)?.delete(F)?(i.add(O),!0):!1}if(e.internalActions.removeQueryResult.match(_)){let{queryCacheKey:O}=_.payload;return C.delete(O),a.has(O)||i.has(O)?(i.add(O),!0):!1}if(t.pending.match(_)){let{meta:{arg:O,requestId:F}}=_;return O.subscribe?(y(C,O.queryCacheKey,F,O.subscriptionOptions),!0):(dc(C,O.queryCacheKey,vf),!1)}if(t.rejected.match(_)){let{meta:{condition:O,arg:F,requestId:b}}=_;if(O&&F.subscribe)return y(C,F.queryCacheKey,b,F.subscriptionOptions),!0}return!1},h=()=>r.currentSubscriptions,E={getSubscriptions:h,getSubscriptionCount:C=>h().get(C)?.size??0,isRequestSubscribed:(C,_)=>!!h()?.get(C)?.get(_)};return(C,_)=>{if(e.util.resetApiState.match(C))return i.clear(),a.clear(),r.currentSubscriptions.clear(),s&&(clearTimeout(s),s=null),[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(C))return[!1,E];R(r.currentSubscriptions,C)&&!s&&(s=setTimeout(()=>{let T=g();s=null,T.length&&_.next(e.internalActions.subscriptionsUpdated(T))},500));let F=typeof C.type=="string"&&C.type.startsWith(o),b=t.rejected.match(C)&&C.meta.condition&&!!C.meta.arg.subscribe;return[!F&&!b,!1]}},xy=2147483647,PT=2147483647/1e3-1,NT=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a},getRunningQueryThunk:s,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:y}=t.internalActions,R=b=>r.rejected.match(b)&&!b.meta.condition,h=Yt(g.match,r.fulfilled,R,y.match);function v(b){let T=o.currentSubscriptions.get(b);return T?T.size>0:!1}let w={};function E(b){for(let T of b.values())T?.abort?.()}function C(b){let T=w[b];T&&(clearTimeout(T),delete w[b])}let _=(b,T)=>{let k=a(T.getState());if((r.pending.match(b)||r.rejected.match(b)&&b.meta.condition)&&b.meta.arg.subscribe&&C(b.meta.arg.queryCacheKey),c.match(b)&&C(b.payload.queryCacheKey),h(b)){let P;if(y.match(b))P=b.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=g.match(b)?b.payload:b.meta.arg;P=[N]}O(P,T,k)}if(t.util.resetApiState.match(b)){for(let[P,N]of Object.entries(w))N&&clearTimeout(N),delete w[P];E(o.runningQueries),E(o.runningMutations)}if(n.hasRehydrationInfo(b)){let{queries:P}=n.extractRehydrationInfo(b);O(Object.keys(P),T,k)}};function O(b,T,k){let P=T.getState();for(let N of b){let M=i(P,N);M?.endpointName&&F(N,M.endpointName,T,k)}}function F(b,T,k,P){let N=aa(n,T)?.keepUnusedDataFor??P.keepUnusedDataFor;if(N===1/0)return;let M=Math.max(0,Math.min(N,PT));if(!v(b)){let Q=w[b];Q&&clearTimeout(Q),w[b]=setTimeout(()=>{if(delete w[b],!v(b)){let U=i(k.getState(),b);U?.endpointName&&k.dispatch(s(U.endpointName,U.originalArgs))?.abort(),k.dispatch(c({queryCacheKey:b}))}},M*1e3)}}return _},Ey=new Error("Promise never resolved before cacheEntryRemoved.");function jy(e,t,r){try{return e()}catch(n){console.error(n);return}}var FT=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let u=As(n),c=As(o),g=fr(n,o),y={},{removeQueryResult:R,removeMutationResult:h,cacheEntriesUpserted:v}=e.internalActions;function w(b,T,k,P){let N=y[b];N?.valueResolved&&(P===void 0||N.requestIds?.has(P))&&(N.valueResolved({data:T,meta:k}),delete N.valueResolved,delete N.requestIds)}function E(b){let T=y[b];T&&(delete y[b],T.cacheEntryRemoved())}function C(b){let{arg:T,requestId:k}=b.meta,{endpointName:P,originalArgs:N}=T;return[P,N,k]}let _=(b,T,k)=>{let P=O(b);function N(M,Q,U,L){let B=a(k,Q),j=a(T.getState(),Q);!B&&j&&F(M,L,Q,T,U)}if(n.pending.match(b)){let[M,Q,U]=C(b);N(M,P,U,Q),y[P]?.requestIds?.add(U)}else if(v.match(b))for(let{queryDescription:M,value:Q}of b.payload){let{endpointName:U,originalArgs:L,queryCacheKey:B}=M;N(U,B,b.meta.requestId,L),w(B,Q,{})}else if(o.pending.match(b)){if(T.getState()[t].mutations[P]){let[M,Q,U]=C(b);E(P),F(M,Q,P,T,U)}}else if(g(b))w(P,b.payload,b.meta.baseQueryMeta,b.meta.requestId);else if(R.match(b)||h.match(b))E(P);else if(e.util.resetApiState.match(b))for(let M of Object.keys(y))E(M)};function O(b){return u(b)?b.meta.arg.queryCacheKey:c(b)?b.meta.arg.fixedCacheKey??b.meta.requestId:R.match(b)?b.payload.queryCacheKey:h.match(b)?Mo(b.payload):""}function F(b,T,k,P,N){let M=aa(r,b),Q=M?.onCacheEntryAdded;if(!Q)return;let U={requestIds:new Set([N])},L=new Promise(J=>{U.cacheEntryRemoved=J}),B=Promise.race([new Promise(J=>{U.valueResolved=J}),L.then(()=>{throw Ey})]);B.catch(()=>{}),y[k]=U;let j=e.endpoints[b].select(na(M)?T:k),V=P.dispatch((J,ie,ae)=>ae),z={...P,getCacheEntry:()=>j(P.getState()),requestId:N,extra:V,updateCachedData:na(M)?J=>P.dispatch(e.util.updateQueryData(b,T,J)):void 0,cacheDataLoaded:B,cacheEntryRemoved:L},W=jy(()=>Q(T,z),b,"onCacheEntryAdded");Promise.resolve(W).catch(J=>{if(J!==Ey)throw J})}return _};function Uy(e,t,r,n){t.next(e.internalActions.middlewareRegistered(r)),typeof process<"u"}var DT=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&Uy(e,o,t,r)},MT=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Yt(fr(n),mo(n)),y=Yt(fr(o,n),gn(o,n)),R=[],h=new Set,v=(C,_)=>{if(i.util.resetApiState.match(C)){h.clear(),R=[];return}(o.pending.match(C)||n.pending.match(C))&&h.add(C.meta.requestId),y(C)&&h.delete(C.meta.requestId),g(C)?E(bf(C,"invalidatesTags",r,a),_):y(C)?E([],_):i.util.invalidateTags.match(C)&&E(Ef(C.payload,void 0,void 0,void 0,void 0,a),_)};function w(){return h.size>0}function E(C,_){let O=_.getState(),F=O[e];if(R.push(...C),F.config.invalidationBehavior==="delayed"&&w())return;let b=R;if(R=[],b.length===0)return;let T=i.util.selectInvalidatedBy(O,b);t.batch(()=>{let k=Array.from(T.values());for(let{queryCacheKey:P}of k){let N=F.queries[P],M=dc(u.currentSubscriptions,P,vf);N&&(M.size===0?_.dispatch(c({queryCacheKey:P})):N.status!=="uninitialized"&&_.dispatch(s(N)))}})}return v},qT=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:i,currentSubscriptions:a}=o,s=new Set,u=null,c=(E,C)=>{(r.internalActions.updateSubscriptionOptions.match(E)||r.internalActions.unsubscribeQueryResult.match(E))&&g(E.payload.queryCacheKey,C),(t.pending.match(E)||t.rejected.match(E)&&E.meta.condition)&&g(E.meta.arg.queryCacheKey,C),(t.fulfilled.match(E)||t.rejected.match(E)&&!E.meta.condition)&&y(E.meta.arg,C),r.internalActions.removeQueryResult.match(E)&&h(E.payload.queryCacheKey),r.util.resetApiState.match(E)&&(v(),u&&(clearTimeout(u),u=null),s.clear())};function g(E,C){!i.has(E)&&!Number.isFinite(w(a.get(E)).lowestPollingInterval)||(s.add(E),u||(u=setTimeout(()=>{for(let _ of s)R({queryCacheKey:_},C);s.clear(),u=null},0)))}function y({queryCacheKey:E},C,_){let O=C.getState()[e].queries[E],{lowestPollingInterval:F}=w(a.get(E));if(!O||O.status==="uninitialized"||!Number.isFinite(F)){h(E);return}let b=i.get(E);b?.timeout&&(clearTimeout(b.timeout),b.timeout=void 0);let T=Math.min(F,xy),k=_??T,P=Date.now()+k;i.set(E,{nextPollTimestamp:P,pollingInterval:T,timeout:setTimeout(()=>{let N=C.getState()[e],M=N.queries[E],{lowestPollingInterval:Q,skipPollingIfUnfocused:U}=w(a.get(E));if(!M||M.status==="uninitialized"||!Number.isFinite(Q)){h(E);return}if(M.status==="pending"){h(E);return}(N.config.focused||!U)&&C.dispatch(n(M)),y({queryCacheKey:E},C)},k)})}function R({queryCacheKey:E},C){let _=C.getState()[e].queries[E],O=a.get(E);if(!_||_.status==="uninitialized")return;let{lowestPollingInterval:F}=w(O);if(!Number.isFinite(F)){h(E);return}let b=i.get(E);if(!b){y({queryCacheKey:E},C);return}let T=Math.min(F,xy);if(T>b.pollingInterval){let k=b.nextPollTimestamp-b.pollingInterval;y({queryCacheKey:E},C,k+T-Date.now())}else Date.now()+T<b.nextPollTimestamp&&y({queryCacheKey:E},C)}function h(E){let C=i.get(E);C?.timeout&&clearTimeout(C.timeout),i.delete(E)}function v(){for(let E of i.keys())h(E)}function w(E=new Map){let C=!1,_=Number.POSITIVE_INFINITY;for(let O of E.values())O.pollingInterval&&(_=Math.min(O.pollingInterval,_),C=O.skipPollingIfUnfocused||C);return{lowestPollingInterval:_,skipPollingIfUnfocused:C}}return c},LT=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=bs(r,n),i=gn(r,n),a=fr(r,n),s={};return(c,g)=>{if(o(c)){let{requestId:y,arg:{endpointName:R,originalArgs:h}}=c.meta,v=aa(t,R),w=v?.onQueryStarted;if(w){let E={},C=new Promise((b,T)=>{E.resolve=b,E.reject=T});C.catch(()=>{}),s[y]=E;let _=e.endpoints[R].select(na(v)?h:Mo(c.meta)),O=g.dispatch((b,T,k)=>k),F={...g,getCacheEntry:()=>_(g.getState()),requestId:y,extra:O,updateCachedData:na(v)?b=>g.dispatch(e.util.updateQueryData(R,h,b)):void 0,queryFulfilled:C};jy(()=>w(h,F),R,"onQueryStarted")}}else if(a(c)){let{requestId:y,baseQueryMeta:R}=c.meta;s[y]?.resolve({data:c.payload,meta:R}),delete s[y]}else if(i(c)){let{requestId:y,rejectedWithValue:R,baseQueryMeta:h}=c.meta;s[y]?.reject({error:c.payload??c.error,isUnhandledError:!R,meta:h}),delete s[y]}}},jT=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(u,c)=>{ta.match(u)&&s(c,"refetchOnFocus"),pc.match(u)&&s(c,"refetchOnReconnect")};function s(u,c){let g=u.getState()[e],y=g.queries,R=o.currentSubscriptions;t.batch(()=>{for(let h of R.keys()){let v=y[h],w=R.get(h);if(!w||!v)continue;let E=[...w.values()];(E.some(C=>C[c]===!0)||E.every(C=>C[c]===void 0)&&g.config[c])&&(w.size===0?u.dispatch(i({queryCacheKey:h})):v.status!=="uninitialized"&&u.dispatch(n(v)))}})}return a};function UT(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:i}=e,{apiUid:a}=o,s={invalidateTags:q(`${t}/invalidateTags`)},u=R=>R.type.startsWith(`${t}/`),c=[DT,NT,MT,qT,FT,LT];return{middleware:R=>{let h=!1,v=i(R.dispatch),w={...e,internalState:v,refetchQuery:y,isThisApiSliceAction:u,mwApi:R},E=c.map(O=>O(w)),C=OT(w),_=jT(w);return O=>F=>{if(!_i(F))return O(F);let b={...R,next:O};h||(h=!0,Uy(n,b,a,t));let T=R.getState(),[k,P]=C(F,b,T),N;if(k?N=O(F):N=P,R.getState()[t]&&(_(F,b,T),u(F)||o.hasRehydrationInfo(F)))for(let M of E)M(F,b,T);return N}},actions:s};function y(R){return e.api.endpoints[R.endpointName].initiate(R.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Ry=Symbol(),VT=({createSelector:e=Ye}={})=>({name:Ry,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:R,skipSchemaValidation:h},v){gg();let w=Se=>(typeof process<"u",Se);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:pc,onOffline:xf,onFocus:ta,onFocusLost:Cf},util:{}});let E=_T({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:C,selectCachedArgsForQuery:_,selectEntriesForEndpoint:O,selectAllQueryEntries:F,buildQuerySelector:b,buildInfiniteQuerySelector:T,buildMutationSelector:k}=E;yr(t.util,{selectInvalidatedBy:C,selectCachedArgsForQuery:_,selectEntriesForEndpoint:O,selectAllQueryEntries:F});let{queryThunk:P,infiniteQueryThunk:N,mutationThunk:M,patchQueryData:Q,updateQueryData:U,upsertQueryData:L,prefetch:B,buildMatchThunkActions:j}=RT({baseQuery:r,reducerPath:o,context:v,api:t,serializeQueryArgs:i,assertTagType:w,selectors:E,onSchemaFailure:y,catchSchemaFailure:R,skipSchemaValidation:h}),{reducer:V,actions:z}=TT({context:v,queryThunk:P,infiniteQueryThunk:N,mutationThunk:M,serializeQueryArgs:i,reducerPath:o,assertTagType:w,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:g}});yr(t.util,{patchQueryData:Q,updateQueryData:U,upsertQueryData:L,prefetch:B,resetApiState:z.resetApiState,upsertQueryEntries:z.cacheEntriesUpserted}),yr(t.internalActions,z);let W=new WeakMap,J=Se=>dc(W,Se,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:ie,buildInitiateInfiniteQuery:ae,buildInitiateMutation:le,getRunningMutationThunk:ke,getRunningMutationsThunk:Me,getRunningQueriesThunk:_e,getRunningQueryThunk:Ke}=ET({queryThunk:P,mutationThunk:M,infiniteQueryThunk:N,api:t,serializeQueryArgs:i,context:v,getInternalState:J});yr(t.util,{getRunningMutationThunk:ke,getRunningMutationsThunk:Me,getRunningQueryThunk:Ke,getRunningQueriesThunk:_e});let{middleware:je,actions:Ae}=UT({reducerPath:o,context:v,queryThunk:P,mutationThunk:M,infiniteQueryThunk:N,api:t,assertTagType:w,selectors:E,getRunningQueryThunk:Ke,getInternalState:J});return yr(t.util,Ae),yr(t,{reducer:V,middleware:je}),{name:Ry,injectEndpoint(Se,Re){var St;let $e=(St=t.endpoints)[Se]??(St[Se]={});mc(Re)&&yr($e,{name:Se,select:b(Se,Re),initiate:ie(Se,Re)},j(P,Se)),wT(Re)&&yr($e,{name:Se,select:k(),initiate:le(Se)},j(M,Se)),ra(Re)&&yr($e,{name:Se,select:T(Se,Re),initiate:ae(Se,Re)},j(P,Se))}}}}),Vy=kT(VT());m();d();p();f();m();d();p();f();var wn=e=>e.query,By=e=>e.query?.enableQuerySyntax;var G$=Ye(e=>wn(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})),BT=Ye(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();p();f();m();d();p();f();var gc=e=>{if(e==="yes")return!0;if(e==="no")return!1},GT=()=>Le("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function $T(e,t){return Le({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ve(n),i=Io(n,e);if(!o||!i)return null;let a=Nr(n);return r.makeGeneratedAnswerCitationClick(ey(i,n),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:ny(i),...(a&&{conversationId:a})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Io(r,e);return{answerId:t??Ve(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function QT(e,t,r){return Le({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let i=r??Ve(o),a=Io(o,e);if(!i||!a)return null;let s=Nr(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t,...(s&&{conversationId:s})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Io(n,e);return{answerId:r??Ve(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function HT(e,t){return Le({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function zT(e){return Le({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ve(r);if(!n)return null;let o=Nr(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ve(t)??"",action:"like"})})}function WT(e){return Le({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ve(r);if(!n)return null;let o=Nr(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ve(t)??"",action:"dislike"})})}var KT=e=>Le({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ve(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ve(t),{helpful:n,readable:o,documented:i,hallucinationFree:a,correctTopic:s,documentUrl:u,details:c}=e;return{answerId:r??"",helpful:n,details:{readable:gc(o),documented:gc(i),correctTopic:gc(s),hallucinationFree:gc(a)},additionalNotes:c,correctAnswerUrl:u}}}),Rf=(e,t,r)=>Le({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let i=t??Ve(o);if(!i)return null;let a=Nr(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:r,...(a&&{conversationId:a})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ve(n)??"",answerGenerated:e??!1})}),qo=e=>Le({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ve(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),YT=()=>Le({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"show"})}),XT=()=>Le({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"hide"})}),ZT=()=>Le({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"expand"})}),JT=()=>Le({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ve(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ve(e)??"",action:"collapse"})});function e0(e){return Le({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ve(r);if(!n)return null;let o=Nr(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ve(t)??"",action:"copyToClipboard"})})}function t0(e,t){return Le({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Io(n,e);if(!o)return null;let i=Nr(n);return i?r.makeGeneratedAnswerFollowupOpenSource({...ty(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var hc={logCopyGeneratedAnswer:e0,logGeneratedAnswerHideAnswers:XT,logGeneratedAnswerShowAnswers:YT,logGeneratedAnswerStreamEnd:Rf,logGeneratedAnswerFeedback:KT,logDislikeGeneratedAnswer:WT,logLikeGeneratedAnswer:zT,logGeneratedAnswerOpenInlineLink:HT,logHoverCitation:QT,logOpenGeneratedAnswerSource:$T,logOpenGeneratedAnswerFollowUpSource:t0,logRetryGeneratedAnswer:GT,logGeneratedAnswerExpand:ZT,logGeneratedAnswerCollapse:JT};m();d();p();f();m();d();p();f();var Gy=Ye(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();p();f();var sa=(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:Ao(e)}});m();d();p();f();var If=e=>e.context;m();d();p();f();var Tf=e=>e.pipeline;m();d();p();f();m();d();p();f();var ca=Ut(yc(),1),Ky=Ut($y(),1);m();d();p();f();var vc=Ut(yc(),1),Hy=Ut(Qy(),1);vc.default.extend(Hy.default);var zy="YYYY/MM/DD@HH:mm:ss",r0="1401-01-01";function Lo(e,t){let r=(0,vc.default)(e,t);return!r.isValid()&&!t?(0,vc.default)(e,zy):r}function Sc(e){return e.format(zy)}function Wy(e,t){let r=Lo(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}`)}Df(r)}function Df(e){if(e.isBefore(r0))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}ca.default.extend(Ky.default);var Yy=["past","now","next"],Xy=["minute","hour","day","week","month","quarter","year"],n0=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new K({required:!t,constrainTo:Xy}),period:new K({required:!0,constrainTo:Yy})}};function Mf(e){if(typeof e=="string"&&!Mr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?rv(e):e;new At(n0(t.period)).validate(t);let r=Jy(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Df(r)}function Zy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Jy(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,ca.default)().subtract(r,n);case"next":return(0,ca.default)().add(r,n);case"now":return(0,ca.default)()}}function ua(e){return Sc(Jy(rv(e)))}function ev(e){return e.toLocaleLowerCase().split("-")}function Mr(e){let[t,r,n]=ev(e);if(t==="now")return!0;if(!Yy.includes(t)||!Xy.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function tv(e){return!!e&&typeof e=="object"&&"period"in e}function rv(e){let[t,r,n]=ev(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();p();f();function nv(e){return e.type==="dateRange"}function ov(e){return`start${e}`}function iv(e){return`end${e}`}var qf=()=>({dateFacetValueMap:{}});function o0(e,t,r){let n=e.start,o=e.end;return Mr(n)&&(n=ua(n),r.dateFacetValueMap[t][ov(n)]=e.start),Mr(o)&&(o=ua(o),r.dateFacetValueMap[t][iv(o)]=e.end),{...e,start:n,end:o}}function Lf(e,t){if(nv(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>o0(o,r,t))}}return e}function qr(e){let t=qf();return{request:{...e,facets:e.facets?.map(n=>Lf(n,t))},mappings:t}}function i0(e,t,r){return{...e,start:r.dateFacetValueMap[t][ov(e.start)]||e.start,end:r.dateFacetValueMap[t][iv(e.end)]||e.end}}function a0(e,t){return e.facetId in t.dateFacetValueMap}function s0(e,t){return a0(e,t)?{...e,values:e.values.map(r=>i0(r,e.facetId,t))}:e}function bc(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>s0(n,t))}}:e}m();d();p();f();m();d();p();f();m();d();p();f();function Lr(e){return Object.values(e).map(t=>t.request)}function jf(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 av(e){return Lr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Uf={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function c0(e){return Lr(e).map(t=>{let r=Uf[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function u0(e){return[...c0(e.facetSet??{}),...av(e.numericFacetSet??{}),...av(e.dateFacetSet??{}),...Lr(e.categoryFacetSet??{})]}function l0(e){return u0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Ac(e){return jf(l0(e),e.facetOrder??[])}m();d();p();f();m();d();p();f();var jr=/*#__PURE__*/function(){var _jr=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Er(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:vt.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 nc(e.configuration.analytics,t))),...(e.excerptLength&&!ue(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});function jr(_x67,_x68){return _jr.apply(this,arguments)}return jr}();m();d();p();f();var jo=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Er(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&&sa(e.configuration.analytics,t,r)),...(e.excerptLength&&!ue(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();p();f();var sv=Ye(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 Ur=/*#__PURE__*/function(){var _Ur=_asyncToGenerator(function*(e,t,r){let n=Bf(e),o=d0(e),i=f0(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield jr(e,r):jo(e,t,r);return qr({...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:Vf(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}}})})});function Ur(_x69,_x70,_x71){return _Ur.apply(this,arguments)}return Ur}();function Vf(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function d0(e){return jf(m0(e),e.facetOrder??[])}function f0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(p0).filter(r=>r.currentValues.length>0):void 0}function p0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function m0(e){return g0(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function g0(e){return[...h0(e.facetSet??{}),...cv(e.numericFacetSet??{}),...cv(e.dateFacetSet??{}),...Lr(e.categoryFacetSet??{})]}function h0(e){return Lr(e).map(t=>{let r=Uf[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function cv(e){return Lr(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 Bf(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=sv(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();p();f();m();d();p();f();var la=(e,t)=>{let r=e;return ue(r[t])?ue(e.raw[t])?null:e.raw[t]:r[t]},y0=e=>t=>e.every(r=>!ue(la(t,r))),v0=e=>t=>e.every(r=>ue(la(t,r))),S0=(e,t)=>r=>{let n=uv(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},b0=(e,t)=>r=>{let n=uv(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},uv=(e,t)=>{let r=la(t,e);return Pm(r)?r:[r]},lv={getResultProperty:la,fieldsMustBeDefined:y0,fieldsMustNotBeDefined:v0,fieldMustMatch:S0,fieldMustNotMatch:b0};var Gf=Ye(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();p();f();var $f=e=>e.searchHub;m();d();p();f();var wc=Ye(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),x4=Ye(e=>e,e=>{let t=wc(e);return t&&e?e[t].expression:""});m();d();p();f();var dv=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();p();f();var fv=e=>e.excerptLength?.length;m();d();p();f();var pv=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();p();f();var mv=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};m();d();p();f();var gv=e=>e.sortCriteria;var hv=/*#__PURE__*/function(){var _hv=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:io(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});function hv(_x72){return _hv.apply(this,arguments)}return hv}(),yv=(e,t)=>{let r=wn(e)?.q,{aq:n,cq:o,dq:i,lq:a}=bv(e),s=If(e),u=sa(e.configuration.analytics,t,{actionCause:Gf(e)}),c=$f(e),g=Tf(e),y=ef(e)??[],R=Sv(e),h=wc(e.tabSet)||"default",v=Zd(e),w=Th(e),E=t.referrer||"",C=pv(e),_=gv(e),O=A0(e),F=fv(e),b=mv(e),T=dv(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:By(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(R.length&&{facets:R}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Vf(e),firstResult:e.pagination.firstResult}),tab:h,locale:v,timezone:w,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...O,...(b??{}),...(F&&{excerptLength:F}),...(T&&{dictionaryFieldContext:T}),sortCriteria:_,...(C&&{facetOptions:C}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},vv=(e,t)=>{let r=wn(e)?.q,n=Sv(e),o=sa(e.configuration.analytics,t,{actionCause:Gf(e)}),i=Zd(e),a=wc(e.tabSet)||"default",s=t.referrer,{aq:u,cq:c}=bv(e),g=$f(e),y=Tf(e),R=If(e),h=ef(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(y?.length&&{pipeline:y}),...(R?.contextValues&&{context:R.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:a,referrer:s,...o,locale:i}},Sv=e=>Ac(e)?.map(t=>Lf(t,qf())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),A0=e=>({actionsHistory:e.configuration.analytics.enabled?vt.getInstance().getHistory():[]}),bv=e=>{let t=Gy(e),r=Bf(e);return{...t,...(r&&{cq:r})}};m();d();p();f();var Cc=["searching","thinking","answering"];function xc(e){return e.toLowerCase()}var Ec=["search","generic"];m();d();p();f();var Av=["text/plain","text/markdown"];var Uo=new K({required:!0}),wv=new K,Vo=new ge({required:!0}),Qf={id:Uo,title:Uo,uri:Uo,permanentid:Uo,clickUri:wv},Rc=new K({required:!0,constrainTo:Av}),Cv=new K({required:!0,constrainTo:Cc}),xv=e=>({...e,name:xc(e.name)}),$z=q("generatedAnswer/setIsVisible",e=>$(e,Vo)),Ic=q("generatedAnswer/setAnswerId",e=>$(e,X)),Qz=q("generatedAnswer/setAnswerGenerationMode",e=>$(e,new K({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Hz=q("generatedAnswer/setIsEnabled",e=>$(e,Vo)),fa=q("generatedAnswer/updateMessage",e=>$(e,{textDelta:Uo})),pa=q("generatedAnswer/updateCitations",e=>$(e,{citations:new be({required:!0,each:new re({values:Qf})})})),ma=q("generatedAnswer/updateError",e=>$(e,{message:wv,code:new ne({min:0})})),Tc=q("generatedAnswer/resetAnswer"),zz=q("generatedAnswer/like"),Wz=q("generatedAnswer/dislike"),Kz=q("generatedAnswer/feedbackModal/open"),Yz=q("generatedAnswer/expand"),Xz=q("generatedAnswer/collapse"),Zz=q("generatedAnswer/setId",e=>$(e,{id:new K({required:!0})})),Jz=q("generatedAnswer/feedbackModal/close"),eW=q("generatedAnswer/sendFeedback"),Vr=q("generatedAnswer/setIsLoading",e=>$(e,Vo)),da=q("generatedAnswer/setIsStreaming",e=>$(e,Vo)),ga=q("generatedAnswer/setAnswerContentFormat",e=>$(e,Rc)),tW=q("generatedAnswer/updateResponseFormat",e=>$(e,{contentFormat:new be({each:Rc,default:["text/plain"]})})),rW=q("knowledge/updateAnswerConfigurationId",e=>$(e,Uo)),nW=q("generatedAnswer/registerFieldsToIncludeInCitations",e=>$(e,xs)),Hf=q("generatedAnswer/setIsAnswerGenerated",e=>$(e,Vo)),ha=q("generatedAnswer/setCannotAnswer",e=>$(e,Vo)),w0=q("generatedAnswer/setAnswerApiQueryParams",e=>$(e,new re({}))),Ev=q("generatedAnswer/startStep",e=>$(xv(e),{name:Cv,startedAt:new ne({min:0,required:!0})})),Rv=q("generatedAnswer/finishStep",e=>$(xv(e),{name:Cv,finishedAt:new ne({min:0,required:!0})})),Iv=q("generatedAnswer/startToolCall",e=>$(e,{toolCallName:X,startedAt:new ne({min:0,required:!0}),toolCallId:X})),Tv=q("generatedAnswer/finishToolCall",e=>$(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:X})),_c=q("generatedAnswer/toolCallArgs",e=>$(e,{toolCallId:X,args:new re({options:{required:!0}}),type:new K({required:!0,constrainTo:Ec})})),oW=Fe("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:a}=o,{search:s}=i(),{queryExecuted:u}=s,{setAbortControllerRef:c}=e,g=yield hv(r),y=(v,w)=>{switch(v){case"genqa.headerMessageType":{let E=JSON.parse(w);n(ga(E.contentFormat));break}case"genqa.messageType":n(fa(JSON.parse(w)));break;case"genqa.citationsType":n(pa(JSON.parse(w)));break;case"genqa.endOfStreamType":{let E=JSON.parse(w).answerGenerated,{answerId:C,answer:_}=i().generatedAnswer,F=u.length!==0&&!E,b=!_?.trim();n(ha(F)),n(da(!1)),n(Hf(E)),n((a??hc).logGeneratedAnswerStreamEnd(E,C,E?b:void 0)),n(qo());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${v}"`)}};n(Vr(!0));let R=v=>v.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:v=>{R(g)&&(n(Vr(!1)),v.payload&&v.payloadType&&y(v.payloadType,v.payload))},abort:v=>{R(g)&&n(ma(v))},close:()=>{R(g)&&n(da(!1))},resetAnswer:()=>{R(g)&&n(Tc())}});h?c(h):n(Vr(!1))});return function(_x73,_x74){return _ref12.apply(this,arguments)}}()),iW=Fe("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(Tc());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=yv(i,n);r(w0(a)),yield r(_v(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x75,_x76){return _ref13.apply(this,arguments)}}());m();d();p();f();m();d();p();f();function Ov(_x77,_x78){return _Ov.apply(this,arguments)}function _Ov(){_Ov=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Ov.apply(this,arguments)}function Pv(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=x0(t,a);let s=t.length,u=0;for(;r<s;){o&&(t[r]===10&&(u=++r),o=!1);let c=-1;for(;r<s&&c===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-u);break;case 13:o=!0,c=r;break;case 10:c=r;break}if(c===-1)break;e(t.subarray(u,c),n),u=r,n=-1}u===s?t=void 0:u!==0&&(t=t.subarray(u),r-=u)}}function Nv(e,t,r){let n=kv(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=kv();else if(s>0){let u=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),g=o.decode(a.subarray(c));switch(u){case"data":n.data=n.data?`${n.data}
|
|
32
|
+
${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":C0(g,n,t);break}}}}function C0(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function x0(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function kv(){return{data:"",event:"",id:"",retry:void 0}}var zf="text/event-stream",E0=1e3,Fv="last-event-id";function Dv(){return typeof window<"u"}function Mv(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:u,...c}){return new Promise((g,y)=>{let R={...r};R.accept||(R.accept=zf);let h;function v(){h?.abort(),document.hidden||F()}!s&&Dv()&&document.addEventListener("visibilitychange",v);let w=E0,E;function C(){Dv()&&document.removeEventListener("visibilitychange",v),clearTimeout(E),h?.abort()}t?.addEventListener("abort",()=>{C(),g()});let _=u??x,O=n??R0;function F(){return _F2.apply(this,arguments)}function _F2(){_F2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let b=yield _(e,{...c,headers:R,signal:h?.signal});yield O(b),yield Ov(b.body,Pv(Nv(T=>{T?R[Fv]=T:delete R[Fv]},T=>{w=T},o))),i?.(),C(),g()}catch(b){if(!h?.signal?.aborted)try{let T=a?.(b)??w;clearTimeout(E),E=setTimeout(F,T)}catch(T){C(),y(T)}}});return _F2.apply(this,arguments)}F()})}function R0(e){let t=e.headers.get("content-type");if(!t?.startsWith(zf))throw new Error(`Expected content-type to be ${zf}, Actual: ${t}`)}m();d();p();f();var I0=/*#__PURE__*/function(){var _I2=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=io(n.configuration.search?.apiBaseUrl,a,i);return Ty({baseUrl:`${c}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _fetchFn=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let y=g.url,R={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{R[h]=g[h]}),R.duplex="half",R.body=yield g.text(),x(y,R)});function fetchFn(_x82){return _fetchFn.apply(this,arguments)}return fetchFn}()})(u,{...t,signal:null},r)}catch(c){return{error:c}}});function I0(_x79,_x80,_x81){return _I2.apply(this,arguments)}return I0}(),qv=Vy({reducerPath:"answer",baseQuery:ky(I0,{maxRetries:3}),endpoints:()=>({})});var T0=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},_0=(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)},k0=(e,t)=>{delete e.error,e.citations=t.citations},O0=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},P0=(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})`)},N0=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&P0(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(T0(t,i),r(ga(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(_0(t,i),r(fa({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(k0(t,i),r(pa({citations:i.citations})));break;case"genqa.endOfStreamType":{O0(t,i);let a=t.answerId,s=i.answerGenerated??!1,u=s?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(s,a,u)),r(qo());break}}},F0=(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`},Wf=qv.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x83,_x84){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i,extra:a}){yield n;let{configuration:s,generatedAnswer:u,insightConfiguration:c}=r(),{generatedAnswerAnalyticsClient:g}=a,{organizationId:y,environment:R,accessToken:h}=s,v=io(s.search.apiBaseUrl,y,R),w=F0(v,y,u.answerConfigurationId,c?.insightId);yield Mv(w,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:x,onopen:function(){var _onopen=_asyncToGenerator(function*(E){let C=E.headers.get("x-answer-id");C&&o(_=>{_.answerId=C,i(Ic(C))})});function onopen(_x85){return _onopen.apply(this,arguments)}return onopen}(),onmessage:E=>{o(C=>{N0(E,C,i,g??hc)})},onerror:E=>{throw E},onclose:()=>{o(E=>{i(ha(!E.generated))})}})}).apply(this,arguments)}})})}),_v=e=>Wf.endpoints.getAnswer.initiate(e);m();d();p();f();var Lv=Qe(go,e=>e);m();d();p();f();function D0(e){let t=e.payload?.analyticsAction;return jv(e)&&!ue(t)}function jv(e){return"type"in e}var Uv=e=>t=>r=>{let n;D0(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return jv(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();p();f();m();d();p();f();m();d();p();f();var r6=q("tab/register",e=>{let t=new re({values:{id:X,expression:it}});return $(e,t)}),kc=q("tab/updateActiveTab",e=>$(e,X));m();d();p();f();var Oc=Ut(yc(),1),Gv=Ut(Vv(),1),$v=Ut(Bv(),1);Oc.default.extend($v.default);Oc.default.extend(Gv.default);var Qv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Oc.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});m();d();p();f();var M0=/(^|; )Coveo-Pendragon=([^;]*)/,q0=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Hv(){return typeof window>"u"?!1:M0.exec(document.cookie)?.pop()||null}function zv(){return typeof window>"u"?!1:q0.test(document.cookie)}var Wv=Qe(Qv(),e=>e.addCase(_r,(t,r)=>{L0(t,r.payload)}).addCase(Xt,(t,r)=>{j0(t,r.payload)}).addCase(ho,(t,r)=>{U0(t,r.payload)}).addCase(yo,t=>{t.analytics.enabled=!1}).addCase(vo,t=>{t.analytics.enabled=!0}).addCase(Es,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Rs,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(kc,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Zg,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(kr,(t,r)=>{ue(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Yg,(t,{payload:r})=>{V0(t,r)}));function L0(e,t){ue(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ue(t.organizationId)||(e.organizationId=t.organizationId)}function j0(e,t){ue(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ue(t.locale)||(e.search.locale=t.locale),ue(t.timezone)||(e.search.timezone=t.timezone),ue(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function U0(e,t){ue(t.enabled)||(e.analytics.enabled=t.enabled),ue(t.originContext)||(e.analytics.originContext=t.originContext),ue(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ue(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ue(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ue(t.trackingId)||(e.analytics.trackingId=t.trackingId),ue(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ue(t.source)||(e.analytics.source=t.source);try{let r=Hv();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ue(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ue(t.anonymous)||(e.analytics.anonymous=t.anonymous),ue(t.deviceId)||(e.analytics.deviceId=t.deviceId),ue(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ue(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function V0(e,t){e.knowledge.agentId=t;try{zv()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Bt=Wv;m();d();p();f();function B0(e){return e.instantlyCallable}var Kv=()=>e=>t=>e(B0(t)?t():t);m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var ct=[];for(let e=0;e<256;++e)ct.push((e+256).toString(16).slice(1));function Yv(e,t=0){return(ct[e[t+0]]+ct[e[t+1]]+ct[e[t+2]]+ct[e[t+3]]+"-"+ct[e[t+4]]+ct[e[t+5]]+"-"+ct[e[t+6]]+ct[e[t+7]]+"-"+ct[e[t+8]]+ct[e[t+9]]+"-"+ct[e[t+10]]+ct[e[t+11]]+ct[e[t+12]]+ct[e[t+13]]+ct[e[t+14]]+ct[e[t+15]]).toLowerCase()}m();d();p();f();var Jf,G0=new Uint8Array(16);function ep(){if(!Jf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Jf=crypto.getRandomValues.bind(crypto)}return Jf(G0)}m();d();p();f();m();d();p();f();var $0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tp={randomUUID:$0};function Q0(e,t,r){if(tp.randomUUID&&!t&&!e)return tp.randomUUID();e=e||{};let n=e.random??e.rng?.()??ep();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 Yv(n)}var Br=Q0;m();d();p();f();m();d();p();f();var S={};Si(S,{BRAND:()=>y_,DIRTY:()=>xn,EMPTY_PATH:()=>K0,INVALID:()=>pe,NEVER:()=>tk,OK:()=>gt,ParseStatus:()=>ut,Schema:()=>we,ZodAny:()=>Qr,ZodArray:()=>Ar,ZodBigInt:()=>Rn,ZodBoolean:()=>In,ZodBranded:()=>va,ZodCatch:()=>Ln,ZodDate:()=>Tn,ZodDefault:()=>qn,ZodDiscriminatedUnion:()=>Fc,ZodEffects:()=>Lt,ZodEnum:()=>Dn,ZodError:()=>xt,ZodFirstPartyTypeKind:()=>me,ZodFunction:()=>Mc,ZodIntersection:()=>Pn,ZodIssueCode:()=>Y,ZodLazy:()=>Nn,ZodLiteral:()=>Fn,ZodMap:()=>zo,ZodNaN:()=>Ko,ZodNativeEnum:()=>Mn,ZodNever:()=>Gt,ZodNull:()=>kn,ZodNullable:()=>rr,ZodNumber:()=>En,ZodObject:()=>Et,ZodOptional:()=>Mt,ZodParsedType:()=>te,ZodPipeline:()=>Sa,ZodPromise:()=>Hr,ZodReadonly:()=>jn,ZodRecord:()=>Dc,ZodSchema:()=>we,ZodSet:()=>Wo,ZodString:()=>$r,ZodSymbol:()=>Qo,ZodTransformer:()=>Lt,ZodTuple:()=>tr,ZodType:()=>we,ZodUndefined:()=>_n,ZodUnion:()=>On,ZodUnknown:()=>br,ZodVoid:()=>Ho,addIssueToContext:()=>ee,any:()=>R_,array:()=>k_,bigint:()=>A_,boolean:()=>sS,coerce:()=>ek,custom:()=>oS,date:()=>w_,datetimeRegex:()=>rS,defaultErrorMap:()=>vr,discriminatedUnion:()=>F_,effect:()=>H_,enum:()=>G_,function:()=>U_,getErrorMap:()=>Bo,getParsedType:()=>er,instanceof:()=>S_,intersection:()=>D_,isAborted:()=>Pc,isAsync:()=>Go,isDirty:()=>Nc,isValid:()=>Gr,late:()=>v_,lazy:()=>V_,literal:()=>B_,makeIssue:()=>ya,map:()=>L_,nan:()=>b_,nativeEnum:()=>$_,never:()=>T_,null:()=>E_,nullable:()=>W_,number:()=>aS,object:()=>O_,objectUtil:()=>rp,oboolean:()=>J_,onumber:()=>Z_,optional:()=>z_,ostring:()=>X_,pipeline:()=>Y_,preprocess:()=>K_,promise:()=>Q_,quotelessJson:()=>H0,record:()=>q_,set:()=>j_,setErrorMap:()=>W0,strictObject:()=>P_,string:()=>iS,symbol:()=>C_,transformer:()=>H_,tuple:()=>M_,undefined:()=>x_,union:()=>N_,unknown:()=>I_,util:()=>Ee,void:()=>__});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Ee;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var rp;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(rp||(rp={}));var te=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),er=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}};var Y=Ee.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"]),H0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),xt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(r(a))):s[c]=s[c]||{_errors:[]},s=s[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.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()}};xt.create=e=>new xt(e);var z0=(e,t)=>{let r;switch(e.code){case Y.invalid_type:e.received===te.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ee.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ee.joinValues(e.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ee.joinValues(e.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Ee.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.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}"`:Ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Y.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 Y.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 Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ee.assertNever(e)}return{message:r}},vr=z0;var Xv=vr;function W0(e){Xv=e}function Bo(){return Xv}m();d();p();f();var ya=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},K0=[];function ee(e,t){let r=Bo(),n=ya({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===vr?void 0:vr].filter(o=>!!o)});e.common.issues.push(n)}var ut=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return pe;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return pe;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},pe=Object.freeze({status:"aborted"}),xn=e=>({status:"dirty",value:e}),gt=e=>({status:"valid",value:e}),Pc=e=>e.status==="aborted",Nc=e=>e.status==="dirty",Gr=e=>e.status==="valid",Go=e=>typeof Promise<"u"&&e instanceof Promise;m();d();p();f();m();d();p();f();var se;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(se||(se={}));var qt=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}},Zv=(e,t)=>{if(Gr(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 xt(e.common.issues);return this._error=r,this._error}}};function ve(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var we=class{get description(){return this._def.description}_getType(t){return er(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:er(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ut,ctx:{common:t.parent.common,data:t.data,parsedType:er(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Go(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:er(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Zv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:er(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Gr(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=>Gr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:er(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Go(o)?o:Promise.resolve(o);return Zv(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:Y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Lt({schema:this,typeName:me.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 Mt.create(this,this._def)}nullable(){return rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ar.create(this)}promise(){return Hr.create(this,this._def)}or(t){return On.create([this,t],this._def)}and(t){return Pn.create(this,t,this._def)}transform(t){return new Lt({...ve(this._def),schema:this,typeName:me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new qn({...ve(this._def),innerType:this,defaultValue:r,typeName:me.ZodDefault})}brand(){return new va({typeName:me.ZodBranded,type:this,...ve(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ln({...ve(this._def),innerType:this,catchValue:r,typeName:me.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Sa.create(this,t)}readonly(){return jn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Y0=/^c[^\s-]{8,}$/i,X0=/^[0-9a-z]+$/,Z0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,J0=/^[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,e_=/^[a-z0-9_-]{21}$/i,t_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,r_=/^[-+]?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)?)??$/,n_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,o_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",np,i_=/^(?:(?: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])$/,a_=/^(?:(?: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])$/,s_=/^(([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]))$/,c_=/^(([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])$/,u_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eS="((\\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])))",d_=new RegExp(`^${eS}$`);function tS(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 f_(e){return new RegExp(`^${tS(e)}$`)}function rS(e){let t=`${eS}T${tS(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 p_(e,t){return!!((t==="v4"||!t)&&i_.test(e)||(t==="v6"||!t)&&s_.test(e))}function m_(e,t){if(!t_.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 g_(e,t){return!!((t==="v4"||!t)&&a_.test(e)||(t==="v6"||!t)&&c_.test(e))}var $r=class e extends we{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let i=this._getOrReturnCtx(t);return ee(i,{code:Y.invalid_type,expected:te.string,received:i.parsedType}),pe}let n=new ut,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ee(o,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ee(o,{code:Y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")n_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"email",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")np||(np=new RegExp(o_,"u")),np.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"emoji",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")J0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"uuid",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")e_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"nanoid",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Y0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")X0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cuid2",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Z0.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ulid",code:Y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ee(o,{validation:"url",code:Y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"regex",code:Y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?rS(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?d_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?f_(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?r_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"duration",code:Y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?p_(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"ip",code:Y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?m_(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"jwt",code:Y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?g_(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"cidr",code:Y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?u_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64",code:Y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?l_.test(t.data)||(o=this._getOrReturnCtx(t,o),ee(o,{validation:"base64url",code:Y.invalid_string,message:i.message}),n.dirty()):Ee.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:Y.invalid_string,...se.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...se.errToObj(t)})}url(t){return this._addCheck({kind:"url",...se.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...se.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...se.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...se.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...se.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...se.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...se.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...se.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...se.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...se.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...se.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...se.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,...se.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,...se.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...se.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...se.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...se.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...se.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...se.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...se.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...se.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...se.errToObj(r)})}nonempty(t){return this.min(1,se.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}};$r.create=e=>new $r({checks:[],typeName:me.ZodString,coerce:e?.coerce??!1,...ve(e)});function h_(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 En=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let i=this._getOrReturnCtx(t);return ee(i,{code:Y.invalid_type,expected:te.number,received:i.parsedType}),pe}let n,o=new ut;for(let i of this._def.checks)i.kind==="int"?Ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?h_(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.not_finite,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,se.toString(r))}gt(t,r){return this.setLimit("min",t,!1,se.toString(r))}lte(t,r){return this.setLimit("max",t,!0,se.toString(r))}lt(t,r){return this.setLimit("max",t,!1,se.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:se.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:se.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:se.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:se.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:se.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:se.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:se.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"&&Ee.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)}};En.create=e=>new En({checks:[],typeName:me.ZodNumber,coerce:e?.coerce||!1,...ve(e)});var Rn=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let n,o=new ut;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ee(n,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ee(r,{code:Y.invalid_type,expected:te.bigint,received:r.parsedType}),pe}gte(t,r){return this.setLimit("min",t,!0,se.toString(r))}gt(t,r){return this.setLimit("min",t,!1,se.toString(r))}lte(t,r){return this.setLimit("max",t,!0,se.toString(r))}lt(t,r){return this.setLimit("max",t,!1,se.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:se.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:se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:se.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:se.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}};Rn.create=e=>new Rn({checks:[],typeName:me.ZodBigInt,coerce:e?.coerce??!1,...ve(e)});var In=class extends we{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.boolean,received:n.parsedType}),pe}return gt(t.data)}};In.create=e=>new In({typeName:me.ZodBoolean,coerce:e?.coerce||!1,...ve(e)});var Tn=class e extends we{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let i=this._getOrReturnCtx(t);return ee(i,{code:Y.invalid_type,expected:te.date,received:i.parsedType}),pe}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ee(i,{code:Y.invalid_date}),pe}let n=new ut,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:Y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ee.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:se.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:se.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}};Tn.create=e=>new Tn({checks:[],coerce:e?.coerce||!1,typeName:me.ZodDate,...ve(e)});var Qo=class extends we{_parse(t){if(this._getType(t)!==te.symbol){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.symbol,received:n.parsedType}),pe}return gt(t.data)}};Qo.create=e=>new Qo({typeName:me.ZodSymbol,...ve(e)});var _n=class extends we{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.undefined,received:n.parsedType}),pe}return gt(t.data)}};_n.create=e=>new _n({typeName:me.ZodUndefined,...ve(e)});var kn=class extends we{_parse(t){if(this._getType(t)!==te.null){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.null,received:n.parsedType}),pe}return gt(t.data)}};kn.create=e=>new kn({typeName:me.ZodNull,...ve(e)});var Qr=class extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return gt(t.data)}};Qr.create=e=>new Qr({typeName:me.ZodAny,...ve(e)});var br=class extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gt(t.data)}};br.create=e=>new br({typeName:me.ZodUnknown,...ve(e)});var Gt=class extends we{_parse(t){let r=this._getOrReturnCtx(t);return ee(r,{code:Y.invalid_type,expected:te.never,received:r.parsedType}),pe}};Gt.create=e=>new Gt({typeName:me.ZodNever,...ve(e)});var Ho=class extends we{_parse(t){if(this._getType(t)!==te.undefined){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.void,received:n.parsedType}),pe}return gt(t.data)}};Ho.create=e=>new Ho({typeName:me.ZodVoid,...ve(e)});var Ar=class e extends we{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==te.array)return ee(r,{code:Y.invalid_type,expected:te.array,received:r.parsedType}),pe;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ee(r,{code:a?Y.too_big:Y.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ee(r,{code:Y.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ee(r,{code:Y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new qt(r,a,r.path,s)))).then(a=>ut.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new qt(r,a,r.path,s)));return ut.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:se.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:se.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:se.toString(r)}})}nonempty(t){return this.min(1,t)}};Ar.create=(e,t)=>new Ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:me.ZodArray,...ve(t)});function $o(e){if(e instanceof Et){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Mt.create($o(n))}return new Et({...e._def,shape:()=>t})}else return e instanceof Ar?new Ar({...e._def,type:$o(e.element)}):e instanceof Mt?Mt.create($o(e.unwrap())):e instanceof rr?rr.create($o(e.unwrap())):e instanceof tr?tr.create(e.items.map(t=>$o(t))):e}var Et=class e extends we{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==te.object){let c=this._getOrReturnCtx(t);return ee(c,{code:Y.invalid_type,expected:te.object,received:c.parsedType}),pe}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Gt&&this._def.unknownKeys==="strip"))for(let c in o.data)a.includes(c)||s.push(c);let u=[];for(let c of a){let g=i[c],y=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new qt(o,y,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of s)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")s.length>0&&(ee(o,{code:Y.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of s){let y=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new qt(o,y,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let c=[];for(let g of u){let y=yield g.key,R=yield g.value;c.push({key:y,value:R,alwaysSet:g.alwaysSet})}return c})).then(c=>ut.mergeObjectSync(n,c)):ut.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return se.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:se.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:me.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 Ee.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 Ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return $o(this)}partial(t){let r={};for(let n of Ee.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 Ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return nS(Ee.objectKeys(this.shape))}};Et.create=(e,t)=>new Et({shape:()=>e,unknownKeys:"strip",catchall:Gt.create(),typeName:me.ZodObject,...ve(t)});Et.strictCreate=(e,t)=>new Et({shape:()=>e,unknownKeys:"strict",catchall:Gt.create(),typeName:me.ZodObject,...ve(t)});Et.lazycreate=(e,t)=>new Et({shape:e,unknownKeys:"strip",catchall:Gt.create(),typeName:me.ZodObject,...ve(t)});var On=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new xt(s.ctx.common.issues));return ee(r,{code:Y.invalid_union,unionErrors:a}),pe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x86){return _ref15.apply(this,arguments)}}())).then(o);{let i,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},g=u._parseSync({data:r.data,path:r.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new xt(u));return ee(r,{code:Y.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}};On.create=(e,t)=>new On({options:e,typeName:me.ZodUnion,...ve(t)});var Sr=e=>e instanceof Nn?Sr(e.schema):e instanceof Lt?Sr(e.innerType()):e instanceof Fn?[e.value]:e instanceof Dn?e.options:e instanceof Mn?Ee.objectValues(e.enum):e instanceof qn?Sr(e._def.innerType):e instanceof _n?[void 0]:e instanceof kn?[null]:e instanceof Mt?[void 0,...Sr(e.unwrap())]:e instanceof rr?[null,...Sr(e.unwrap())]:e instanceof va||e instanceof jn?Sr(e.unwrap()):e instanceof Ln?Sr(e._def.innerType):[],Fc=class e extends we{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return ee(r,{code:Y.invalid_type,expected:te.object,received:r.parsedType}),pe;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ee(r,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Sr(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:me.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ve(n)})}};function op(e,t){let r=er(e),n=er(t);if(e===t)return{valid:!0,data:e};if(r===te.object&&n===te.object){let o=Ee.objectKeys(t),i=Ee.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let u=op(e[s],t[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===te.array&&n===te.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],u=op(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===te.date&&n===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Pn=class extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Pc(i)||Pc(a))return pe;let s=op(i.value,a.value);return s.valid?((Nc(i)||Nc(a))&&r.dirty(),{status:r.value,value:s.data}):(ee(n,{code:Y.invalid_intersection_types}),pe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Pn.create=(e,t,r)=>new Pn({left:e,right:t,typeName:me.ZodIntersection,...ve(r)});var tr=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.array)return ee(n,{code:Y.invalid_type,expected:te.array,received:n.parsedType}),pe;if(n.data.length<this._def.items.length)return ee(n,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&n.data.length>this._def.items.length&&(ee(n,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new qt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ut.mergeArray(r,a)):ut.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tr({items:e,typeName:me.ZodTuple,rest:null,...ve(t)})};var Dc=class e extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return ee(n,{code:Y.invalid_type,expected:te.object,received:n.parsedType}),pe;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new qt(n,s,n.path,s)),value:a._parse(new qt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ut.mergeObjectAsync(r,o):ut.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof we?new e({keyType:t,valueType:r,typeName:me.ZodRecord,...ve(n)}):new e({keyType:$r.create(),valueType:t,typeName:me.ZodRecord,...ve(r)})}},zo=class extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.map)return ee(n,{code:Y.invalid_type,expected:te.map,received:n.parsedType}),pe;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],c)=>({key:o._parse(new qt(n,s,n.path,[c,"key"])),value:i._parse(new qt(n,u,n.path,[c,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of a){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return pe;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let u of a){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return pe;(c.status==="dirty"||g.status==="dirty")&&r.dirty(),s.set(c.value,g.value)}return{status:r.value,value:s}}}};zo.create=(e,t,r)=>new zo({valueType:t,keyType:e,typeName:me.ZodMap,...ve(r)});var Wo=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==te.set)return ee(n,{code:Y.invalid_type,expected:te.set,received:n.parsedType}),pe;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ee(n,{code:Y.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ee(n,{code:Y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let c=new Set;for(let g of u){if(g.status==="aborted")return pe;g.status==="dirty"&&r.dirty(),c.add(g.value)}return{status:r.value,value:c}}let s=[...n.data.values()].map((u,c)=>i._parse(new qt(n,u,n.path,c)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:se.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:se.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Wo.create=(e,t)=>new Wo({valueType:e,minSize:null,maxSize:null,typeName:me.ZodSet,...ve(t)});var Mc=class e extends we{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.function)return ee(r,{code:Y.invalid_type,expected:te.function,received:r.parsedType}),pe;function n(s,u){return ya({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Bo(),vr].filter(c=>!!c),issueData:{code:Y.invalid_arguments,argumentsError:u}})}function o(s,u){return ya({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Bo(),vr].filter(c=>!!c),issueData:{code:Y.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Hr){let s=this;return gt(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new xt([]),g=yield s._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(n(u,h)),c}),y=yield Reflect.apply(a,this,g);return yield s._def.returns._def.type.parseAsync(y,i).catch(h=>{throw c.addIssue(o(y,h)),c})}))}else{let s=this;return gt(function(...u){let c=s._def.args.safeParse(u,i);if(!c.success)throw new xt([n(u,c.error)]);let g=Reflect.apply(a,this,c.data),y=s._def.returns.safeParse(g,i);if(!y.success)throw new xt([o(g,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tr.create(t).rest(br.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||tr.create([]).rest(br.create()),returns:r||br.create(),typeName:me.ZodFunction,...ve(n)})}},Nn=class extends we{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Nn.create=(e,t)=>new Nn({getter:e,typeName:me.ZodLazy,...ve(t)});var Fn=class extends we{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ee(r,{received:r.data,code:Y.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:t.data}}get value(){return this._def.value}};Fn.create=(e,t)=>new Fn({value:e,typeName:me.ZodLiteral,...ve(t)});function nS(e,t){return new Dn({values:e,typeName:me.ZodEnum,...ve(t)})}var Dn=class e extends we{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{expected:Ee.joinValues(n),received:r.parsedType,code:Y.invalid_type}),pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return ee(r,{received:r.data,code:Y.invalid_enum_value,options:n}),pe}return gt(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})}};Dn.create=nS;var Mn=class extends we{_parse(t){let r=Ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==te.string&&n.parsedType!==te.number){let o=Ee.objectValues(r);return ee(n,{expected:Ee.joinValues(o),received:n.parsedType,code:Y.invalid_type}),pe}if(this._cache||(this._cache=new Set(Ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ee.objectValues(r);return ee(n,{received:n.data,code:Y.invalid_enum_value,options:o}),pe}return gt(t.data)}get enum(){return this._def.values}};Mn.create=(e,t)=>new Mn({values:e,typeName:me.ZodNativeEnum,...ve(t)});var Hr=class extends we{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==te.promise&&r.common.async===!1)return ee(r,{code:Y.invalid_type,expected:te.promise,received:r.parsedType}),pe;let n=r.parsedType===te.promise?r.data:Promise.resolve(r.data);return gt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Hr.create=(e,t)=>new Hr({type:e,typeName:me.ZodPromise,...ve(t)});var Lt=class extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ee(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(s){if(r.value==="aborted")return pe;let u=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?pe:u.status==="dirty"?xn(u.value):r.value==="dirty"?xn(u.value):u});return function(_x87){return _ref18.apply(this,arguments)}}());{if(r.value==="aborted")return pe;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?pe:s.status==="dirty"?xn(s.value):r.value==="dirty"?xn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?pe:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Gr(a))return pe;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Gr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):pe);Ee.assertNever(o)}};Lt.create=(e,t,r)=>new Lt({schema:e,typeName:me.ZodEffects,effect:t,...ve(r)});Lt.createWithPreprocess=(e,t,r)=>new Lt({schema:t,effect:{type:"preprocess",transform:e},typeName:me.ZodEffects,...ve(r)});var Mt=class extends we{_parse(t){return this._getType(t)===te.undefined?gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Mt.create=(e,t)=>new Mt({innerType:e,typeName:me.ZodOptional,...ve(t)});var rr=class extends we{_parse(t){return this._getType(t)===te.null?gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};rr.create=(e,t)=>new rr({innerType:e,typeName:me.ZodNullable,...ve(t)});var qn=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===te.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};qn.create=(e,t)=>new qn({innerType:e,typeName:me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ve(t)});var Ln=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Go(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ln.create=(e,t)=>new Ln({innerType:e,typeName:me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ve(t)});var Ko=class extends we{_parse(t){if(this._getType(t)!==te.nan){let n=this._getOrReturnCtx(t);return ee(n,{code:Y.invalid_type,expected:te.nan,received:n.parsedType}),pe}return{status:"valid",value:t.data}}};Ko.create=e=>new Ko({typeName:me.ZodNaN,...ve(e)});var y_=Symbol("zod_brand"),va=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Sa=class e extends we{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?pe:i.status==="dirty"?(r.dirty(),xn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?pe:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:me.ZodPipeline})}},jn=class extends we{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Gr(o)&&(o.value=Object.freeze(o.value)),o);return Go(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};jn.create=(e,t)=>new jn({innerType:e,typeName:me.ZodReadonly,...ve(t)});function Jv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function oS(e,t={},r){return e?Qr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Jv(t,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Jv(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Qr.create()}var v_={object:Et.lazycreate},me;(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"})(me||(me={}));var S_=(e,t={message:`Input not instance of ${e.name}`})=>oS(r=>r instanceof e,t),iS=$r.create,aS=En.create,b_=Ko.create,A_=Rn.create,sS=In.create,w_=Tn.create,C_=Qo.create,x_=_n.create,E_=kn.create,R_=Qr.create,I_=br.create,T_=Gt.create,__=Ho.create,k_=Ar.create,O_=Et.create,P_=Et.strictCreate,N_=On.create,F_=Fc.create,D_=Pn.create,M_=tr.create,q_=Dc.create,L_=zo.create,j_=Wo.create,U_=Mc.create,V_=Nn.create,B_=Fn.create,G_=Dn.create,$_=Mn.create,Q_=Hr.create,H_=Lt.create,z_=Mt.create,W_=rr.create,K_=Lt.createWithPreprocess,Y_=Sa.create,X_=()=>iS().optional(),Z_=()=>aS().optional(),J_=()=>sS().optional(),ek={string:e=>$r.create({...e,coerce:!0}),number:e=>En.create({...e,coerce:!0}),boolean:e=>In.create({...e,coerce:!0}),bigint:e=>Rn.create({...e,coerce:!0}),date:e=>Tn.create({...e,coerce:!0})};var tk=pe;var rk=S.record(S.any()),Un=rk.optional();function cS(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var nk=S.object({name:S.string(),arguments:S.string()}),ok=S.object({id:S.string(),type:S.literal("function"),function:nk,encryptedValue:S.string().optional(),metadata:Un}),qc=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Un}),ik=S.object({type:S.literal("text"),text:S.string()}),ak=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),sk=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),Lc=S.discriminatedUnion("type",[ak,sk]),ck=S.object({type:S.literal("image"),source:Lc,metadata:S.unknown().optional()}),uk=S.object({type:S.literal("audio"),source:Lc,metadata:S.unknown().optional()}),lk=S.object({type:S.literal("video"),source:Lc,metadata:S.unknown().optional()}),dk=S.object({type:S.literal("document"),source:Lc,metadata:S.unknown().optional()});var uS=S.object({type:S.literal("binary"),mimeType:S.string(),id:S.string().optional(),url:S.string().optional(),data:S.string().optional(),filename:S.string().optional()}),lS=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:S.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},NK=uS.superRefine((e,t)=>{lS(e,t)}),fk=S.discriminatedUnion("type",[ik,ck,uk,lk,dk,uS]),pk=fk.superRefine((e,t)=>{e.type==="binary"&&lS(e,t)}),mk=qc.extend({role:S.literal("developer"),content:S.string()}),gk=qc.extend({role:S.literal("system"),content:S.string()}),hk=qc.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(ok).optional()}),yk=qc.extend({role:S.literal("user"),content:S.union([S.string(),S.array(pk)])}),vk=S.object({id:S.string(),content:S.string(),role:S.literal("tool"),toolCallId:S.string(),error:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Un}),Sk=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Un}),bk=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Un}),dS=S.discriminatedUnion("role",[mk,gk,hk,yk,vk,Sk,bk]),FK=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),Ak=S.object({description:S.string(),value:S.string()}),fS=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),wk=S.object({id:S.string(),reason:S.string(),message:S.string().optional(),toolCallId:S.string().optional(),responseSchema:S.record(S.any()).optional(),expiresAt:S.string().optional(),metadata:S.record(S.any()).optional(),subagentRunId:S.string().optional()}),Ck=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Un}),xk=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(dS),tools:S.array(fS),context:S.array(Ak),forwardedProps:S.any(),resume:S.array(Ck).optional()}),Ek=S.any(),he=class extends Error{constructor(e){super(e)}},ip=class extends he{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},Rk=S.object({name:S.string(),description:S.string().optional()}),Ik=S.object({name:S.string().optional(),type:S.string().optional(),description:S.string().optional(),version:S.string().optional(),provider:S.string().optional(),documentationUrl:S.string().optional(),metadata:S.record(S.unknown()).optional()}),Tk=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),_k=S.object({supported:S.boolean().optional(),items:S.array(fS).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),kk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),Ok=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),Pk=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(Rk).optional()}),Nk=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),Fk=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),Dk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),Mk=S.object({input:Fk.optional(),output:Dk.optional()}),qk=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),Lk=S.object({supported:S.boolean().optional(),approvals:S.boolean().optional(),interventions:S.boolean().optional(),feedback:S.boolean().optional(),interrupts:S.boolean().optional(),approveWithEdits:S.boolean().optional()}),DK=S.object({identity:Ik.optional(),transport:Tk.optional(),tools:_k.optional(),output:kk.optional(),state:Ok.optional(),multiAgent:Pk.optional(),reasoning:Nk.optional(),multimodal:Mk.optional(),execution:qk.optional(),humanInTheLoop:Lk.optional(),custom:S.record(S.unknown()).optional()}),pS=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user")]),D=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Ie=S.object({type:S.nativeEnum(D),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Un}).passthrough(),jk=Ie.extend({type:S.literal(D.TEXT_MESSAGE_START),messageId:S.string(),role:pS.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),mS=Ie.extend({type:S.literal(D.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Uk=Ie.extend({type:S.literal(D.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),Vk=Ie.extend({type:S.literal(D.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:pS.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),Bk=Ie.extend({type:S.literal(D.THINKING_TEXT_MESSAGE_START)}),Gk=mS.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),$k=Ie.extend({type:S.literal(D.THINKING_TEXT_MESSAGE_END)}),Qk=Ie.extend({type:S.literal(D.TOOL_CALL_START),toolCallId:S.string(),toolCallName:S.string(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),subagentRunId:S.string().optional()}),Hk=Ie.extend({type:S.literal(D.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),zk=Ie.extend({type:S.literal(D.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),Wk=Ie.extend({messageId:S.string(),type:S.literal(D.TOOL_CALL_RESULT),toolCallId:S.string(),content:S.string(),role:S.literal("tool").optional(),subagentRunId:S.string().optional()}),Kk=Ie.extend({type:S.literal(D.TOOL_CALL_CHUNK),toolCallId:S.string().optional(),toolCallName:S.string().optional(),parentMessageId:S.string().nullable().optional().transform(e=>e??void 0),delta:S.string().optional(),subagentRunId:S.string().optional()}),Yk=Ie.extend({type:S.literal(D.THINKING_START),title:S.string().optional()}),Xk=Ie.extend({type:S.literal(D.THINKING_END)}),Zk=Ie.extend({type:S.literal(D.STATE_SNAPSHOT),snapshot:Ek,subagentRunId:S.string().optional()}),Jk=Ie.extend({type:S.literal(D.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),eO=Ie.extend({type:S.literal(D.MESSAGES_SNAPSHOT),messages:S.array(dS)}),tO=Ie.extend({type:S.literal(D.ACTIVITY_SNAPSHOT),messageId:S.string(),activityType:S.string(),content:S.record(S.any()),replace:S.boolean().optional().default(!0),subagentRunId:S.string().optional()}),rO=Ie.extend({type:S.literal(D.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),nO=Ie.extend({type:S.literal(D.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),oO=Ie.extend({type:S.literal(D.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),iO=Ie.extend({type:S.literal(D.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:xk.optional()}),aO=S.object({type:S.literal("success")}).strict(),sO=S.object({type:S.literal("interrupt"),interrupts:S.array(wk).min(1)}).strict(),cO=S.discriminatedUnion("type",[aO,sO]),gS=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),uO=Ie.extend({type:S.literal(D.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:cO.nullable().optional().transform(e=>e??void 0),usage:S.array(gS).optional()}),lO=Ie.extend({type:S.literal(D.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(gS).optional()}),dO=Ie.extend({type:S.literal(D.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),fO=Ie.extend({type:S.literal(D.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),pO=S.union([S.literal("tool-call"),S.literal("message")]),mO=Ie.extend({type:S.literal(D.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),gO=Ie.extend({type:S.literal(D.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),hO=Ie.extend({type:S.literal(D.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),yO=Ie.extend({type:S.literal(D.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),vO=Ie.extend({type:S.literal(D.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),SO=Ie.extend({type:S.literal(D.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),bO=Ie.extend({type:S.literal(D.REASONING_ENCRYPTED_VALUE),subtype:pO,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),AO=Ie.extend({type:S.literal(D.SUBAGENT_STARTED),subagentRunId:S.string(),name:S.string(),description:S.string().optional(),parentSubagentRunId:S.string().optional(),parentToolCallId:S.string().optional(),parentMessageId:S.string().optional()}),wO=S.object({type:S.literal("success")}).strict(),CO=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),xO=S.discriminatedUnion("type",[wO,CO]),EO=Ie.extend({type:S.literal(D.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:xO.optional()}),RO=Ie.extend({type:S.literal(D.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),jc=S.discriminatedUnion("type",[jk,mS,Uk,Vk,Yk,Xk,Bk,Gk,$k,Qk,Hk,zk,Kk,Wk,Zk,Jk,eO,tO,rO,nO,oO,iO,uO,lO,dO,fO,mO,gO,hO,yO,vO,SO,bO,AO,EO,RO]);m();d();p();f();var ap={};Si(ap,{JsonPatchError:()=>He,_areEquals:()=>wa,applyOperation:()=>Vn,applyPatch:()=>Hc,applyReducer:()=>OO,deepClone:()=>_O,getValueByPointer:()=>$c,validate:()=>yS,validator:()=>Qc});m();d();p();f();m();d();p();f();var IO=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)}}(),TO=Object.prototype.hasOwnProperty;function Vc(e,t){return TO.call(e,t)}function Bc(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)Vc(e,o)&&n.push(o);return n}function lt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Gc(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 nr(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ba(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Uc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Uc(e[t]))return!0}else if(typeof e=="object"){for(var n=Bc(e),o=n.length,i=0;i<o;i++)if(Uc(e[n[i]]))return!0}}return!1}function hS(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
33
|
+
`)}var Aa=function(e){IO(t,e);function t(r,n,o,i,a){var s=this.constructor,u=e.call(this,hS(r,{name:n,index:o,operation:i,tree:a}))||this;return u.name=n,u.index=o,u.operation=i,u.tree=a,Object.setPrototypeOf(u,s.prototype),u.message=hS(r,{name:n,index:o,operation:i,tree:a}),u}return t}(Error);var He=Aa,_O=lt,Yo={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=$c(r,this.path);n&&(n=lt(n));var o=Vn(r,{op:"remove",path:this.from}).removed;return Vn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=$c(r,this.from);return Vn(r,{op:"add",path:this.path,value:lt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:wa(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},kO={add:function(e,t,r){return Gc(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:Yo.move,copy:Yo.copy,test:Yo.test,_get:Yo._get};function $c(e,t){if(t=="")return e;var r={op:"_get",path:t};return Vn(e,r),r.value}function Vn(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):Qc(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=$c(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=wa(e,t.value),a.test===!1)throw new He("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 He("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=lt(e));var s=t.path||"",u=s.split("/"),c=e,g=1,y=u.length,R=void 0,h=void 0,v=void 0;for(typeof r=="function"?v=r:v=Qc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=ba(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&u[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&R===void 0&&(c[h]===void 0?R=u.slice(0,g).join("/"):g==y-1&&(R=t.path),R!==void 0&&v(t,0,e,R)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(r&&!Gc(h))throw new He("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);Gc(h)&&(h=~~h)}if(g>=y){if(r&&t.op==="add"&&h>c.length)throw new He("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=kO[t.op].call(t,c,h,e);if(a.test===!1)throw new He("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g>=y){var a=Yo[t.op].call(t,c,h,e);if(a.test===!1)throw new He("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[h],r&&g<y&&(!c||typeof c!="object"))throw new He("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Hc(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new He("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=lt(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Vn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function OO(e,t,r){var n=Vn(e,t);if(n.test===!1)throw new He("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Qc(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new He("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Yo[e.op]){if(typeof e.path!="string")throw new He("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new He("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 He("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 He("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")&&Uc(e.value))throw new He("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 He("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 He("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=yS([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new He("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new He("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function yS(e,t,r){try{if(!Array.isArray(e))throw new He("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Hc(lt(t),lt(e),r||!0);else{r=r||Qc;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof He)return o;throw o}}function wa(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(!wa(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!wa(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var lp={};Si(lp,{compare:()=>jO,generate:()=>sp,observe:()=>LO,unobserve:()=>qO});m();d();p();f();var cp=new WeakMap,PO=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),NO=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function FO(e){return cp.get(e)}function DO(e,t){return e.observers.get(t)}function MO(e,t){e.observers.delete(t.callback)}function qO(e,t){t.unobserve()}function LO(e,t){var r=[],n,o=FO(e);if(!o)o=new PO(e),cp.set(e,o);else{var i=DO(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=lt(e),t){n.callback=t,n.next=null;var a=function(){sp(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){sp(n),clearTimeout(n.next),MO(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new NO(t,n)),n}function sp(e,t){t===void 0&&(t=!1);var r=cp.get(e.object);up(r.value,e.object,e.patches,"",t),e.patches.length&&Hc(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function up(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Bc(t),a=Bc(e),s=!1,u=!1,c=a.length-1;c>=0;c--){var g=a[c],y=e[g];if(Vc(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var R=t[g];typeof y=="object"&&y!=null&&typeof R=="object"&&R!=null&&Array.isArray(y)===Array.isArray(R)?up(y,R,r,n+"/"+nr(g),o):y!==R&&(s=!0,o&&r.push({op:"test",path:n+"/"+nr(g),value:lt(y)}),r.push({op:"replace",path:n+"/"+nr(g),value:lt(R)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+nr(g),value:lt(y)}),r.push({op:"remove",path:n+"/"+nr(g)}),u=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!u&&i.length==a.length))for(var c=0;c<i.length;c++){var g=i[c];!Vc(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+nr(g),value:lt(t[g])})}}}function jO(e,t,r){r===void 0&&(r=!1);var n=[];return up(e,t,n,"",r),n}var zc=Object.assign({},ap,lp,{JsonPatchError:Aa,deepClone:lt,escapePathComponent:nr,unescapePathComponent:ba});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var dp=function(e,t){return dp=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])},dp(e,t)};function or(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dp(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function vS(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(g){try{c(n.next(g))}catch(y){a(y)}}function u(g){try{c(n.throw(g))}catch(y){a(y)}}function c(g){g.done?i(g.value):o(g.value).then(s,u)}c((n=n.apply(e,t||[])).next())})}function Wc(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(g){return u([c,g])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(g){c=[6,g],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function wr(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 Xo(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Zo(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 Bn(e){return this instanceof Bn?(this.v=e,this):new Bn(e)}function SS(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(v){return Promise.resolve(v).then(h,y)}}function s(h,v){n[h]&&(o[h]=function(w){return new Promise(function(E,C){i.push([h,w,E,C])>1||u(h,w)})},v&&(o[h]=v(o[h])))}function u(h,v){try{c(n[h](v))}catch(w){R(i[0][3],w)}}function c(h){h.value instanceof Bn?Promise.resolve(h.value.v).then(g,y):R(i[0][2],h)}function g(h){u("next",h)}function y(h){u("throw",h)}function R(h,v){h(v),i.shift(),i.length&&u(i[0][0],i[0][1])}}function bS(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 wr=="function"?wr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,u){a=e[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}m();d();p();f();function xe(e){return typeof e=="function"}m();d();p();f();m();d();p();f();m();d();p();f();function Jo(e){var t=function(n){Error.call(n),n.stack=(new Error).stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Kc=Jo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
34
34
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
35
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function da(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ho=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=br(a),u=s.next();!u.done;u=s.next()){var c=u.value;c.remove(this)}}catch(b){t={error:b}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(Ee(g))try{g()}catch(b){i=b instanceof Mc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var R=br(v),h=R.next();!h.done;h=R.next()){var y=h.value;try{nS(y)}catch(b){i=i??[],b instanceof Mc?i=$o($o([],Bo(i)),Bo(b.errors)):i.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=R.return)&&o.call(R)}finally{if(n)throw n.error}}}if(i)throw new Mc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)nS(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)&&da(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&da(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Zp=Ho.EMPTY;function Lc(e){return e instanceof Ho||e&&"closed"in e&&Ee(e.remove)&&Ee(e.add)&&Ee(e.unsubscribe)}function nS(e){Ee(e)?e():e.unsubscribe()}m();d();f();p();var Bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var zo={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=zo.delegate;return o?.setTimeout?o.setTimeout.apply(o,$o([e,t],Bo(r))):setTimeout.apply(void 0,$o([e,t],Bo(r)))},clearTimeout:function(e){var t=zo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function qc(e){zo.setTimeout(function(){var t=Bt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function pa(){}m();d();f();p();var oS=function(){return Jp("C",void 0,void 0)}();function iS(e){return Jp("E",void 0,e)}function aS(e){return Jp("N",e,void 0)}function Jp(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var qn=null;function Wo(e){if(Bt.useDeprecatedSynchronousErrorHandling){var t=!qn;if(t&&(qn={errorThrown:!1,error:null}),e(),t){var r=qn,n=r.errorThrown,o=r.error;if(qn=null,n)throw o}}else e()}function sS(e){Bt.useDeprecatedSynchronousErrorHandling&&qn&&(qn.errorThrown=!0,qn.error=e)}var fa=function(e){rr(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lc(r)&&r.add(n)):n.destination=gO,n}return t.create=function(r,n,o){return new Uc(r,n,o)},t.prototype.next=function(r){this.isStopped?tf(aS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?tf(iS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?tf(oS,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}(Ho);var pO=Function.prototype.bind;function ef(e,t){return pO.call(e,t)}var fO=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){jc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){jc(n)}else jc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){jc(r)}},e}(),Uc=function(e){rr(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Ee(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Bt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&ef(r.next,s),error:r.error&&ef(r.error,s),complete:r.complete&&ef(r.complete,s)}):a=r}return i.destination=new fO(a),i}return t}(fa);function jc(e){Bt.useDeprecatedSynchronousErrorHandling?sS(e):qc(e)}function mO(e){throw e}function tf(e,t){var r=Bt.onStoppedNotification;r&&zo.setTimeout(function(){return r(e,t)})}var gO={closed:!0,next:pa,error:mO,complete:pa};m();d();f();p();var Ko=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Yo(e){return e}function Vc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rf(e)}function rf(e){return e.length===0?Yo:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ve=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=yO(t)?t:new Uc(t,r,n);return Wo(function(){var a=o,s=a.operator,u=a.source;i.add(s?s.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=cS(r),new r(function(o,i){var a=new Uc({next:function(s){try{t(s)}catch(u){i(u),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Ko]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return rf(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=cS(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 cS(e){var t;return(t=e??Bt.Promise)!==null&&t!==void 0?t:Promise}function hO(e){return e&&Ee(e.next)&&Ee(e.error)&&Ee(e.complete)}function yO(e){return e&&e instanceof fa||hO(e)&&Lc(e)}m();d();f();p();function vO(e){return Ee(e?.lift)}function Qe(e){return function(t){if(vO(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function We(e,t,r,n,o){return new SO(e,t,r,n,o)}var SO=function(e){rr(t,e);function t(r,n,o,i,a,s){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=s,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(fa);m();d();f();p();m();d();f();p();var uS=Qo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(e){rr(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 lS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new uS},t.prototype.next=function(r){var n=this;Wo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=br(n.currentObservers),s=a.next();!s.done;s=a.next()){var u=s.value;u.next(r)}}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Wo(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;Wo(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Zp:(this.currentObservers=null,s.push(r),new Ho(function(){n.currentObservers=null,da(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ve;return r.source=this,r},t.create=function(r,n){return new lS(r,n)},t}(Ve);var lS=function(e){rr(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:Zp},t}(nr);m();d();f();p();m();d();f();p();var nf={now:function(){return(nf.delegate||Date).now()},delegate:void 0};var Gc=function(e){rr(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=nf);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),u=0;u<s.length&&!r.closed;u+=i?1:2)r.next(s[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(nr);m();d();f();p();var Bc=new Ve(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function dS(e){return e&&Ee(e.schedule)}function bO(e){return e[e.length-1]}function pS(e){return dS(bO(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var $c=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Qc(e){return Ee(e?.then)}m();d();f();p();function Hc(e){return Ee(e[Ko])}m();d();f();p();function zc(e){return Symbol.asyncIterator&&Ee(e?.[Symbol.asyncIterator])}m();d();f();p();function Wc(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();f();p();m();d();f();p();function AO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Kc=AO();function Yc(e){return Ee(e?.[Kc])}m();d();f();p();function Xc(e){return tS(this,arguments,function(){var r,n,o,i;return Dc(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,Ln(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Ln(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ln(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 Zc(e){return Ee(e?.getReader)}function Xe(e){if(e instanceof Ve)return e;if(e!=null){if(Hc(e))return wO(e);if($c(e))return xO(e);if(Qc(e))return CO(e);if(zc(e))return fS(e);if(Yc(e))return EO(e);if(Zc(e))return RO(e)}throw Wc(e)}function wO(e){return new Ve(function(t){var r=e[Ko]();if(Ee(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function xO(e){return new Ve(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function CO(e){return new Ve(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,qc)})}function EO(e){return new Ve(function(t){var r,n;try{for(var o=br(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function fS(e){return new Ve(function(t){IO(e,t).catch(function(r){return t.error(r)})})}function RO(e){return fS(Xc(e))}function IO(e,t){var r,n,o,i;return eS(this,void 0,void 0,function(){var a,s;return Dc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=rS(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),o={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Lt(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 Jc(e,t){return t===void 0&&(t=0),Qe(function(r,n){r.subscribe(We(n,function(o){return Lt(n,e,function(){return n.next(o)},t)},function(){return Lt(n,e,function(){return n.complete()},t)},function(o){return Lt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function eu(e,t){return t===void 0&&(t=0),Qe(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function mS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function gS(e,t){return Xe(e).pipe(eu(t),Jc(t))}m();d();f();p();function hS(e,t){return new Ve(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function yS(e,t){return new Ve(function(r){var n;return Lt(r,t,function(){n=e[Kc](),Lt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Ee(n?.return)&&n.return()}})}m();d();f();p();function tu(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ve(function(r){Lt(r,t,function(){var n=e[Symbol.asyncIterator]();Lt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function vS(e,t){return tu(Xc(e),t)}function SS(e,t){if(e!=null){if(Hc(e))return mS(e,t);if($c(e))return hS(e,t);if(Qc(e))return gS(e,t);if(zc(e))return tu(e,t);if(Yc(e))return yS(e,t);if(Zc(e))return vS(e,t)}throw Wc(e)}function jn(e,t){return t?SS(e,t):Xe(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=pS(e);return jn(e,r)}m();d();f();p();function le(e,t){var r=Ee(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ve(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var bS=Qo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ru(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new bS)}})})}m();d();f();p();function $r(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function AS(e,t,r,n,o,i,a,s){var u=[],c=0,g=0,v=!1,R=function(){v&&!u.length&&!c&&t.complete()},h=function(b){return c<n?y(b):u.push(b)},y=function(b){i&&t.next(b),c++;var x=!1;Xe(r(b,g++)).subscribe(We(t,function(I){o?.(I),i?h(I):t.next(I)},function(){x=!0},void 0,function(){if(x)try{c--;for(var I=function(){var N=u.shift();a?Lt(t,a,function(){return y(N)}):y(N)};u.length&&c<n;)I();R()}catch(N){t.error(N)}}))};return e.subscribe(We(t,h,function(){v=!0,R()})),function(){s?.()}}function wt(e,t,r){return r===void 0&&(r=1/0),Ee(t)?wt(function(n,o){return $r(function(i,a){return t(n,i,o,a)})(Xe(e(n,o)))},r):(typeof t=="number"&&(r=t),Qe(function(n,o){return AS(n,o,e,r)}))}function of(e){return e===void 0&&(e=1/0),wt(Yo,e)}m();d();f();p();function nu(e){return new Ve(function(t){Xe(e()).subscribe(t)})}m();d();f();p();function af(e,t){return Qe(function(r,n){var o=0;r.subscribe(We(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}m();d();f();p();function ma(e){return Qe(function(t,r){var n=null,o=!1,i;n=t.subscribe(We(r,void 0,void 0,function(a){i=Xe(e(a,ma(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function ou(e,t){return Ee(t)?wt(e,t,1):wt(e,1)}m();d();f();p();function sf(e){return Qe(function(t,r){var n=!1;t.subscribe(We(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function Un(e){return Qe(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function cf(e,t){return Qe(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(We(n,function(u){o?.unsubscribe();var c=0,g=i++;Xe(e(u,g)).subscribe(o=We(n,function(v){return n.next(t?t(u,v,g,c++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function iu(e){return Qe(function(t,r){Xe(e).subscribe(We(r,function(){return r.complete()},pa)),!r.closed&&t.subscribe(r)})}m();d();f();p();function au(e,t,r){var n=Ee(e)||t||r?{next:e,error:t,complete:r}:e;return n?Qe(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(We(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;s=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;s&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Yo}m();d();f();p();m();d();f();p();function wS(e){return` \r
|
|
36
|
-
`.indexOf(e)>=0}function su(e){for(var t=["topLevel"],r=0,n,o,i,a=function(N){return t.push(N)},s=function(N){return t[t.length-1]=N},u=function(N){n==null&&(n=r,o=t.length,i=N)},c=function(N){N===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return r--},R=function(N){if("0"<=N&&N<="9"){a("number");return}switch(N){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":R(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():wS(y)||(c("collectionItem"),s("arrayNeedsComma"),R(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":wS(y)||(c("collectionItem"),s("objectNeedsComma"),R(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],x=function(N){return b.push(N.slice(e.length-e.lastIndexOf(N[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function CS(){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 cu=4294967296;function uf(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let u=Number(e.slice(a,s));o*=r,n=n*r+u,n>=cu&&(o=o+(n/cu|0),n=n%cu)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?RS(n,o):df(n,o)}function ES(e,t){let r=df(e,t),n=r.hi&2147483648;n&&(r=RS(r.lo,r.hi));let o=lf(r.lo,r.hi);return n?"-"+o:o}function lf(e,t){if({lo:e,hi:t}=TO(e,t),t<=2097151)return String(cu*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,u=1e7;return i>=u&&(a+=Math.floor(i/u),i%=u),a>=u&&(s+=Math.floor(a/u),a%=u),s.toString()+xS(a)+xS(i)}function TO(e,t){return{lo:e>>>0,hi:t>>>0}}function df(e,t){return{lo:e|0,hi:t|0}}function RS(e,t){return t=~t,e?e=~e+1:t+=1,df(e,t)}var xS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function IS(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var $t=_O();function _O(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||!!A.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),TS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),_S(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),TS(r),uf(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),_S(r),uf(r)},dec(r,n){return ES(r,n)},uDec(r,n){return lf(r,n)}}}function TS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function _S(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var pf;function kO(e){var t;pf=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:mf(e.encodeUtf8.bind(e))})}function ff(){if(!pf){let e=A;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,s){return s?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(a)):r.decode(a)},checkUtf8(a){try{return encodeURIComponent(a),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=a=>i.call(a)),kO(o)}return pf}function mf(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Qr;(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"})(Qr||(Qr={}));var OO=4294967295,PO=2147483647,NO=-2147483648,he=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?mf(t):ff().encodeUtf8Into,this.buffer=OS,this.viewCache=DO,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||FO;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(ga),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-ga,n=gf(r);return n>ga&&(this.ensureCapacity(n-ga),this.buffer.copyWithin(t+n,t+ga,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(kS(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(hf(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<=PS){this.ensureCapacity(r+1);let u=this.buffer,c=this.pos;u[c++]=r;let g=0;for(;g<r;g++){let v=t.charCodeAt(g);if(v>127)break;u[c++]=v}if(g==r)return this.pos=c,this}this.ensureCapacity(r*3+5);let n=gf(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=gf(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return MO(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 kS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return hf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return hf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=$t.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=$t.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=$t.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=$t.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,i)}uint64(t){let r=$t.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let u=t>>>s,c=!(!(u>>>7)&&r==0);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let s=3;s<31;s=s+7){let u=r>>>s,c=!!(u>>>7);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},FO=128,ga=1,OS=new Uint8Array(0),DO=new DataView(OS.buffer),PS=32;function gf(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var J=class{constructor(t,r=ff().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=CS,this.uint32=IS,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 Qr.Varint:for(;this.buf[this.pos++]&128;);break;case Qr.Bit64:this.pos+=4;case Qr.Bit32:this.pos+=4;break;case Qr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Qr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Qr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),$t.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),$t.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,$t.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return $t.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return $t.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=PS){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 hf(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>PO||e<NO)throw new Error("invalid int32: "+e)}function kS(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>OO||e<0)throw new Error("invalid uint32: "+e)}function MO(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 LO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function yf(){return{fields:{}}}var ut={encode(e,t=new he){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&bf.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=yf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=bf.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=yf();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=yf();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 NS(){return{key:"",value:void 0}}var bf={encode(e,t=new he){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ae.encode(ae.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=NS();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=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=NS();return t.key=e.key??"",t.value=e.value??void 0,t}};function vf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ae={encode(e,t=new he){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ut.encode(ut.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ha.encode(ha.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=vf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=ut.unwrap(ut.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=ha.unwrap(ha.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=vf();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=vf();if(e===null)t.nullValue=LO.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Sf(){return{values:[]}}var ha={encode(e,t=new he){for(let r of e.values)ae.encode(ae.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=Sf();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ae.unwrap(ae.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ha.fromPartial(e??{})},fromPartial(e){let t=Sf();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Sf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},qO=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 FS(){return{op:0,path:"",from:void 0,value:void 0}}var lu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=FS();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=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=FS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function DS(){return{id:"",type:"",function:void 0,metadata:void 0}}var du={encode(e,t=new he){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&pu.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=DS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=pu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=DS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?pu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function MS(){return{name:"",arguments:""}}var pu={encode(e,t=new he){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=MS();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 pu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function LS(){return{value:"",mimeType:""}}var fu={encode(e,t=new he){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=LS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function qS(){return{value:"",mimeType:void 0}}var mu={encode(e,t=new he){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=qS();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 mu.fromPartial(e??{})},fromPartial(e){let t=qS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function jS(){return{data:void 0,url:void 0}}var Rt={encode(e,t=new he){return e.data!==void 0&&fu.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&mu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=jS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=fu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=mu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rt.fromPartial(e??{})},fromPartial(e){let t=jS();return t.data=e.data!==void 0&&e.data!==null?fu.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?mu.fromPartial(e.url):void 0,t}};function US(){return{text:""}}var gu={encode(e,t=new he){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=US();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 gu.fromPartial(e??{})},fromPartial(e){let t=US();return t.text=e.text??"",t}};function VS(){return{source:void 0,metadata:void 0}}var hu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=VS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=VS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function GS(){return{source:void 0,metadata:void 0}}var yu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function BS(){return{source:void 0,metadata:void 0}}var vu={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=BS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=BS();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function $S(){return{source:void 0,metadata:void 0}}var Su={encode(e,t=new he){return e.source!==void 0&&Rt.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ae.encode(ae.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Rt.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ae.unwrap(ae.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=$S();return t.source=e.source!==void 0&&e.source!==null?Rt.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function QS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var bu={encode(e,t=new he){return e.text!==void 0&&gu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&hu.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&yu.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&vu.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Su.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=QS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=gu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=hu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=yu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=vu.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Su.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=QS();return t.text=e.text!==void 0&&e.text!==null?gu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?hu.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?yu.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?vu.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Su.fromPartial(e.document):void 0,t}};function HS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Au={encode(e,t=new he){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)du.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)bu.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=HS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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(du.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(bu.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=HS();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=>du.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>bu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function zS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var wu={encode(e,t=new he){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&&ae.encode(ae.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ae.encode(ae.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=zS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.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=ae.unwrap(ae.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ae.unwrap(ae.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 wu.fromPartial(e??{})},fromPartial(e){let t=zS();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}},jO=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 WS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var oe={encode(e,t=new he){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ae.encode(ae.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ut.encode(ut.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=WS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=Xo(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ae.unwrap(ae.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=ut.unwrap(ut.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=WS();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 KS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var xu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 xu.fromPartial(e??{})},fromPartial(e){let t=KS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 YS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Cu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Cu.fromPartial(e??{})},fromPartial(e){let t=YS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function XS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Eu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Eu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function ZS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Ru={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Ru.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 JS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Iu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Iu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function eb(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Tu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Tu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var _u={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ae.encode(ae.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ae.unwrap(ae.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 _u.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function rb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var ku={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)lu.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=rb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(lu.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 ku.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>lu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function nb(){return{baseEvent:void 0,messages:[]}}var Ou={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Au.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Au.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Au.fromPartial(r))||[],t}};function ob(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Pu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ae.encode(ae.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ob();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ae.unwrap(ae.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 Pu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 ib(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Nu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ae.encode(ae.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ae.unwrap(ae.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 Nu.fromPartial(e??{})},fromPartial(e){let t=ib();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function ab(){return{baseEvent:void 0,threadId:"",runId:""}}var Fu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Fu.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function sb(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Vn={encode(e,t=new he){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=sb();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=Xo(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=Xo(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=Xo(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Xo(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Xo(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Vn.fromPartial(e??{})},fromPartial(e){let t=sb();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 cb(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Du={encode(e,t=new he){e.baseEvent!==void 0&&oe.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&&ae.encode(ae.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)wu.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Vn.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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=ae.unwrap(ae.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(wu.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Du.fromPartial(e??{})},fromPartial(e){let t=cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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=>wu.fromPartial(r))||[],t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function ub(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Mu={encode(e,t=new he){e.baseEvent!==void 0&&oe.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)Vn.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=ub();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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(Vn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Vn.fromPartial(r))||[],t}};function lb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Lu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=lb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Lu.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function db(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var qu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 qu.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function pb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var ju={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 ju.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 fb(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Uu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=fb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Uu.fromPartial(e??{})},fromPartial(e){let t=fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 mb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Vu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=mb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Vu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 gb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Gu={encode(e,t=new he){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ae.encode(ae.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=gb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=ae.unwrap(ae.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 Gu.fromPartial(e??{})},fromPartial(e){let t=gb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 hb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Bu={encode(e,t=new he){return e.baseEvent!==void 0&&oe.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 J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=hb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Bu.fromPartial(e??{})},fromPartial(e){let t=hb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function yb(){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 vb={encode(e,t=new he){return e.textMessageStart!==void 0&&xu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Cu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Eu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Ru.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Iu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Tu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&_u.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&ku.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Ou.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Pu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Nu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Fu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Du.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Mu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Lu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&qu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ju.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Uu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Vu.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Gu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Bu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof J?e:new J(e),n=t===void 0?r.len:r.pos+t,o=yb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=xu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Cu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Eu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Ru.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Iu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Tu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=_u.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=ku.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Ou.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Pu.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Nu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Fu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Du.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Mu.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Lu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=qu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=ju.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Uu.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=Vu.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Gu.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=Bu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vb.fromPartial(e??{})},fromPartial(e){let t=yb();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?xu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Cu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Eu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Ru.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Iu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Tu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?_u.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?ku.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Ou.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Pu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Nu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Fu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Du.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Mu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Lu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?qu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ju.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Uu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Vu.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Gu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Bu.fromPartial(e.subagentError):void 0,t}};function Xo(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Sb=e=>e&&typeof e=="object"?e:void 0;var uu=e=>{let t=Sb(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}}}},UO=e=>{let t=Sb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:uu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:uu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:uu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:uu(r.source),metadata:r.metadata}}}};function bb(e){let t=vb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=jO[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===F.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(a=>UO(a)).filter(a=>a!==void 0);i.length>0&&(o.content=i)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===F.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:i}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===F.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,i=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===F.RUN_FINISHED||r.type===F.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===F.STATE_DELTA)for(let n of r.delta)n.op=qO[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]}),Rc.parse(r)}var Af="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var GO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,wf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(GO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Ab=e=>e==="*"||e==="x"||e==="X",wb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},BO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],$O=(e,t)=>{if(Ab(e)||Ab(t))return 0;let[r,n]=BO(wb(e),wb(t));return r>n?1:r<n?-1:0},xf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=$O(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Zo=(e,t)=>{let r=wf(e),n=wf(t),o=r.pop(),i=n.pop(),a=xf(r,n);return a!==0?a:o&&i?xf(o.split("."),i.split(".")):o||i?o?-1:1:0};var Te=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ya(){return jr()}function Rf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Rf(t);return e}var xb=512*1024;function Cb(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let u=0;u<s.length;u++){let c=s[u];if(n+=c.length,n>r)return!0;o.push(a[c])}}}}return!1}function Pe(_x89,_x90,_x91,_x92){return _Pe.apply(this,arguments)}function _Pe(){_Pe=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,s=a&&!Cb(t,r,xb),u=s?Te(t):t,c=s?Te(r):r,g=!1,v=!1,R;for(let h of e)try{s&&(Rf(u),Rf(c));let y=yield n(h,u,c);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==u&&(u=Te(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==c&&(c=Te(y.state),v=!0,b=!0),s&&b&&Cb(u,c,xb)&&(s=!1),R=y.stopPropagation,R===!0)break}catch(y){if(a&&y instanceof TypeError){if(i)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else i||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(u)?Te(u):u}:{}),...(v?{state:Object.isFrozen(c)?Te(c):c}:{}),...(R===void 0?{}:{stopPropagation:R})}});return _Pe.apply(this,arguments)}function $u(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 va(e){if(e instanceof If)return e;if(e===!0)return new If($u(!0))}var If=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 Cf(e){return e.enabled?new If(e):void 0}function QO(e,t,r){if(t){let o=e.find(a=>a.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let i={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(i),i}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}function It(e,t){return!e||t.metadata===void 0?!1:(e.metadata=$v(e.metadata,Te(t.metadata)),!0)}var Fb=(e,t,r,n,o)=>{let i=va(o),a=Te(r.messages),s=Te(e.state),u={},c=v=>{v.messages!==void 0&&(a=v.messages,u.messages=v.messages),v.state!==void 0&&(s=v.state,u.state=v.state)},g=()=>{let v=Te(u);return u={},v.messages!==void 0||v.state!==void 0?Oe(v):Bc};return t.pipe(ou(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(v){let R=yield Pe(n,a,s,(h,y,b)=>h.onEvent?.({event:v,agent:r,input:e,messages:y,state:b}));if(c(R),R.stopPropagation===!0?i?.event("APPLY","Event dropped:",v,{type:v.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",v,{type:v.type,subscribers:n.length}),R.stopPropagation===!0)return g();switch(v.type){case F.TEXT_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onTextMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:x,subagentRunId:I}=v,N=a.find(w=>w.id===y);if(N?.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 _=N;if(!_){let w={id:y,role:b,content:"",...(x!==void 0&&{name:x}),...(I!=null&&{subagentRunId:I})};a.push(w),_=w}let P=It(_,v);(!N||P)&&c({messages:a})}return g()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onTextMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.TEXT_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onTextMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:x,subagentRunId:I}=v,N=a.find(O=>O.toolCalls?.some(k=>k.id===y))?.toolCalls?.find(O=>O.id===y);if(N){let O=N.function.name!==b;return O&&(console.warn(`TOOL_CALL_START: tool call '${y}' already exists with name '${N.function.name}' \u2014 updating it to '${b}'`),N.function.name=b),(It(N,v)||O)&&c({messages:a}),g()}let _=new Set(a.map(O=>O.id)),P=QO(a,x,y);!_.has(P.id)&&I!=null&&P.subagentRunId===void 0&&(P.subagentRunId=I),P.toolCalls??(P.toolCalls=[]);let w={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(w),It(w,v),c({messages:a})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=a.find(N=>N.toolCalls?.some(_=>_.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=b.toolCalls?.find(N=>N.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Pe(n,a,s,(N,_,P)=>{let w=x.function.arguments,O=x.function.name,k={};try{k=su(w)}catch{}return N.onToolCallArgsEvent?.({event:v,messages:_,state:P,agent:r,input:e,toolCallBuffer:w,toolCallName:O,partialToolCallArgs:k})});return c(I),I.stopPropagation!==!0&&(x.function.arguments+=y,It(x,v),c({messages:a})),g()}case F.TOOL_CALL_END:{let{toolCallId:h}=v,y=a.find(I=>I.toolCalls?.some(N=>N.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(I=>I.id===h);if(!b)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>{let P=b.function.arguments,w=b.function.name,O={};try{O=JSON.parse(P)}catch{}return I.onToolCallEndEvent?.({event:v,messages:N,state:_,agent:r,input:e,toolCallName:w,toolCallArgs:O})});return c(x),x.stopPropagation!==!0&&It(b,v)&&c({messages:a}),yield Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:b,messages:a,state:s,agent:r,input:e})})),g()}case F.TOOL_CALL_RESULT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onToolCallResultEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:x,role:I,subagentRunId:N}=v,_={id:y,toolCallId:b,role:I||"tool",content:x,...(N!=null&&{subagentRunId:N})};It(_,v);let P=a.findIndex(w=>w.role==="assistant"&&w.toolCalls?.some(O=>O.id===b));if(P===-1)a.push(_);else{let w=P+1;for(;w<a.length&&a[w].role==="tool";)w++;a.splice(w,0,_)}yield Promise.all(n.map(w=>{w.onNewMessage?.({message:_,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case F.STATE_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;s=y,c({state:s})}return g()}case F.STATE_DELTA:{let h=yield Pe(n,a,s,(y,b,x)=>y.onStateDeltaEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{s=Fc.applyPatch(s,y,!0,!1).newDocument,c({state:s})}catch(b){let x=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
|
|
35
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});m();d();p();f();function Ca(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ei=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=wr(a),u=s.next();!u.done;u=s.next()){var c=u.value;c.remove(this)}}catch(w){t={error:w}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var g=this.initialTeardown;if(xe(g))try{g()}catch(w){i=w instanceof Kc?w.errors:[w]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var R=wr(y),h=R.next();!h.done;h=R.next()){var v=h.value;try{AS(v)}catch(w){i=i??[],w instanceof Kc?i=Zo(Zo([],Xo(i)),Xo(w.errors)):i.push(w)}}}catch(w){n={error:w}}finally{try{h&&!h.done&&(o=R.return)&&o.call(R)}finally{if(n)throw n.error}}}if(i)throw new Kc(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)AS(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ca(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ca(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var fp=ei.EMPTY;function Yc(e){return e instanceof ei||e&&"closed"in e&&xe(e.remove)&&xe(e.add)&&xe(e.unsubscribe)}function AS(e){xe(e)?e():e.unsubscribe()}m();d();p();f();var $t={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();p();f();m();d();p();f();var ti={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ti.delegate;return o?.setTimeout?o.setTimeout.apply(o,Zo([e,t],Xo(r))):setTimeout.apply(void 0,Zo([e,t],Xo(r)))},clearTimeout:function(e){var t=ti.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Xc(e){ti.setTimeout(function(){var t=$t.onUnhandledError;if(t)t(e);else throw e})}m();d();p();f();function xa(){}m();d();p();f();var wS=function(){return pp("C",void 0,void 0)}();function CS(e){return pp("E",void 0,e)}function xS(e){return pp("N",e,void 0)}function pp(e,t,r){return{kind:e,value:t,error:r}}m();d();p();f();var Gn=null;function ri(e){if($t.useDeprecatedSynchronousErrorHandling){var t=!Gn;if(t&&(Gn={errorThrown:!1,error:null}),e(),t){var r=Gn,n=r.errorThrown,o=r.error;if(Gn=null,n)throw o}}else e()}function ES(e){$t.useDeprecatedSynchronousErrorHandling&&Gn&&(Gn.errorThrown=!0,Gn.error=e)}var Ea=function(e){or(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Yc(r)&&r.add(n)):n.destination=GO,n}return t.create=function(r,n,o){return new Jc(r,n,o)},t.prototype.next=function(r){this.isStopped?gp(xS(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?gp(CS(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?gp(wS,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}(ei);var UO=Function.prototype.bind;function mp(e,t){return UO.call(e,t)}var VO=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){Zc(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Zc(n)}else Zc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Zc(r)}},e}(),Jc=function(e){or(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(xe(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&$t.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&mp(r.next,s),error:r.error&&mp(r.error,s),complete:r.complete&&mp(r.complete,s)}):a=r}return i.destination=new VO(a),i}return t}(Ea);function Zc(e){$t.useDeprecatedSynchronousErrorHandling?ES(e):Xc(e)}function BO(e){throw e}function gp(e,t){var r=$t.onStoppedNotification;r&&ti.setTimeout(function(){return r(e,t)})}var GO={closed:!0,next:xa,error:BO,complete:xa};m();d();p();f();var ni=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();p();f();m();d();p();f();function oi(e){return e}function eu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return hp(e)}function hp(e){return e.length===0?oi:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ge=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=QO(t)?t:new Jc(t,r,n);return ri(function(){var a=o,s=a.operator,u=a.source;i.add(s?s.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=RS(r),new r(function(o,i){var a=new Jc({next:function(s){try{t(s)}catch(u){i(u),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[ni]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return hp(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=RS(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 RS(e){var t;return(t=e??$t.Promise)!==null&&t!==void 0?t:Promise}function $O(e){return e&&xe(e.next)&&xe(e.error)&&xe(e.complete)}function QO(e){return e&&e instanceof Ea||$O(e)&&Yc(e)}m();d();p();f();function HO(e){return xe(e?.lift)}function ze(e){return function(t){if(HO(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();p();f();function Xe(e,t,r,n,o){return new zO(e,t,r,n,o)}var zO=function(e){or(t,e);function t(r,n,o,i,a,s){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=s,u._next=n?function(c){try{n(c)}catch(g){r.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Ea);m();d();p();f();m();d();p();f();var IS=Jo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var ir=function(e){or(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 TS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new IS},t.prototype.next=function(r){var n=this;ri(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=wr(n.currentObservers),s=a.next();!s.done;s=a.next()){var u=s.value;u.next(r)}}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;ri(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;ri(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?fp:(this.currentObservers=null,s.push(r),new ei(function(){n.currentObservers=null,Ca(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ge;return r.source=this,r},t.create=function(r,n){return new TS(r,n)},t}(Ge);var TS=function(e){or(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:fp},t}(ir);m();d();p();f();m();d();p();f();var yp={now:function(){return(yp.delegate||Date).now()},delegate:void 0};var tu=function(e){or(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=yp);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),u=0;u<s.length&&!r.closed;u+=i?1:2)r.next(s[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var u=o.now(),c=0,g=1;g<i.length&&i[g]<=u;g+=2)c=g;c&&i.splice(0,c+1)}},t}(ir);m();d();p();f();var ru=new Ge(function(e){return e.complete()});m();d();p();f();m();d();p();f();m();d();p();f();function _S(e){return e&&xe(e.schedule)}function WO(e){return e[e.length-1]}function kS(e){return _S(WO(e))?e.pop():void 0}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var nu=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();p();f();function ou(e){return xe(e?.then)}m();d();p();f();function iu(e){return xe(e[ni])}m();d();p();f();function au(e){return Symbol.asyncIterator&&xe(e?.[Symbol.asyncIterator])}m();d();p();f();function su(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}m();d();p();f();m();d();p();f();function KO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var cu=KO();function uu(e){return xe(e?.[cu])}m();d();p();f();function lu(e){return SS(this,arguments,function(){var r,n,o,i;return Wc(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,Bn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Bn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Bn(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 du(e){return xe(e?.getReader)}function et(e){if(e instanceof Ge)return e;if(e!=null){if(iu(e))return YO(e);if(nu(e))return XO(e);if(ou(e))return ZO(e);if(au(e))return OS(e);if(uu(e))return JO(e);if(du(e))return eP(e)}throw su(e)}function YO(e){return new Ge(function(t){var r=e[ni]();if(xe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function XO(e){return new Ge(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function ZO(e){return new Ge(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Xc)})}function JO(e){return new Ge(function(t){var r,n;try{for(var o=wr(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function OS(e){return new Ge(function(t){tP(e,t).catch(function(r){return t.error(r)})})}function eP(e){return OS(lu(e))}function tP(e,t){var r,n,o,i;return vS(this,void 0,void 0,function(){var a,s;return Wc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=bS(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),o={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();p();f();m();d();p();f();function jt(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 fu(e,t){return t===void 0&&(t=0),ze(function(r,n){r.subscribe(Xe(n,function(o){return jt(n,e,function(){return n.next(o)},t)},function(){return jt(n,e,function(){return n.complete()},t)},function(o){return jt(n,e,function(){return n.error(o)},t)}))})}m();d();p();f();function pu(e,t){return t===void 0&&(t=0),ze(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function PS(e,t){return et(e).pipe(pu(t),fu(t))}m();d();p();f();function NS(e,t){return et(e).pipe(pu(t),fu(t))}m();d();p();f();function FS(e,t){return new Ge(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();p();f();function DS(e,t){return new Ge(function(r){var n;return jt(r,t,function(){n=e[cu](),jt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return xe(n?.return)&&n.return()}})}m();d();p();f();function mu(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ge(function(r){jt(r,t,function(){var n=e[Symbol.asyncIterator]();jt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();p();f();function MS(e,t){return mu(lu(e),t)}function qS(e,t){if(e!=null){if(iu(e))return PS(e,t);if(nu(e))return FS(e,t);if(ou(e))return NS(e,t);if(au(e))return mu(e,t);if(uu(e))return DS(e,t);if(du(e))return MS(e,t)}throw su(e)}function $n(e,t){return t?qS(e,t):et(e)}function Oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=kS(e);return $n(e,r)}m();d();p();f();function fe(e,t){var r=xe(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ge(t?function(o){return t.schedule(n,0,o)}:n)}m();d();p();f();m();d();p();f();var LS=Jo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function gu(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new LS)}})})}m();d();p();f();function zr(e,t){return ze(function(r,n){var o=0;r.subscribe(Xe(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();p();f();m();d();p();f();m();d();p();f();function jS(e,t,r,n,o,i,a,s){var u=[],c=0,g=0,y=!1,R=function(){y&&!u.length&&!c&&t.complete()},h=function(w){return c<n?v(w):u.push(w)},v=function(w){i&&t.next(w),c++;var E=!1;et(r(w,g++)).subscribe(Xe(t,function(C){o?.(C),i?h(C):t.next(C)},function(){E=!0},void 0,function(){if(E)try{c--;for(var C=function(){var _=u.shift();a?jt(t,a,function(){return v(_)}):v(_)};u.length&&c<n;)C();R()}catch(_){t.error(_)}}))};return e.subscribe(Xe(t,h,function(){y=!0,R()})),function(){s?.()}}function Rt(e,t,r){return r===void 0&&(r=1/0),xe(t)?Rt(function(n,o){return zr(function(i,a){return t(n,i,o,a)})(et(e(n,o)))},r):(typeof t=="number"&&(r=t),ze(function(n,o){return jS(n,o,e,r)}))}function vp(e){return e===void 0&&(e=1/0),Rt(oi,e)}m();d();p();f();function hu(e){return new Ge(function(t){et(e()).subscribe(t)})}m();d();p();f();function Sp(e,t){return ze(function(r,n){var o=0;r.subscribe(Xe(n,function(i){return e.call(t,i,o++)&&n.next(i)}))})}m();d();p();f();function Ra(e){return ze(function(t,r){var n=null,o=!1,i;n=t.subscribe(Xe(r,void 0,void 0,function(a){i=et(e(a,Ra(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();p();f();function yu(e,t){return xe(t)?Rt(e,t,1):Rt(e,1)}m();d();p();f();function bp(e){return ze(function(t,r){var n=!1;t.subscribe(Xe(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();p();f();function Qn(e){return ze(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();p();f();function Ap(e,t){return ze(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(Xe(n,function(u){o?.unsubscribe();var c=0,g=i++;et(e(u,g)).subscribe(o=Xe(n,function(y){return n.next(t?t(u,y,g,c++):y)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();p();f();function vu(e){return ze(function(t,r){et(e).subscribe(Xe(r,function(){return r.complete()},xa)),!r.closed&&t.subscribe(r)})}m();d();p();f();function Su(e,t,r){var n=xe(e)||t||r?{next:e,error:t,complete:r}:e;return n?ze(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(Xe(i,function(u){var c;(c=n.next)===null||c===void 0||c.call(n,u),i.next(u)},function(){var u;s=!1,(u=n.complete)===null||u===void 0||u.call(n),i.complete()},function(u){var c;s=!1,(c=n.error)===null||c===void 0||c.call(n,u),i.error(u)},function(){var u,c;s&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):oi}m();d();p();f();m();d();p();f();function US(e){return` \r
|
|
36
|
+
`.indexOf(e)>=0}function bu(e){for(var t=["topLevel"],r=0,n,o,i,a=function(_){return t.push(_)},s=function(_){return t[t.length-1]=_},u=function(_){n==null&&(n=r,o=t.length,i=_)},c=function(_){_===i&&(n=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},y=function(){return r--},R=function(_){if("0"<=_&&_<="9"){a("number");return}switch(_){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},h=e.length;r<h;r++){var v=e[r];switch(t[t.length-1]){case"topLevel":R(v);break;case"string":switch(v){case"\"":g();break;case"\\":u("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":v==="u"?a("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(c("stringEscape"),g());break;case"number":v==="."?s("numberNeedsDigit"):v==="e"||v==="E"?s("numberNeedsExponent"):(v<"0"||v>"9")&&(y(),g());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(v==="+"||v==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(v<"a"||v>"z")&&(y(),g());break;case"arrayNeedsValue":v==="]"?g():US(v)||(c("collectionItem"),s("arrayNeedsComma"),R(v));break;case"arrayNeedsComma":v==="]"?g():v===","&&(u("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":v==="}"?g():v==="\""&&(u("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":v===":"&&s("objectNeedsValue");break;case"objectNeedsValue":US(v)||(c("collectionItem"),s("objectNeedsComma"),R(v));break;case"objectNeedsComma":v==="}"?g():v===","&&(u("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var w=[n!=null?e.slice(0,n):e],E=function(_){return w.push(_.slice(e.length-e.lastIndexOf(_[0])))},C=t.length-1;C>=0;C--)switch(t[C]){case"string":w.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":w.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":w.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":w.push("}");break}return w.join("")}m();d();p();f();m();d();p();f();m();d();p();f();function BS(){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 Au=4294967296;function wp(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let u=Number(e.slice(a,s));o*=r,n=n*r+u,n>=Au&&(o=o+(n/Au|0),n=n%Au)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?$S(n,o):xp(n,o)}function GS(e,t){let r=xp(e,t),n=r.hi&2147483648;n&&(r=$S(r.lo,r.hi));let o=Cp(r.lo,r.hi);return n?"-"+o:o}function Cp(e,t){if({lo:e,hi:t}=rP(e,t),t<=2097151)return String(Au*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,u=1e7;return i>=u&&(a+=Math.floor(i/u),i%=u),a>=u&&(s+=Math.floor(a/u),a%=u),s.toString()+VS(a)+VS(i)}function rP(e,t){return{lo:e>>>0,hi:t>>>0}}function xp(e,t){return{lo:e|0,hi:t|0}}function $S(e,t){return t=~t,e?e=~e+1:t+=1,xp(e,t)}var VS=e=>{let t=String(e);return"0000000".slice(t.length)+t};function QS(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();p();f();var Qt=nP();function nP(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!A.Deno||!!A.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),HS(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),zS(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),HS(r),wp(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),zS(r),wp(r)},dec(r,n){return GS(r,n)},uDec(r,n){return Cp(r,n)}}}function HS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function zS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();p();f();var Ep;function oP(e){var t;Ep=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Ip(e.encodeUtf8.bind(e))})}function Rp(){if(!Ep){let e=A;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("utf-8",{ignoreBOM:!0}),n,o={encodeUtf8(a){return t.encode(a)},decodeUtf8(a,s){return s?(n||(n=new e.TextDecoder("utf-8",{fatal:!0,ignoreBOM:!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)),oP(o)}return Ep}function Ip(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Wr;(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"})(Wr||(Wr={}));var iP=4294967295,aP=2147483647,sP=-2147483648,ye=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Ip(t):Rp().encodeUtf8Into,this.buffer=KS,this.viewCache=uP,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||cP;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(Ia),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-Ia,n=Tp(r);return n>Ia&&(this.ensureCapacity(n-Ia),this.buffer.copyWithin(t+n,t+Ia,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(WS(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(_p(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<=YS){this.ensureCapacity(r+1);let u=this.buffer,c=this.pos;u[c++]=r;let g=0;for(;g<r;g++){let y=t.charCodeAt(g);if(y>127)break;u[c++]=y}if(g==r)return this.pos=c,this}this.ensureCapacity(r*3+5);let n=Tp(r),o=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(t,o.subarray(i+n)),s=Tp(a);return s!=n&&o.copyWithin(i+s,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(t){return lP(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 WS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return _p(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return _p(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Qt.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=Qt.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=Qt.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Qt.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=Qt.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let s=0;s<28;s=s+7){let u=t>>>s,c=!(!(u>>>7)&&r==0);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}let i=t>>>28&15|(r&7)<<4,a=r>>3!=0;if(n[o++]=(a?i|128:i)&255,!a)return this.pos=o,this;for(let s=3;s<31;s=s+7){let u=r>>>s,c=!!(u>>>7);if(n[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},cP=128,Ia=1,KS=new Uint8Array(0),uP=new DataView(KS.buffer),YS=32;function Tp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var Z=class{constructor(t,r=Rp().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=BS,this.uint32=QS,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 Wr.Varint:for(;this.buf[this.pos++]&128;);break;case Wr.Bit64:this.pos+=4;case Wr.Bit32:this.pos+=4;break;case Wr.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Wr.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[a,s]=this.tag();if(s===Wr.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(s,a,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return this.varint64(),Qt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Qt.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,Qt.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 Qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Qt.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.uint32(),n=this.pos;this.pos+=r,this.assertBounds();let o=this.buf;if(r<=YS){let i=new Array(r);for(let a=0;a<r;a++){let s=o[n+a];if(s>127)return this.decodeUtf8(o.subarray(n,this.pos),t);i[a]=s}return String.fromCharCode.apply(String,i)}return this.decodeUtf8(o.subarray(n,this.pos),t)}};function _p(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>aP||e<sP)throw new Error("invalid int32: "+e)}function WS(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>iP||e<0)throw new Error("invalid uint32: "+e)}function lP(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 dP=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function kp(){return{fields:{}}}var dt={encode(e,t=new ye){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Np.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=kp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=Np.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 dt.fromPartial(e??{})},fromPartial(e){let t=kp();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=kp();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function XS(){return{key:"",value:void 0}}var Np={encode(e,t=new ye){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Np.fromPartial(e??{})},fromPartial(e){let t=XS();return t.key=e.key??"",t.value=e.value??void 0,t}};function Op(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ce={encode(e,t=new ye){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&dt.encode(dt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Ta.encode(Ta.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Op();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=dt.unwrap(dt.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Ta.unwrap(Ta.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ce.fromPartial(e??{})},fromPartial(e){let t=Op();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=Op();if(e===null)t.nullValue=dP.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(A.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new A.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Pp(){return{values:[]}}var Ta={encode(e,t=new ye){for(let r of e.values)ce.encode(ce.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Pp();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(ce.unwrap(ce.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ta.fromPartial(e??{})},fromPartial(e){let t=Pp();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Pp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&A.Array.isArray(e.values)?e.values:e}},fP=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 ZS(){return{op:0,path:"",from:void 0,value:void 0}}var Cu={encode(e,t=new ye){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ZS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function JS(){return{id:"",type:"",function:void 0,metadata:void 0}}var xu={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Eu.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&dt.encode(dt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=JS();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=Eu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.metadata=dt.unwrap(dt.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xu.fromPartial(e??{})},fromPartial(e){let t=JS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Eu.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function eb(){return{name:"",arguments:""}}var Eu={encode(e,t=new ye){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=eb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=eb();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function tb(){return{value:"",mimeType:""}}var Ru={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=r.string();continue;case 2:if(i!==18)break;o.mimeType=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=tb();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function rb(){return{value:"",mimeType:void 0}}var Iu={encode(e,t=new ye){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=rb();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 Iu.fromPartial(e??{})},fromPartial(e){let t=rb();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function nb(){return{data:void 0,url:void 0}}var _t={encode(e,t=new ye){return e.data!==void 0&&Ru.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Iu.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Ru.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.url=Iu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _t.fromPartial(e??{})},fromPartial(e){let t=nb();return t.data=e.data!==void 0&&e.data!==null?Ru.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Iu.fromPartial(e.url):void 0,t}};function ob(){return{text:""}}var Tu={encode(e,t=new ye){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ob();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 Tu.fromPartial(e??{})},fromPartial(e){let t=ob();return t.text=e.text??"",t}};function ib(){return{source:void 0,metadata:void 0}}var _u={encode(e,t=new ye){return e.source!==void 0&&_t.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=_t.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _u.fromPartial(e??{})},fromPartial(e){let t=ib();return t.source=e.source!==void 0&&e.source!==null?_t.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function ab(){return{source:void 0,metadata:void 0}}var ku={encode(e,t=new ye){return e.source!==void 0&&_t.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=_t.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ku.fromPartial(e??{})},fromPartial(e){let t=ab();return t.source=e.source!==void 0&&e.source!==null?_t.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function sb(){return{source:void 0,metadata:void 0}}var Ou={encode(e,t=new ye){return e.source!==void 0&&_t.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=sb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=_t.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ou.fromPartial(e??{})},fromPartial(e){let t=sb();return t.source=e.source!==void 0&&e.source!==null?_t.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function cb(){return{source:void 0,metadata:void 0}}var Pu={encode(e,t=new ye){return e.source!==void 0&&_t.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=_t.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pu.fromPartial(e??{})},fromPartial(e){let t=cb();return t.source=e.source!==void 0&&e.source!==null?_t.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function ub(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Nu={encode(e,t=new ye){return e.text!==void 0&&Tu.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&_u.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&ku.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Ou.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Pu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=ub();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Tu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.image=_u.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.audio=ku.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.video=Ou.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.document=Pu.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Nu.fromPartial(e??{})},fromPartial(e){let t=ub();return t.text=e.text!==void 0&&e.text!==null?Tu.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?_u.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?ku.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Ou.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Pu.fromPartial(e.document):void 0,t}};function lb(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Fu={encode(e,t=new ye){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)xu.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)Nu.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&dt.encode(dt.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=lb();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(xu.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(Nu.decode(r,r.uint32()));continue;case 9:if(i!==74)break;o.metadata=dt.unwrap(dt.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 Fu.fromPartial(e??{})},fromPartial(e){let t=lb();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=>xu.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Nu.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function db(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Du={encode(e,t=new ye){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&ce.encode(ce.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ce.encode(ce.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.reason=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue;case 4:if(i!==34)break;o.toolCallId=r.string();continue;case 5:if(i!==42)break;o.responseSchema=ce.unwrap(ce.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=r.string();continue;case 7:if(i!==58)break;o.metadata=ce.unwrap(ce.decode(r,r.uint32()));continue;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 Du.fromPartial(e??{})},fromPartial(e){let t=db();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}},pP=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 fb(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var oe={encode(e,t=new ye){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ce.encode(ce.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&dt.encode(dt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=fb();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=ii(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=ce.unwrap(ce.decode(r,r.uint32()));continue;case 4:if(i!==34)break;o.metadata=dt.unwrap(dt.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return oe.fromPartial(e??{})},fromPartial(e){let t=fb();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 pb(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Mu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Mu.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 mb(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var qu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=mb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 qu.fromPartial(e??{})},fromPartial(e){let t=mb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function gb(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Lu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=gb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Lu.fromPartial(e??{})},fromPartial(e){let t=gb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function hb(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var ju={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=hb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 ju.fromPartial(e??{})},fromPartial(e){let t=hb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 yb(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Uu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=yb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Uu.fromPartial(e??{})},fromPartial(e){let t=yb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function vb(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Vu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=vb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Vu.fromPartial(e??{})},fromPartial(e){let t=vb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function Sb(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Bu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ce.encode(ce.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Sb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=ce.unwrap(ce.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 Bu.fromPartial(e??{})},fromPartial(e){let t=Sb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function bb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Gu={encode(e,t=new ye){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Cu.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=bb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(Cu.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 Gu.fromPartial(e??{})},fromPartial(e){let t=bb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Cu.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function Ab(){return{baseEvent:void 0,messages:[]}}var $u={encode(e,t=new ye){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Fu.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Ab();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(Fu.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return $u.fromPartial(e??{})},fromPartial(e){let t=Ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Fu.fromPartial(r))||[],t}};function wb(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Qu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ce.encode(ce.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=wb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=ce.unwrap(ce.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue;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 Qu.fromPartial(e??{})},fromPartial(e){let t=wb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 Cb(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Hu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ce.encode(ce.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Cb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=ce.unwrap(ce.decode(r,r.uint32()));continue;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 Hu.fromPartial(e??{})},fromPartial(e){let t=Cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function xb(){return{baseEvent:void 0,threadId:"",runId:""}}var zu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=xb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 zu.fromPartial(e??{})},fromPartial(e){let t=xb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function Eb(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Hn={encode(e,t=new ye){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Eb();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=ii(r.int64());continue;case 4:if(i!==32)break;o.outputTokens=ii(r.int64());continue;case 5:if(i!==40)break;o.totalTokens=ii(r.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=ii(r.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=ii(r.int64());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hn.fromPartial(e??{})},fromPartial(e){let t=Eb();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 Rb(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var Wu={encode(e,t=new ye){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&ce.encode(ce.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Du.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)Hn.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Rb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=ce.unwrap(ce.decode(r,r.uint32()));continue;case 5:if(i!==42)break;o.outcome=r.string();continue;case 6:if(i!==50)break;o.interrupts.push(Du.decode(r,r.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Hn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wu.fromPartial(e??{})},fromPartial(e){let t=Rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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=>Du.fromPartial(r))||[],t.usage=e.usage?.map(r=>Hn.fromPartial(r))||[],t}};function Ib(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Ku={encode(e,t=new ye){e.baseEvent!==void 0&&oe.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)Hn.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Ib();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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(Hn.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ku.fromPartial(e??{})},fromPartial(e){let t=Ib();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>Hn.fromPartial(r))||[],t}};function Tb(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Yu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Tb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Yu.fromPartial(e??{})},fromPartial(e){let t=Tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function _b(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Xu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=_b();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Xu.fromPartial(e??{})},fromPartial(e){let t=_b();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function kb(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Zu={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=kb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Zu.fromPartial(e??{})},fromPartial(e){let t=kb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 Ob(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Ju={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Ob();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 Ju.fromPartial(e??{})},fromPartial(e){let t=Ob();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Pb(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var el={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Pb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 el.fromPartial(e??{})},fromPartial(e){let t=Pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 Nb(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var tl={encode(e,t=new ye){e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ce.encode(ce.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Nb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=r.string();continue;case 3:if(i!==26)break;o.result=ce.unwrap(ce.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 tl.fromPartial(e??{})},fromPartial(e){let t=Nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.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 Fb(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var rl={encode(e,t=new ye){return e.baseEvent!==void 0&&oe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Fb();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=oe.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 rl.fromPartial(e??{})},fromPartial(e){let t=Fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?oe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function Db(){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 Mb={encode(e,t=new ye){return e.textMessageStart!==void 0&&Mu.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&qu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Lu.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&ju.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Uu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Vu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Bu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Gu.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&$u.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Qu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Hu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&zu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Wu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ku.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Yu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Xu.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Zu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Ju.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&el.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&tl.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&rl.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof Z?e:new Z(e),n=t===void 0?r.len:r.pos+t,o=Db();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Mu.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=qu.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=Lu.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=ju.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Uu.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Vu.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Bu.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Gu.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=$u.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Qu.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Hu.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=zu.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Wu.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Ku.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Yu.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Xu.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Zu.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Ju.decode(r,r.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=el.decode(r,r.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=tl.decode(r,r.uint32());continue;case 21:if(i!==170)break;o.subagentError=rl.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Mb.fromPartial(e??{})},fromPartial(e){let t=Db();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Mu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?qu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Lu.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?ju.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Uu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Vu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Bu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Gu.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?$u.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Qu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Hu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?zu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Wu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ku.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Yu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Xu.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Zu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Ju.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?el.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?tl.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?rl.fromPartial(e.subagentError):void 0,t}};function ii(e){let t=A.Number(e.toString());if(t>A.Number.MAX_SAFE_INTEGER)throw new A.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<A.Number.MIN_SAFE_INTEGER)throw new A.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var qb=e=>e&&typeof e=="object"?e:void 0;var wu=e=>{let t=qb(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}}}},mP=e=>{let t=qb(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:wu(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:wu(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:wu(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:wu(r.source),metadata:r.metadata}}}};function Lb(e){let t=Mb.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=pP[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===D.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=>mP(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===D.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===D.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===D.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=fP[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]}),jc.parse(r)}var Fp="application/vnd.ag-ui.event+proto";m();d();p();f();m();d();p();f();m();d();p();f();var hP=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Dp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(hP);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},jb=e=>e==="*"||e==="x"||e==="X",Ub=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},yP=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],vP=(e,t)=>{if(jb(e)||jb(t))return 0;let[r,n]=yP(Ub(e),Ub(t));return r>n?1:r<n?-1:0},Mp=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=vP(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ai=(e,t)=>{let r=Dp(e),n=Dp(t),o=r.pop(),i=n.pop(),a=Mp(r,n);return a!==0?a:o&&i?Mp(o.split("."),i.split(".")):o||i?o?-1:1:0};var Te=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function _a(){return Br()}function jp(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&jp(t);return e}var Vb=512*1024;function Bb(e,t,r){let n=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let a=o.pop();if(typeof a=="string"){if(n+=a.length,n>r)return!0}else if(typeof a=="object"&&a){if(i.has(a))continue;if(i.add(a),Array.isArray(a))for(let s=0;s<a.length;s++)o.push(a[s]);else{let s=Object.keys(a);for(let u=0;u<s.length;u++){let c=s[u];if(n+=c.length,n>r)return!0;o.push(a[c])}}}}return!1}function Pe(_x88,_x89,_x90,_x91){return _Pe.apply(this,arguments)}function _Pe(){_Pe=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,a=o&&!!process.env.VITEST_WORKER_ID,s=a&&!Bb(t,r,Vb),u=s?Te(t):t,c=s?Te(r):r,g=!1,y=!1,R;for(let h of e)try{s&&(jp(u),jp(c));let v=yield n(h,u,c);if(v===void 0)continue;let w=!1;if(v.messages!==void 0&&v.messages!==u&&(u=Te(v.messages),g=!0,w=!0),v.state!==void 0&&v.state!==c&&(c=Te(v.state),y=!0,w=!0),s&&w&&Bb(u,c,Vb)&&(s=!1),R=v.stopPropagation,R===!0)break}catch(v){if(a&&v instanceof TypeError){if(i)throw v;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",v)}else i||console.error("Subscriber error:",v);continue}return{...(g?{messages:Object.isFrozen(u)?Te(u):u}:{}),...(y?{state:Object.isFrozen(c)?Te(c):c}:{}),...(R===void 0?{}:{stopPropagation:R})}});return _Pe.apply(this,arguments)}function nl(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 ka(e){if(e instanceof Up)return e;if(e===!0)return new Up(nl(!0))}var Up=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 qp(e){return e.enabled?new Up(e):void 0}function SP(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 kt(e,t){return!e||t.metadata===void 0?!1:(e.metadata=cS(e.metadata,Te(t.metadata)),!0)}var Zb=(e,t,r,n,o)=>{let i=ka(o),a=Te(r.messages),s=Te(e.state),u={},c=y=>{y.messages!==void 0&&(a=y.messages,u.messages=y.messages),y.state!==void 0&&(s=y.state,u.state=y.state)},g=()=>{let y=Te(u);return u={},y.messages!==void 0||y.state!==void 0?Oe(y):ru};return t.pipe(yu(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(y){let R=yield Pe(n,a,s,(h,v,w)=>h.onEvent?.({event:y,agent:r,input:e,messages:v,state:w}));if(c(R),R.stopPropagation===!0?i?.event("APPLY","Event dropped:",y,{type:y.type,reason:"stopPropagation by subscriber"}):i?.event("APPLY","Event applied:",y,{type:y.type,subscribers:n.length}),R.stopPropagation===!0)return g();switch(y.type){case D.TEXT_MESSAGE_START:{let h=yield Pe(n,a,s,(v,w,E)=>v.onTextMessageStartEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,role:w="assistant",name:E,subagentRunId:C}=y,_=a.find(b=>b.id===v);if(_?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${v}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let O=_;if(!O){let b={id:v,role:w,content:"",...(E!==void 0&&{name:E}),...(C!=null&&{subagentRunId:C})};a.push(b),O=b}let F=kt(O,y);(!_||F)&&c({messages:a})}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:v}=y,w=a.find(C=>C.id===h);if(!w)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(w.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 E=yield Pe(n,a,s,(C,_,O)=>C.onTextMessageContentEvent?.({event:y,messages:_,state:O,agent:r,input:e,textMessageBuffer:typeof w.content=="string"?w.content:""}));return c(E),E.stopPropagation!==!0&&(w.content=`${typeof w.content=="string"?w.content:""}${v}`,kt(w,y),c({messages:a})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=y,v=a.find(E=>E.id===h);if(!v)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(v.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 w=yield Pe(n,a,s,(E,C,_)=>E.onTextMessageEndEvent?.({event:y,messages:C,state:_,agent:r,input:e,textMessageBuffer:typeof v.content=="string"?v.content:""}));return c(w),w.stopPropagation!==!0&&kt(v,y)&&c({messages:a}),yield Promise.all(n.map(E=>{E.onNewMessage?.({message:v,messages:a,state:s,agent:r,input:e})})),g()}case D.TOOL_CALL_START:{let h=yield Pe(n,a,s,(v,w,E)=>v.onToolCallStartEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:v,toolCallName:w,parentMessageId:E,subagentRunId:C}=y,_=a.find(T=>T.toolCalls?.some(k=>k.id===v))?.toolCalls?.find(T=>T.id===v);if(_){let T=_.function.name!==w;return T&&(console.warn(`TOOL_CALL_START: tool call '${v}' already exists with name '${_.function.name}' \u2014 updating it to '${w}'`),_.function.name=w),(kt(_,y)||T)&&c({messages:a}),g()}let O=new Set(a.map(T=>T.id)),F=SP(a,E,v);!O.has(F.id)&&C!=null&&F.subagentRunId===void 0&&(F.subagentRunId=C),F.toolCalls??(F.toolCalls=[]);let b={id:v,type:"function",function:{name:w,arguments:""}};F.toolCalls.push(b),kt(b,y),c({messages:a})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:v}=y,w=a.find(_=>_.toolCalls?.some(O=>O.id===h));if(!w)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let E=w.toolCalls?.find(_=>_.id===h);if(!E)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let C=yield Pe(n,a,s,(_,O,F)=>{let b=E.function.arguments,T=E.function.name,k={};try{k=bu(b)}catch{}return _.onToolCallArgsEvent?.({event:y,messages:O,state:F,agent:r,input:e,toolCallBuffer:b,toolCallName:T,partialToolCallArgs:k})});return c(C),C.stopPropagation!==!0&&(E.function.arguments+=v,kt(E,y),c({messages:a})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=y,v=a.find(C=>C.toolCalls?.some(_=>_.id===h));if(!v)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let w=v.toolCalls?.find(C=>C.id===h);if(!w)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let E=yield Pe(n,a,s,(C,_,O)=>{let F=w.function.arguments,b=w.function.name,T={};try{T=JSON.parse(F)}catch{}return C.onToolCallEndEvent?.({event:y,messages:_,state:O,agent:r,input:e,toolCallName:b,toolCallArgs:T})});return c(E),E.stopPropagation!==!0&&kt(w,y)&&c({messages:a}),yield Promise.all(n.map(C=>{C.onNewToolCall?.({toolCall:w,messages:a,state:s,agent:r,input:e})})),g()}case D.TOOL_CALL_RESULT:{let h=yield Pe(n,a,s,(v,w,E)=>v.onToolCallResultEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,toolCallId:w,content:E,role:C,subagentRunId:_}=y,O={id:v,toolCallId:w,role:C||"tool",content:E,...(_!=null&&{subagentRunId:_})};kt(O,y);let F=a.findIndex(b=>b.role==="assistant"&&b.toolCalls?.some(T=>T.id===w));if(F===-1)a.push(O);else{let b=F+1;for(;b<a.length&&a[b].role==="tool";)b++;a.splice(b,0,O)}yield Promise.all(n.map(b=>{b.onNewMessage?.({message:O,messages:a,state:s,agent:r,input:e})})),c({messages:a})}return g()}case D.STATE_SNAPSHOT:{let h=yield Pe(n,a,s,(v,w,E)=>v.onStateSnapshotEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:v}=y;s=v,c({state:s})}return g()}case D.STATE_DELTA:{let h=yield Pe(n,a,s,(v,w,E)=>v.onStateDeltaEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:v}=y;try{s=zc.applyPatch(s,v,!0,!1).newDocument,c({state:s})}catch(w){let E=w instanceof Error?w.message:String(w);console.warn(`Failed to apply state patch:
|
|
37
37
|
Current state: ${JSON.stringify(s,null,2)}
|
|
38
|
-
Patch operations: ${JSON.stringify(
|
|
39
|
-
Error: ${x}`)}}return g()}case F.MESSAGES_SNAPSHOT:{let h=yield Pe(n,a,s,(y,b,x)=>y.onMessagesSnapshotEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,b=y.map(w=>{if(w.subagentRunId!==null)return w;let O={...w};return delete O.subagentRunId,O}),x=new Map(b.map(w=>[w.id,w])),I=b.some(w=>w.role==="activity"),N=b.some(w=>w.role==="reasoning"),_=w=>w.role==="activity"&&!I||w.role==="reasoning"&&!N;a=a.filter(w=>_(w)||x.has(w.id)).map(w=>_(w)?w:x.get(w.id));let P=new Set(a.map(w=>w.id));for(let w of b)P.has(w.id)||a.push(w);c({messages:a})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=a.findIndex(_=>_.id===h.messageId),b=y>=0?a[y]:void 0,x=b?.role==="activity"?b:void 0,I=h.replace??!0,N=yield Pe(n,a,s,(_,P,w)=>_.onActivitySnapshotEvent?.({event:h,messages:P,state:w,agent:r,input:e,activityMessage:x,existingMessage:b}));if(c(N),N.stopPropagation!==!0){let _={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,w;y===-1?(a.push(_),P=_,w=_):x?(I&&(a[y]={...x,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[y].subagentRunId),w=a[y]):I&&(a[y]=_,P=_,w=_),It(w,h),c({messages:a}),P&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:P,messages:a,state:s,agent:r,input:e}))))}return g()}case F.ACTIVITY_DELTA:{let h=v,y=a.findIndex(N=>N.id===h.messageId);if(y===-1)return g();let b=a[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=b,I=yield Pe(n,a,s,(N,_,P)=>N.onActivityDeltaEvent?.({event:h,messages:_,state:P,agent:r,input:e,activityMessage:x}));if(c(I),I.stopPropagation!==!0)try{It(x,h)&&c({messages:a});let N=Te(x.content??{}),_=Fc.applyPatch(N,h.patch??[],!0,!1).newDocument;a[y]={...x,content:Te(_),activityType:h.activityType},c({messages:a})}catch(N){let _=N instanceof Error?N.message:String(N);console.warn(`Failed to apply activity patch for '${h.messageId}': ${_}`)}return g()}case F.RAW:return c(yield Pe(n,a,s,(h,y,b)=>h.onRawEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.CUSTOM:return c(yield Pe(n,a,s,(h,y,b)=>h.onCustomEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.RUN_STARTED:{let h=yield Pe(n,a,s,(y,b,x)=>y.onRunStartedEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let b of y.input.messages){let x=b;if(b.subagentRunId===null){let I={...b};delete I.subagentRunId,x=I}a.find(I=>I.id===x.id)||a.push(x)}c({messages:a})}}return g()}case F.RUN_FINISHED:{let h=v,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield Pe(n,a,s,(x,I,N)=>x.onRunFinishedEvent?.({...y,messages:I,state:N,agent:r,input:e}));return c(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let I={...x};return delete I.subagentRunId,I}):[]),g()}case F.RUN_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onRunErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.STEP_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onStepFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case F.THINKING_START:return g();case F.THINKING_END:return g();case F.THINKING_TEXT_MESSAGE_START:return g();case F.THINKING_TEXT_MESSAGE_CONTENT:return g();case F.THINKING_TEXT_MESSAGE_END:return g();case F.REASONING_START:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningStartEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_MESSAGE_START:{let h=yield Pe(n,a,s,(y,b,x)=>y.onReasoningMessageStartEvent?.({event:v,messages:b,state:x,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:b}=v,x=a.find(_=>_.id===y),I=x;if(!I){let _={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};a.push(_),I=_}let N=It(I,v);(!x||N)&&c({messages:a})}return g()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=a.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningMessageContentEvent?.({event:v,messages:N,state:_,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return c(x),x.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,It(b,v),c({messages:a})),g()}case F.REASONING_MESSAGE_END:{let{messageId:h}=v,y=a.find(x=>x.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let b=yield Pe(n,a,s,(x,I,N)=>x.onReasoningMessageEndEvent?.({event:v,messages:I,state:N,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&It(y,v)&&c({messages:a}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:y,messages:a,state:s,agent:r,input:e})})),g()}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return c(yield Pe(n,a,s,(h,y,b)=>h.onReasoningEndEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=v,x=yield Pe(n,a,s,(I,N,_)=>I.onReasoningEncryptedValueEvent?.({event:v,messages:N,state:_,agent:r,input:e}));if(c(x),x.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let N of a)if(N.role==="assistant"&&N.toolCalls){let _=N.toolCalls.find(P=>P.id===y);if(_){_.encryptedValue=b,I=!0;break}}}else{let N=a.find(_=>_.id===y);N?.role!=="activity"&&N&&(N.encryptedValue=b,I=!0)}I&&(u.messages=a)}return g()}case F.SUBAGENT_STARTED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentStartedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_FINISHED:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentFinishedEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g();case F.SUBAGENT_ERROR:return c(yield Pe(n,a,s,(h,y,b)=>h.onSubagentErrorEvent?.({event:v,messages:y,state:b,agent:r,input:e}))),g()}return v.type,g()});return function(_x93){return _ref20.apply(this,arguments)}}()),of(),n.length>0?sf({}):v=>v)},Ef=e=>t=>{let r=va(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,u=!1,c=!1,g=new Map,v=w=>{let O=g.get(w);return O||(O=new Map,g.set(w,O)),O},R=()=>{for(let w of g.values())if(w.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,x=!1,I=!1,N=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),y.clear(),b=!1,x=!1,s=!1,u=!1,I=!0},_=(w,O)=>{let k=w??[];if(Array.isArray(k))for(let T of k){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new ge(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let D=T.role==="reasoning"?a.reasoning:T.role==="activity"?a.activity:a.message;(O||!D.has(T.id))&&D.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})}},P=(w,O,k,T,D)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new ge(`Cannot send '${w}': subagentRunId '${O}' does not match the ${T} '${D}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(wt(w=>{let O=w.type;if(r?.event("VERIFY","Event:",w,{type:w.type}),u&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&O!==F.RUN_ERROR&&O!==F.RUN_STARTED)return le(()=>new ge(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(c){if(O===F.RUN_STARTED){if(I&&!s&&!u)return le(()=>new ge("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(s||u)&&N()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return le(()=>new ge("First event must be 'RUN_STARTED'"));if(w.subagentRunId===null)return le(()=>new ge(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===F.SUBAGENT_STARTED||O===F.SUBAGENT_FINISHED||O===F.SUBAGENT_ERROR){let k=O===F.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===F.SUBAGENT_FINISHED?["outcome"]:["code"];for(let D of k)if(w[D]===null)return le(()=>new ge(`Cannot send '${O}' with '${D}: null'. The field is optional \u2014 omit it entirely.`));let T=w.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return le(()=>new ge(`Cannot send '${O}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return le(()=>new ge(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(T&&Array.isArray(T.interruptIds)&&T.interruptIds.some(D=>typeof D!="string"))return le(()=>new ge(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let k=w.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let T of k.interrupts)if(T&&T.subagentRunId===null)return le(()=>new ge(`Cannot send 'RUN_FINISHED' with an interrupt (id '${T.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case F.TEXT_MESSAGE_START:{let k=w.messageId;if(n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=a.message.get(k);if(T){let D=P(O,w.subagentRunId,T,"message",k);if(D)return le(()=>D)}return n.add(k),T||a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TEXT_MESSAGE_CONTENT:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):Oe(w)}case F.TEXT_MESSAGE_END:{let k=w.messageId;if(!n.has(k))return le(()=>new ge(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.message.get(k),"message",k);return T?le(()=>T):(n.delete(k),Oe(w))}case F.TOOL_CALL_START:{let k=w.toolCallId;if(o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=w.parentMessageId,D=w.subagentRunId,G;if(T!==void 0){let q=a.message.get(T);if(q){if(D!==void 0&&D!==q.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': subagentRunId '${D}' does not match its parent message '${T}' owner '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));G=q}}let M=a.toolCall.get(k);if(M){let q=P(O,D,M,"tool call",k);if(q)return le(()=>q);if(D===void 0&&G&&G.subagentRunId!==M.subagentRunId)return le(()=>new ge(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${M.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(k),M||a.toolCall.set(k,D===void 0?G??{subagentRunId:void 0}:{subagentRunId:D}),Oe(w)}case F.TOOL_CALL_ARGS:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):Oe(w)}case F.TOOL_CALL_END:{let k=w.toolCallId;if(!o.has(k))return le(()=>new ge(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let T=P(O,w.subagentRunId,a.toolCall.get(k),"tool call",k);return T?le(()=>T):(o.delete(k),Oe(w))}case F.STEP_STARTED:{let k=w.stepName,T=w.subagentRunId;return v(T).has(k)?le(()=>new ge(`Step "${k}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(v(T).set(k,!0),Oe(w))}case F.STEP_FINISHED:{let k=w.stepName,T=w.subagentRunId;if(!v(T).has(k)){let D,G=!1;for(let[M,q]of g)if(M!==T&&q.has(k)){D=M,G=!0;break}return le(G?()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${T===void 0?"the parent agent":`subagent '${T}'`}: that step is open under ${D===void 0?"the parent agent":`subagent '${D}'`}. A step must be finished by whoever started it.`):()=>new ge(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return v(T).delete(k),Oe(w)}case F.ACTIVITY_SNAPSHOT:{let k=w.messageId;return(!a.activity.has(k)||w.replace!==!1)&&a.activity.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.TOOL_CALL_RESULT:{let k=w.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let k=w.messageId,T=a.reasoning.get(k);if(T){let D=P(O,w.subagentRunId,T,"reasoning message",k);if(D)return le(()=>D)}return i.add(k),T||a.reasoning.set(k,{subagentRunId:w.subagentRunId}),Oe(w)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let k=w.messageId,T=P(O,w.subagentRunId,a.reasoning.get(k),"reasoning message",k);return T?le(()=>T):(O===F.REASONING_END&&i.delete(k),Oe(w))}case F.REASONING_ENCRYPTED_VALUE:{let k=w.entityId,T=w.subtype,D=T==="tool-call"?a.toolCall.get(k):T==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),G=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",M=P(O,w.subagentRunId,D,G,k);return M?le(()=>M):Oe(w)}case F.ACTIVITY_DELTA:{let k=w.messageId,T=P(O,w.subagentRunId,a.activity.get(k),"activity",k);return T?le(()=>T):Oe(w)}case F.SUBAGENT_STARTED:{if(typeof w.subagentRunId!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof w.name!="string")return le(()=>new ge("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=w.subagentRunId,T=w.parentSubagentRunId;return h.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(k)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!y.has(T)?le(()=>new ge(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(k,!0),Oe(w))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof w.subagentRunId!="string")return le(()=>new ge(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof w.message!="string")return le(()=>new ge("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=w.subagentRunId;return h.has(k)?(h.delete(k),y.add(k),Oe(w)):le(()=>new ge(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let k=_(w.messages,!0);if(k)return le(()=>k)}return Oe(w);case F.RUN_STARTED:I=!0;{let k=_((w.input??{}).messages,!1);if(k)return le(()=>k)}return Oe(w);case F.RUN_FINISHED:if(R()){let k=[];for(let[D,G]of g)for(let M of G.keys())k.push(D===void 0?M:`${M} (subagent '${D}')`);let T=k.join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return le(()=>new ge(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(w);case F.RUN_ERROR:return u=!0,Oe(w);case F.CUSTOM:return Oe(w);case F.THINKING_TEXT_MESSAGE_START:return b?x?le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case F.THINKING_TEXT_MESSAGE_CONTENT:return x?Oe(w):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case F.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case F.THINKING_START:return b?le(()=>new ge("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Oe(w));case F.THINKING_END:return b?(b=!1,Oe(w)):le(()=>new ge("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(w)}}))},Gn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),HO=e=>nu(()=>jn(e())).pipe(cf(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return jn(t.text()).pipe(wt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,le(()=>s)}))}let r={type:Gn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ve(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:Gn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):le(()=>Error("Failed to getReader() from response"))})),zO=(e,t)=>{let r=va(t),n=new nr,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==Gn.HEADERS&&s.type===Gn.DATA&&s.data){let u=o.decode(s.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)a(g)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let u=s.split(`
|
|
38
|
+
Patch operations: ${JSON.stringify(v,null,2)}
|
|
39
|
+
Error: ${E}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield Pe(n,a,s,(v,w,E)=>v.onMessagesSnapshotEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:v}=y,w=v.map(b=>{if(b.subagentRunId!==null)return b;let T={...b};return delete T.subagentRunId,T}),E=new Map(w.map(b=>[b.id,b])),C=w.some(b=>b.role==="activity"),_=w.some(b=>b.role==="reasoning"),O=b=>b.role==="activity"&&!C||b.role==="reasoning"&&!_;a=a.filter(b=>O(b)||E.has(b.id)).map(b=>O(b)?b:E.get(b.id));let F=new Set(a.map(b=>b.id));for(let b of w)F.has(b.id)||a.push(b);c({messages:a})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=y,v=a.findIndex(O=>O.id===h.messageId),w=v>=0?a[v]:void 0,E=w?.role==="activity"?w:void 0,C=h.replace??!0,_=yield Pe(n,a,s,(O,F,b)=>O.onActivitySnapshotEvent?.({event:h,messages:F,state:b,agent:r,input:e,activityMessage:E,existingMessage:w}));if(c(_),_.stopPropagation!==!0){let O={id:h.messageId,role:"activity",activityType:h.activityType,content:Te(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},F,b;v===-1?(a.push(O),F=O,b=O):E?(C&&(a[v]={...E,activityType:h.activityType,content:Te(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete a[v].subagentRunId),b=a[v]):C&&(a[v]=O,F=O,b=O),kt(b,h),c({messages:a}),F&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:F,messages:a,state:s,agent:r,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=y,v=a.findIndex(_=>_.id===h.messageId);if(v===-1)return g();let w=a[v];if(w.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let E=w,C=yield Pe(n,a,s,(_,O,F)=>_.onActivityDeltaEvent?.({event:h,messages:O,state:F,agent:r,input:e,activityMessage:E}));if(c(C),C.stopPropagation!==!0)try{kt(E,h)&&c({messages:a});let _=Te(E.content??{}),O=zc.applyPatch(_,h.patch??[],!0,!1).newDocument;a[v]={...E,content:Te(O),activityType:h.activityType},c({messages:a})}catch(_){let O=_ instanceof Error?_.message:String(_);console.warn(`Failed to apply activity patch for '${h.messageId}': ${O}`)}return g()}case D.RAW:return c(yield Pe(n,a,s,(h,v,w)=>h.onRawEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.CUSTOM:return c(yield Pe(n,a,s,(h,v,w)=>h.onCustomEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=yield Pe(n,a,s,(v,w,E)=>v.onRunStartedEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let v=y;if(v.input?.messages){for(let w of v.input.messages){let E=w;if(w.subagentRunId===null){let C={...w};delete C.subagentRunId,E=C}a.find(C=>C.id===E.id)||a.push(E)}c({messages:a})}}return g()}case D.RUN_FINISHED:{let h=y,v=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},w=yield Pe(n,a,s,(E,C,_)=>E.onRunFinishedEvent?.({...v,messages:C,state:_,agent:r,input:e}));return c(w),w.stopPropagation!==!0&&(r.pendingInterrupts=v.outcome==="interrupt"?v.interrupts.map(E=>{if(E.subagentRunId!==null)return E;let C={...E};return delete C.subagentRunId,C}):[]),g()}case D.RUN_ERROR:return c(yield Pe(n,a,s,(h,v,w)=>h.onRunErrorEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.STEP_STARTED:return c(yield Pe(n,a,s,(h,v,w)=>h.onStepStartedEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.STEP_FINISHED:return c(yield Pe(n,a,s,(h,v,w)=>h.onStepFinishedEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case D.THINKING_START:return g();case D.THINKING_END:return g();case D.THINKING_TEXT_MESSAGE_START:return g();case D.THINKING_TEXT_MESSAGE_CONTENT:return g();case D.THINKING_TEXT_MESSAGE_END:return g();case D.REASONING_START:return c(yield Pe(n,a,s,(h,v,w)=>h.onReasoningStartEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield Pe(n,a,s,(v,w,E)=>v.onReasoningMessageStartEvent?.({event:y,messages:w,state:E,agent:r,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,subagentRunId:w}=y,E=a.find(O=>O.id===v),C=E;if(!C){let O={id:v,role:"reasoning",content:"",...(w!=null&&{subagentRunId:w})};a.push(O),C=O}let _=kt(C,y);(!E||_)&&c({messages:a})}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:v}=y,w=a.find(C=>C.id===h);if(!w)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let E=yield Pe(n,a,s,(C,_,O)=>C.onReasoningMessageContentEvent?.({event:y,messages:_,state:O,agent:r,input:e,reasoningMessageBuffer:typeof w.content=="string"?w.content:""}));return c(E),E.stopPropagation!==!0&&(w.content=`${typeof w.content=="string"?w.content:""}${v}`,kt(w,y),c({messages:a})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=y,v=a.find(E=>E.id===h);if(!v)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let w=yield Pe(n,a,s,(E,C,_)=>E.onReasoningMessageEndEvent?.({event:y,messages:C,state:_,agent:r,input:e,reasoningMessageBuffer:typeof v.content=="string"?v.content:""}));return c(w),w.stopPropagation!==!0&&kt(v,y)&&c({messages:a}),yield Promise.all(n.map(E=>{E.onNewMessage?.({message:v,messages:a,state:s,agent:r,input:e})})),g()}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return c(yield Pe(n,a,s,(h,v,w)=>h.onReasoningEndEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:v,encryptedValue:w}=y,E=yield Pe(n,a,s,(C,_,O)=>C.onReasoningEncryptedValueEvent?.({event:y,messages:_,state:O,agent:r,input:e}));if(c(E),E.stopPropagation!==!0){let C=!1;if(h==="tool-call"){for(let _ of a)if(_.role==="assistant"&&_.toolCalls){let O=_.toolCalls.find(F=>F.id===v);if(O){O.encryptedValue=w,C=!0;break}}}else{let _=a.find(O=>O.id===v);_?.role!=="activity"&&_&&(_.encryptedValue=w,C=!0)}C&&(u.messages=a)}return g()}case D.SUBAGENT_STARTED:return c(yield Pe(n,a,s,(h,v,w)=>h.onSubagentStartedEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.SUBAGENT_FINISHED:return c(yield Pe(n,a,s,(h,v,w)=>h.onSubagentFinishedEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g();case D.SUBAGENT_ERROR:return c(yield Pe(n,a,s,(h,v,w)=>h.onSubagentErrorEvent?.({event:y,messages:v,state:w,agent:r,input:e}))),g()}return y.type,g()});return function(_x92){return _ref20.apply(this,arguments)}}()),vp(),n.length>0?bp({}):y=>y)},Lp=e=>t=>{let r=ka(e),n=new Set,o=new Set,i=new Set,a={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,u=!1,c=!1,g=new Map,y=b=>{let T=g.get(b);return T||(T=new Map,g.set(b,T)),T},R=()=>{for(let b of g.values())if(b.size>0)return!0;return!1},h=new Map,v=new Set,w=!1,E=!1,C=!1,_=()=>{n.clear(),o.clear(),i.clear(),a.message.clear(),a.toolCall.clear(),a.activity.clear(),a.reasoning.clear(),g.clear(),h.clear(),v.clear(),w=!1,E=!1,s=!1,u=!1,C=!0},O=(b,T)=>{let k=b??[];if(Array.isArray(k))for(let P of k){if(!P||typeof P.id!="string")continue;if(P.subagentRunId===null)return new he(`Cannot send a message (id '${P.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let N=P.role==="reasoning"?a.reasoning:P.role==="activity"?a.activity:a.message;(T||!N.has(P.id))&&N.set(P.id,{subagentRunId:P.subagentRunId});for(let M of P.toolCalls??[])M&&typeof M.id=="string"&&(T||!a.toolCall.has(M.id))&&a.toolCall.set(M.id,{subagentRunId:P.subagentRunId??void 0})}},F=(b,T,k,P,N)=>{if(T!==void 0&&k&&k.subagentRunId!==T)return new he(`Cannot send '${b}': subagentRunId '${T}' does not match the ${P} '${N}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(Rt(b=>{let T=b.type;if(r?.event("VERIFY","Event:",b,{type:b.type}),u&&T!==D.RUN_STARTED)return fe(()=>new he(`Cannot send event type '${T}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&T!==D.RUN_ERROR&&T!==D.RUN_STARTED)return fe(()=>new he(`Cannot send event type '${T}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(c){if(T===D.RUN_STARTED){if(C&&!s&&!u)return fe(()=>new he("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(s||u)&&_()}}else if(c=!0,T!==D.RUN_STARTED&&T!==D.RUN_ERROR)return fe(()=>new he("First event must be 'RUN_STARTED'"));if(b.subagentRunId===null)return fe(()=>new he(`Cannot send '${T}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(T===D.SUBAGENT_STARTED||T===D.SUBAGENT_FINISHED||T===D.SUBAGENT_ERROR){let k=T===D.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:T===D.SUBAGENT_FINISHED?["outcome"]:["code"];for(let N of k)if(b[N]===null)return fe(()=>new he(`Cannot send '${T}' with '${N}: null'. The field is optional \u2014 omit it entirely.`));let P=b.outcome;if(P!=null&&P.type!=="success"&&P.type!=="suspended")return fe(()=>new he(`Cannot send '${T}' with outcome type '${String(P.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(P&&P.interruptIds===null)return fe(()=>new he(`Cannot send '${T}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(P&&Array.isArray(P.interruptIds)&&P.interruptIds.some(N=>typeof N!="string"))return fe(()=>new he(`Cannot send '${T}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(T===D.RUN_FINISHED){let k=b.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let P of k.interrupts)if(P&&P.subagentRunId===null)return fe(()=>new he(`Cannot send 'RUN_FINISHED' with an interrupt (id '${P.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(T){case D.TEXT_MESSAGE_START:{let k=b.messageId;if(n.has(k))return fe(()=>new he(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let P=a.message.get(k);if(P){let N=F(T,b.subagentRunId,P,"message",k);if(N)return fe(()=>N)}return n.add(k),P||a.message.set(k,{subagentRunId:b.subagentRunId}),Oe(b)}case D.TEXT_MESSAGE_CONTENT:{let k=b.messageId;if(!n.has(k))return fe(()=>new he(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let P=F(T,b.subagentRunId,a.message.get(k),"message",k);return P?fe(()=>P):Oe(b)}case D.TEXT_MESSAGE_END:{let k=b.messageId;if(!n.has(k))return fe(()=>new he(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let P=F(T,b.subagentRunId,a.message.get(k),"message",k);return P?fe(()=>P):(n.delete(k),Oe(b))}case D.TOOL_CALL_START:{let k=b.toolCallId;if(o.has(k))return fe(()=>new he(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let P=b.parentMessageId,N=b.subagentRunId,M;if(P!==void 0){let U=a.message.get(P);if(U){if(N!==void 0&&N!==U.subagentRunId)return fe(()=>new he(`Cannot send 'TOOL_CALL_START': subagentRunId '${N}' does not match its parent message '${P}' owner '${U.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));M=U}}let Q=a.toolCall.get(k);if(Q){let U=F(T,N,Q,"tool call",k);if(U)return fe(()=>U);if(N===void 0&&M&&M.subagentRunId!==Q.subagentRunId)return fe(()=>new he(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${Q.subagentRunId??"(the parent agent)"}' but its parent message '${P}' is owned by '${M.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),Q||a.toolCall.set(k,N===void 0?M??{subagentRunId:void 0}:{subagentRunId:N}),Oe(b)}case D.TOOL_CALL_ARGS:{let k=b.toolCallId;if(!o.has(k))return fe(()=>new he(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let P=F(T,b.subagentRunId,a.toolCall.get(k),"tool call",k);return P?fe(()=>P):Oe(b)}case D.TOOL_CALL_END:{let k=b.toolCallId;if(!o.has(k))return fe(()=>new he(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let P=F(T,b.subagentRunId,a.toolCall.get(k),"tool call",k);return P?fe(()=>P):(o.delete(k),Oe(b))}case D.STEP_STARTED:{let k=b.stepName,P=b.subagentRunId;return y(P).has(k)?fe(()=>new he(`Step "${k}" is already active for 'STEP_STARTED'${P===void 0?"":` in subagent '${P}'`}`)):(y(P).set(k,!0),Oe(b))}case D.STEP_FINISHED:{let k=b.stepName,P=b.subagentRunId;if(!y(P).has(k)){let N,M=!1;for(let[Q,U]of g)if(Q!==P&&U.has(k)){N=Q,M=!0;break}return fe(M?()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${P===void 0?"the parent agent":`subagent '${P}'`}: that step is open under ${N===void 0?"the parent agent":`subagent '${N}'`}. A step must be finished by whoever started it.`):()=>new he(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return y(P).delete(k),Oe(b)}case D.ACTIVITY_SNAPSHOT:{let k=b.messageId;return(!a.activity.has(k)||b.replace!==!1)&&a.activity.set(k,{subagentRunId:b.subagentRunId}),Oe(b)}case D.TOOL_CALL_RESULT:{let k=b.messageId;return typeof k=="string"&&a.message.set(k,{subagentRunId:b.subagentRunId}),Oe(b)}case D.REASONING_START:case D.REASONING_MESSAGE_START:{let k=b.messageId,P=a.reasoning.get(k);if(P){let N=F(T,b.subagentRunId,P,"reasoning message",k);if(N)return fe(()=>N)}return i.add(k),P||a.reasoning.set(k,{subagentRunId:b.subagentRunId}),Oe(b)}case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:{let k=b.messageId,P=F(T,b.subagentRunId,a.reasoning.get(k),"reasoning message",k);return P?fe(()=>P):(T===D.REASONING_END&&i.delete(k),Oe(b))}case D.REASONING_ENCRYPTED_VALUE:{let k=b.entityId,P=b.subtype,N=P==="tool-call"?a.toolCall.get(k):P==="message"?a.message.get(k)??a.reasoning.get(k):a.reasoning.get(k),M=P==="tool-call"?"tool call":P==="message"?"message":"reasoning message",Q=F(T,b.subagentRunId,N,M,k);return Q?fe(()=>Q):Oe(b)}case D.ACTIVITY_DELTA:{let k=b.messageId,P=F(T,b.subagentRunId,a.activity.get(k),"activity",k);return P?fe(()=>P):Oe(b)}case D.SUBAGENT_STARTED:{if(typeof b.subagentRunId!="string")return fe(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof b.name!="string")return fe(()=>new he("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=b.subagentRunId,P=b.parentSubagentRunId;return h.has(k)?fe(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):v.has(k)?fe(()=>new he(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):P!==void 0&&!h.has(P)&&!v.has(P)?fe(()=>new he(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${P}' has not been started in this run.`)):(h.set(k,!0),Oe(b))}case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{if(typeof b.subagentRunId!="string")return fe(()=>new he(`Cannot send '${T}' without a 'subagentRunId'.`));if(T===D.SUBAGENT_ERROR&&typeof b.message!="string")return fe(()=>new he("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=b.subagentRunId;return h.has(k)?(h.delete(k),v.add(k),Oe(b)):fe(()=>new he(`Cannot send '${T}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case D.MESSAGES_SNAPSHOT:{let k=O(b.messages,!0);if(k)return fe(()=>k)}return Oe(b);case D.RUN_STARTED:C=!0;{let k=O((b.input??{}).messages,!1);if(k)return fe(()=>k)}return Oe(b);case D.RUN_FINISHED:if(R()){let k=[];for(let[N,M]of g)for(let Q of M.keys())k.push(N===void 0?Q:`${Q} (subagent '${N}')`);let P=k.join(", ");return fe(()=>new he(`Cannot send 'RUN_FINISHED' while steps are still active: ${P}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return fe(()=>new he(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return fe(()=>new he(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return fe(()=>new he(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return s=!0,Oe(b);case D.RUN_ERROR:return u=!0,Oe(b);case D.CUSTOM:return Oe(b);case D.THINKING_TEXT_MESSAGE_START:return w?E?fe(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(E=!0,Oe(b)):fe(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return E?Oe(b):fe(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return E?(E=!1,Oe(b)):fe(()=>new he("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return w?fe(()=>new he("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(w=!0,Oe(b));case D.THINKING_END:return w?(w=!1,Oe(b)):fe(()=>new he("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Oe(b)}}))},zn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),bP=e=>hu(()=>$n(e())).pipe(Ap(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return $n(t.text()).pipe(Rt(i=>{let a=i;if(o.includes("application/json"))try{a=JSON.parse(i)}catch{}let s=Error(`HTTP ${t.status}: ${typeof a=="string"?a:JSON.stringify(a)}`);return s.status=t.status,s.payload=a,fe(()=>s)}))}let r={type:zn.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ge(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:a}=yield n.read();if(i)break;let s={type:zn.DATA,data:a};o.next(s)}o.complete()}catch(i){o.error(i)}})(),()=>{n.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):fe(()=>Error("Failed to getReader() from response"))})),AP=(e,t)=>{let r=ka(t),n=new ir,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:s=>{if(s.type!==zn.HEADERS&&s.type===zn.DATA&&s.data){let u=o.decode(s.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)a(g)}},error:s=>n.error(s),complete:()=>{i&&(i+=o.decode(),a(i)),n.complete()}});function a(s){let u=s.split(`
|
|
40
40
|
`),c=[];for(let g of u)g.startsWith("data:")&&c.push(g.slice(5).replace(/^ /,""));if(c.length>0)try{let g=c.join(`
|
|
41
|
-
`),
|
|
42
|
-
`)},cP=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",u=null,c=null,g=[],v={},R=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(wt(h=>{switch(h.type){case F.TEXT_MESSAGE_START:{let y=h;return[{type:Ue.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:Ue.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=h;return[{type:Ue.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Ue.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let x=!1;if(c){let I=c.find(N=>N.tool==b.function.name);if(I)try{let N=JSON.parse(su(b.function.arguments));I.tool_argument&&I.tool_argument in N?(R({...o,[I.state_key]:N[I.tool_argument]}),x=!0):I.tool_argument||(R({...o,[I.state_key]:N}),x=!0)}catch{}}return[{type:Ue.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(x?[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=h;return[{type:Ue.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=h;return[{type:Ue.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=h;switch(y.name){case"Exit":i=!1;break;case"PredictState":c=y.value;break}return[{type:Ue.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return R(h.snapshot),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=h,b=Fc.applyPatch(o,y.delta,!0,!1);return b?(R(b.newDocument),[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:uP(u)}:{})}),active:!1}];case F.RUN_ERROR:{let y=h;return[{type:Ue.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return g=[],c=null,[{type:Ue.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function uP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=sP(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 lP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,dP=e=>e==="tool"?"toolCallId":"messageId",Jo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Qu=e=>t=>{let r=va(e),n=new Map,o=u=>{let c=n.get(u);if(!c)return[];switch(n.delete(u),c.kind){case"text":{let g={type:F.TEXT_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:F.TOOL_CALL_END,toolCallId:c.fields.toolCallId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:F.REASONING_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(u=>o(u)),a=(u,c)=>{for(let[g,v]of n)if(v.kind===u&&lP(v)===c)return{owner:g}},s=(u,c,g,v,R)=>{if(c!==void 0){let y=a(u,c);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${R} '${c}': chunk subagentRunId '${g}' does not match the open stream's subagent '${y.owner??"(the parent agent)"}'.`);return y.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===u)return;let h=[...n.entries()].filter(([,y])=>y.kind===u);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${v}: it carries neither a ${dP(u)} nor a subagentRunId, but ${h.length} lanes have an open ${R}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(wt(u=>{switch(u.type){case F.TEXT_MESSAGE_START:case F.TEXT_MESSAGE_CONTENT:case F.TEXT_MESSAGE_END:case F.TOOL_CALL_START:case F.TOOL_CALL_ARGS:case F.TOOL_CALL_END:case F.TOOL_CALL_RESULT:case F.STATE_SNAPSHOT:case F.STATE_DELTA:case F.CUSTOM:case F.STEP_STARTED:case F.STEP_FINISHED:case F.THINKING_START:case F.THINKING_END:case F.THINKING_TEXT_MESSAGE_START:case F.THINKING_TEXT_MESSAGE_CONTENT:case F.THINKING_TEXT_MESSAGE_END:case F.REASONING_START:case F.REASONING_MESSAGE_START:case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:return[...o(u.subagentRunId??void 0),u];case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR:case F.MESSAGES_SNAPSHOT:return[...i(),u];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:case F.SUBAGENT_STARTED:return[u];case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{let c=u.subagentRunId;return c==null?[u]:[...o(c),u]}case F.TEXT_MESSAGE_CHUNK:{let c=u,g=s("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),v=n.get(g),R=[],h;if(v?.kind==="text"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,name:c.name,subagentRunId:c.subagentRunId},n.set(g,{kind:"text",fields:h});let y=Jo({type:F.TEXT_MESSAGE_START,messageId:c.messageId,role:c.role||"assistant",...(c.name!==void 0&&{name:c.name}),...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.TOOL_CALL_CHUNK:{let c=u,g=s("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),v=n.get(g),R=[],h;if(v?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===v.fields.toolCallId))h=v.fields;else{if(R.push(...o(g)),c.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(c.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"tool",fields:h});let y=Jo({type:F.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","TOOL_CALL_ARGS",b,{toolCallId:h.toolCallId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}case F.REASONING_MESSAGE_CHUNK:{let c=u,g=s("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),v=n.get(g),R=[],h;if(v?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let y=Jo({type:F.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(y),r?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Jo({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);R.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;R.push({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return R}}return u.type,[]}),Un(()=>{i()}))};function pP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Sa=class{runNext(e,t){return t.run(e).pipe(Qu(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new Gc;return Fb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ou(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Te(r),state:Te(n)}});return function(_x94){return _ref22.apply(this,arguments)}}()))}},fP=class extends Sa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function mP(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 gP=class extends Sa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(mP)};return this.runNext(o,t)}},Eb="THINKING_START",Rb="THINKING_END",Ib="THINKING_TEXT_MESSAGE_START",Tb="THINKING_TEXT_MESSAGE_CONTENT",_b="THINKING_TEXT_MESSAGE_END",hP=class extends Sa{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($r(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Eb:{this.currentReasoningId=ya();let{title:t,...r}=e;return this.warnAboutTransformation(Eb,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case Ib:return this.currentMessageId=ya(),this.warnAboutTransformation(Ib,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Tb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Tb,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ya(),delta:t}}case _b:{let t=this.currentMessageId??ya();return this.warnAboutTransformation(_b,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Rb:{let t=this.currentReasoningId??ya();return this.warnAboutTransformation(Rb,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function yP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function vP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function SP(e){let t=yP(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 bP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>vP(n)?SP(n):n);return{...e,content:r}}var AP=class extends Sa{run(e,t){let r={...e,messages:e.messages.map(bP)};return this.runNext(r,t)}},kb="SUBAGENT_STARTED",Ob="SUBAGENT_FINISHED",Pb="SUBAGENT_ERROR";function Hu(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Nb(e){return e.map(t=>Hu(t))}var wP=class extends Sa{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=>Hu(n))};return this.runNext(r,t).pipe(au(n=>{let o=n.type;(o===kb||o===Ob||o===Pb)&&this.warnDroppedLifecycleEvent(o)}),af(n=>{let o=n.type;return o!==kb&&o!==Ob&&o!==Pb}),$r(n=>{let o=Hu(n);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Nb(i.messages)}}if(o.type===F.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>Hu(a))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Nb(i.input.messages)}}}return o}))}},xP="0.0.59",CP=class{get maxVersion(){return xP}get debug(){return this._debug}set debug(e){this._debug=$u(e),this._debugLogger=Cf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Cf($u(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??jr(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=$u(i),this._debugLogger=Cf(this._debug),Zo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new gP),Zo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new hP),Zo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new AP),Zo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new wP)}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 fP(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??jr();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new nr;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this14).run(r),Qu(_this14.debugLogger),Ef(_this14.debugLogger),u=>u.pipe(iu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),ma(u=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:u instanceof Error?u.message:String(u)}),_this14.isRunning=!1,_this14.onError(r,u,i))),Un(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Oe(null)));let s=Te(_this14.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Qp}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??jr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new nr;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield ru(Vc(()=>nu(()=>_this15.connect(r)),Qu(_this15.debugLogger),Ef(_this15.debugLogger),u=>u.pipe(iu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),ma(u=>(_this15.isRunning=!1,u instanceof Qp?Bc:_this15.onError(r,u,i))),Un(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Oe(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Fb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(au(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Te(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||jr(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Te(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new ge(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(pP(i))throw new ge(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Pe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this17.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})}r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})}))}})()}onError(e,t,r){return jn(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe($r(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Pe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Te(this.messages),e.state=Te(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Te(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Te(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Te(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??jr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(Qu(this.debugLogger),Ef(this.debugLogger),cP(this.threadId,t.runId,this.agentId),r=>r.pipe($r(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function EP(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 Db=class extends CP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(EP(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Te(e.headers??{}),this.fetch=e.fetch??((t,r)=>C(t,r))}run(e){return KO(HO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Mb=(e,t,r)=>{let n=kt(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 Tf=class extends Db{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}}},Lb=(e,t,r)=>new Tf({url:`${Mb(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var RP=new H({required:!0}),qb=new H({required:!0,constrainTo:lc}),jb=e=>({...e,name:dc(e.name)}),Ub=L("followUpAnswers/setIsEnabled",e=>V(e,new fe({required:!0}))),Vb=L("followUpAnswers/setFollowUpAnswersConversationId",e=>V(e,Y)),Gb=L("followUpAnswers/setFollowUpAnswersConversationToken",e=>V(e,Y)),Bb=L("followUpAnswers/clearFollowUpAnswersConversationToken"),fne=L("followUpAnswers/createFollowUpAnswer",e=>V(e,{question:Y})),mne=L("followUpAnswers/setActiveFollowUpAnswerId",e=>V(e,Y)),gne=L("followUpAnswers/setFollowUpAnswerContentFormat",e=>V(e,{contentFormat:fc,answerId:Y})),hne=L("followUpAnswers/setFollowUpIsLoading",e=>V(e,{isLoading:new fe({required:!0}),answerId:Y})),yne=L("followUpAnswers/setFollowUpIsStreaming",e=>V(e,{isStreaming:new fe({required:!0}),answerId:Y})),vne=L("followUpAnswers/followUpMessageChunkReceived",e=>V(e,{textDelta:RP,answerId:Y})),Sne=L("followUpAnswers/followUpCitationsReceived",e=>V(e,{citations:new Ae({required:!0,each:new re({values:Op})}),answerId:Y})),bne=L("followUpAnswers/followUpCompleted",e=>V(e,{answerId:Y,cannotAnswer:new fe({required:!1})})),Ane=L("followUpAnswers/followUpFailed",e=>V(e,{message:new H,code:new ne({min:0}),answerId:Y})),wne=L("followUpAnswers/activeFollowUpStartFailed",e=>V(e,{message:new H})),xne=L("followUpAnswers/likeFollowUp",e=>V(e,{answerId:Y})),Cne=L("followUpAnswers/dislikeFollowUp",e=>V(e,{answerId:Y})),Ene=L("followUpAnswers/submitFollowUpFeedback",e=>V(e,{answerId:Y})),$b=L("followUpAnswers/resetFollowUpAnswers"),Rne=L("followUpAnswers/stepStarted",e=>V(jb(e),{answerId:Y,name:qb,startedAt:new ne({min:0,required:!0})})),Ine=L("followUpAnswers/stepFinished",e=>V(jb(e),{answerId:Y,name:qb,finishedAt:new ne({min:0,required:!0})})),Tne=L("followUpAnswers/startToolCall",e=>V(e,{answerId:Y,toolCallName:Y,startedAt:new ne({min:0,required:!0}),toolCallId:Y})),_ne=L("followUpAnswers/finishToolCall",e=>V(e,{answerId:Y,finishedAt:new ne({min:0,required:!0}),toolCallId:Y})),kne=L("followUpAnswers/toolCallArgs",e=>V(e,{answerId:Y,toolCallId:Y,args:new re({options:{required:!0}}),type:new H({required:!0,constrainTo:pc})}));m();d();f();p();var IP={"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 Qb(e){return e?IP[e]??1004:1004}var Hb=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(mc(n.runId)),e(qr(!1)),e(Ji(!0)),e(Vb(n.threadId)),e(Bb())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(sv({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(cv({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(uv({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(lv({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(hc({toolCallId:i,args:s,type:"search"})):e(hc({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(hc({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(ea({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(na(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(Ub(a.followUpEnabled)),a?.conversationToken&&e(Gb(a.conversationToken));return}case"citations":{e(ta({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=Qb(n.code);e(ra({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(Pp(i)),e(oa(!i)),e(Ji(!1)),e(pp(i,t,a)),e(_o())}}};var zb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _run=_asyncToGenerator(function*(n,o,i){t();let a=Bs(n),s=hh(n),u=yh(n),c=gh(n),g=vh(n),v=Lb(a,s,u);e=v;let R=Hb(o),h=ev(n,i());try{o(qr(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(y){o(qr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});function run(_x95,_x96,_x97){return _run.apply(this,arguments)}return run}(),abortRun:t}};m();d();f();p();m();d();f();p();var zu=L("breadcrumb/deselectAll"),Wb=L("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Kb=L("facet/updateFacetAutoSelection",e=>V(e,{allow:new fe({required:!0})}));m();d();f();p();m();d();f();p();var Wu=class extends Or{constructor(r){super(r);ue(this,"getState",r)}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??Et().q}get responseTime(){return this.activeInstantResultCache?.duration??Ht().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Ht().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Yb=()=>De("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Wu(e)),Xb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var _f={id:Y},TP={..._f,q:nt},Uoe=L("instantResults/register",e=>V(e,_f)),Ku=L("instantResults/updateQuery",e=>V(e,TP)),Voe=L("instantResults/clearExpired",e=>V(e,_f));m();d();f();p();var Yu=new ne({required:!0,min:0}),Xu=L("pagination/registerNumberOfResults",e=>V(e,Yu)),Zu=L("pagination/updateNumberOfResults",e=>V(e,Yu)),Ju=L("pagination/registerPage",e=>V(e,Yu)),ei=L("pagination/updatePage",e=>V(e,Yu)),el=L("pagination/nextPage"),tl=L("pagination/previousPage");m();d();f();p();var ti=L("query/updateQuery",e=>V(e,{q:new H,enableQuerySyntax:new fe}));m();d();f();p();m();d();f();p();m();d();f();p();var Hr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var kf=()=>De("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),zr=e=>De("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Et().q,aq:r.advancedSearchQueries?.aq||Hr().aq,cq:r.advancedSearchQueries?.cq||Hr().cq,dq:r.advancedSearchQueries?.dq||Hr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var Eie=L("didYouMean/enable"),Rie=L("didYouMean/disable"),Iie=L("didYouMean/automaticCorrections/disable"),Tie=L("didYouMean/automaticCorrections/enable"),rl=L("didYouMean/correction",e=>V(e,Y)),_ie=L("didYouMean/automaticCorrections/mode",e=>V(e,new H({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var Of=()=>De("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Zb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function nl(){return{contextValues:{}}}m();d();f();p();function ol(){return{contextValues:{}}}m();d();f();p();function Jb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function eA(){return[]}m();d();f();p();function ba(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function tA(){return{}}m();d();f();p();function rA(){return{}}m();d();f();p();function nA(){return{}}function or(e){return{context:e.context||nl(),dictionaryFieldContext:e.dictionaryFieldContext||ol(),facetSet:e.facetSet||Gs(),numericFacetSet:e.numericFacetSet||Vs(),dateFacetSet:e.dateFacetSet||Us(),categoryFacetSet:e.categoryFacetSet||js(),automaticFacetSet:e.automaticFacetSet??qs(),pagination:e.pagination||ba(),query:e.query||Et(),tabSet:e.tabSet||nA(),advancedSearchQueries:e.advancedSearchQueries||Hr(),staticFilterSet:e.staticFilterSet||rA(),querySet:e.querySet||tA(),sortCriteria:e.sortCriteria||$s(),pipeline:e.pipeline||Tr(),searchHub:e.searchHub||Ao(),facetOptions:e.facetOptions||Jb(),facetOrder:e.facetOrder??eA(),debug:e.debug??ys()}}m();d();f();p();var tse=new re({values:{undoneQuery:nt},options:{required:!0}}),oA=()=>De("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var il=L("trigger/query/ignore",e=>V(e,new H({emptyAllowed:!0,required:!0}))),al=L("trigger/query/modification",e=>V(e,new re({values:{originalQuery:rt,modification:rt}})));m();d();f();p();var Wr=/*#__PURE__*/function(){var _Wr=_asyncToGenerator(function*(e,t){let r=OP(e),n=cc(e),o=_P(e),i=yield Mr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Fr({...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}}})})});function Wr(_x98,_x99){return _Wr.apply(this,arguments)}return Wr}();function _P(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(kP).filter(r=>r.currentValues.length>0):void 0}function kP(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function OP(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=PP(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function PP(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 Kr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Yt(or(_this25.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this26.dispatch(zr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Yt(or(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Of()})})()}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:Of()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(il("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this27.dispatch(zr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Yt(or(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:oA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Et().enableQuerySyntax},search:{...Ht(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Wr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(rl(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(al({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Wr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var tce=ke("search/executeSearch",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sl(r,t,e)});return function(_x102,_x103){return _ref27.apply(this,arguments)}}()),rce=ke("search/fetchPage",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Nf(r,t,e)});return function(_x104,_x105){return _ref28.apply(this,arguments)}}()),nce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ff(t,r)});return function(_x106,_x107){return _ref29.apply(this,arguments)}}()),oce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield MP(t,e,r)});return function(_x108,_x109){return _ref30.apply(this,arguments)}}()),ice=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){return Pf(e,t)});return function(_x110,_x111){return _ref31.apply(this,arguments)}}()),NP=/*#__PURE__*/function(){var _NP=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});function NP(_x112,_x113){return _NP.apply(this,arguments)}return NP}(),FP=/*#__PURE__*/function(){var _FP=_asyncToGenerator(function*(e,t,r){let n=yield Mr(e);return Fr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});function FP(_x114,_x115,_x116){return _FP.apply(this,arguments)}return FP}(),DP=/*#__PURE__*/function(){var _DP=_asyncToGenerator(function*(e,t){let r=yield Wr(e,t);return r.request.numberOfResults=0,r});function DP(_x117,_x118){return _DP.apply(this,arguments)}return DP}(),iA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Pf(_x119,_x120){return _Pf.apply(this,arguments)}function _Pf(){_Pf=_asyncToGenerator(function*(e,t){V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Kr({...t,analyticsAction:Yb()},c=>{t.dispatch(Ku({q:c,id:e.id}))}),a=yield FP(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(s);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Pf.apply(this,arguments)}function Nf(_x121,_x122,_x123){return _Nf.apply(this,arguments)}function _Nf(){_Nf=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...t,analyticsAction:r}),u=yield Wr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Nf.apply(this,arguments)}function Ff(_x124,_x125){return _Ff.apply(this,arguments)}function _Ff(){_Ff=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield kf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Kr({...e,analyticsAction:kf()}),s=yield NP(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _Ff.apply(this,arguments)}function MP(_x126,_x127,_x128){return _MP.apply(this,arguments)}function _MP(){_MP=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Kr({...e,analyticsAction:t}),u=yield DP(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _MP.apply(this,arguments)}function sl(_x129,_x130,_x131){return _sl.apply(this,arguments)}function _sl(){_sl=_asyncToGenerator(function*(e,t,r){iA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Wr(e,a),u=new Kr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _sl.apply(this,arguments)}m();d();f();p();var Yr=class{constructor(t,r=n=>{this.dispatch(ti({q:n}))}){ue(this,"config",t);ue(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x132,_x133){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=sc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(zr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o)return null;if(!i)return!ce(u)&&!ce(u.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let c=a.length===0&&s&&s.length!==0,g=!ce(u)&&!ce(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Yt(or(_this32.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this33.dispatch(zr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Yt(or(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(il("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return vt(a.response)?(_this34.dispatch(zr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Yt(or(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Yt(or(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return ja(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Zb(),o=yield _this35.fetchFromAPI(yield Lr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(rl(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(al({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Lr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Qce=ke("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;V(e,{q:new H,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(zu()),r(Wb())),r(Kb({allow:!0})),r(ti({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ei(1))}),Hce=L("search/updateSearchAction"),cl=ke("search/executeSearch",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);sA(r);let n=e.next?cA(e.next):void 0,o=yield Lr(r,t.extra.navigatorContext,n),i=new Yr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x134,_x135){return _ref32.apply(this,arguments)}}()),aA=ke("search/fetchPage",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(sA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Nf(r,t,e.legacy);let n=new Yr({...t,analyticsAction:e.next}),o=yield Lr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x136,_x137){return _ref33.apply(this,arguments)}}()),zce=ke("search/fetchMoreResults",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ff(t,r);let n=qh("browseResults",t.getState),o=new Yr({...t,analyticsAction:n}),i=yield LP(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x138,_x139){return _ref34.apply(this,arguments)}}()),Wce=ke("search/fetchFacetValues",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return sl(r,t,e.legacy);let n=new Yr({...t,analyticsAction:{}}),o=yield jP(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x140,_x141){return _ref35.apply(this,arguments)}}()),Kce=ke("search/fetchInstantResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Pf(e,t);V(e,{id:Y,q:Y,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=cA(Xb()),a=yield qP(r,t.extra.navigatorContext,n,o,i),s=new Yr({...t,analyticsAction:i},g=>{t.dispatch(Ku({q:g,id:e.id}))}),u=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x142,_x143){return _ref36.apply(this,arguments)}}()),LP=/*#__PURE__*/function(){var _LP=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});function LP(_x144,_x145,_x146){return _LP.apply(this,arguments)}return LP}(),qP=/*#__PURE__*/function(){var _qP=_asyncToGenerator(function*(e,t,r,n,o){let i=Oo(e,t,o);return Fr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});function qP(_x147,_x148,_x149,_x150,_x151){return _qP.apply(this,arguments)}return qP}(),jP=/*#__PURE__*/function(){var _jP=_asyncToGenerator(function*(e,t,r){let n=yield Lr(e,t,r);return n.request.numberOfResults=0,n});function jP(_x152,_x153,_x154){return _jP.apply(this,arguments)}return jP}(),sA=e=>{e.configuration.analytics.enabled&&ht.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},cA=e=>({actionCause:e.actionCause,type:e.actionCause});var uA=e=>{let t=Tg({extra:e}),r=zb();return t.startListening({actionCreator:cl.pending,effect:function(){var _effect=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Ud(i)||(r.abortRun(),o.dispatch(gc()),o.dispatch($b()),i.generatedAnswer.isEnabled===!1))return;let a=yn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});function effect(_x155,_x156){return _effect.apply(this,arguments)}return effect}()}),t};m();d();f();p();var lA=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)},dA=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var Df=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function pA(e,t){let r={...e},n,o=i=>(a,s)=>{let u=i(a,s);return n?n(u,s):u};return{get combinedReducer(){let i=vm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(rn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function UP(e){if(!e||!VP(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 fA(e,t=60){if(!e)return!1;let r=UP(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function VP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function gA(e,t){let r=0,n=null,o=Pa(()=>{r=0},500),i=/*#__PURE__*/function(){var _i2=_asyncToGenerator(function*(v,R=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!R)throw b;return null}})().finally(()=>{n=null}));let y=yield n;return h&&y&&v.dispatch(Rr({accessToken:y})),y});function i(_x157){return _i2.apply(this,arguments)}return i}(),a=v=>{let R=$P(v.getState());return!!R&&fA(R)},s=/*#__PURE__*/function(){var _s3=_asyncToGenerator(function*(v){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(v))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(R){e.warn(R,"Access token renewal failed. A retry will occur if necessary.")}});function s(_x158){return _s3.apply(this,arguments)}return s}(),u=/*#__PURE__*/function(){var _u2=_asyncToGenerator(function*(v,R,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),mA(v,R.error),R;!n&&(r++,o());try{yield i(v,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}v.dispatch(h)});function u(_x159,_x160,_x161){return _u2.apply(this,arguments)}return u}(),c=(v,R,h)=>BP(h)?t?u(v,h,R):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),mA(v,h.error),h):h,g=(v,R,h)=>GP(h)?Promise.resolve(h).then(y=>c(v,R,y)):c(v,R,h);return v=>R=>h=>{if(!(typeof h=="function"))return R(h);let b=()=>g(v,h,R(h));return typeof t=="function"&&a(v)?s(v).then(b):b()}}function GP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Zn().name}function mA(e,t){e.dispatch(Ss({status:401,statusCode:401,message:t.message,type:t.name}))}function $P(e){return e.configuration.accessToken}m();d();f();p();function hA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return mg({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(dA(n.logger))})}function QP(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",u=a.analyticsMode==="legacy"&&o===!0;return s&&Dl()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&Dl()&&u&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function yA(e,t){let r={...e.reducers,configuration:Vt,version:bv},n=HP({...e,reducers:r},t,Vt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(Rr({accessToken:o,environment:i,organizationId:a}));let s=QP(e.configuration,n.logger);return s&&n.dispatch(co(s)),n}function HP(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=pA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Gi(c.state,o)},get navigatorContext(){return Df(this.relay,o)}},u=zP(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(lo())},disableAnalytics(){u.dispatch(uo())},get state(){return u.getState()},get relay(){return Gi(this.state,o)},get navigatorContext(){return Df(this.relay,o)},logger:a,store:u};return c}function zP(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=WP(e,t.logger,()=>t.navigatorContext);return hA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function WP(e,t,r){let{renewAccessToken:n}=e.configuration,o=gA(t,n),i=uA({getNavigatorContext:r});return[Ov,o,lA(t),wv].concat(Fp.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var IA=jt(RA(),1);function TA(e){return(0,IA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function _A(e,t){let r=pN(e),n=Ot,o=fN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function pN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function fN(e){return e.preprocessRequest||Da}m();d();f();p();m();d();f();p();var kA={organizationId:Y,accessToken:Y,name:new H({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new H({required:!1}),originLevel2:new H({required:!1}),originLevel3:new H({required:!1}),analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new H({required:!1,url:!0}),trackingId:new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new fe({required:!1})}}),environment:new H({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function OA(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var PA=new yt({...kA,pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:rt,locale:rt,timezone:rt});function Vf(){return{...OA(),searchHub:"default"}}var mN={debug:vs,pipeline:fo,searchHub:Ro,recommendation:Co};function NA(e){let t=TA(e.loggerOptions);gN(e.configuration,t);let r=hN(e.configuration,t),n={..._A(e.configuration,t),apiClient:r},o={...e,reducers:mN},i=yA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Kt({timezone:u,locale:c,proxyBaseUrl:g})),ce(a)||i.dispatch(po(a)),ce(s)||i.dispatch(Eo(s)),{...i,get state(){return i.state}}}function gN(e,t){try{PA.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function hN(e,t){return new qa({logger:t,preprocessRequest:e.preprocessRequest||Da,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Dm,postprocessFacetSearchResponseMiddleware:Mm,postprocessQuerySuggestResponseMiddleware:Lm})}m();d();f();p();m();d();f();p();m();d();f();p();var yN=new Ae({each:Y,required:!0}),FA=(e,t)=>(V(e,Y),ka(t)?V(t,Y):V(t,yN),{payload:{contextKey:e,contextValue:t}}),$n=L("context/set",e=>{for(let[t,r]of Object.entries(e))FA(t,r);return{payload:e}}),Qn=L("context/add",e=>FA(e.contextKey,e.contextValue)),Hn=L("context/remove",e=>V(e,Y));m();d();f();p();var dl=Be(nl(),e=>{e.addCase($n,(t,r)=>{t.contextValues=r.payload}).addCase(Qn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Hn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Zr(e){let t,r=new Map,n=()=>r.size===0,o,i=a=>{try{let s=JSON.stringify(a),u=t!==s;return t=s,u}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(a){a();let s=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&r.forEach(u=>u())})),r.set(s,a),()=>{r.delete(s),n()&&(o?.(),o=void 0)}},get state(){return{}}}}m();d();f();p();var vN=["caseId","caseNumber"],SN={caseId:"caseContext",caseNumber:"caseContext"},wa=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${SN[t]} to set this value.}`)}};function Gf(e){return vN.includes(e)}var bN=new yt({values:new re({options:{required:!1}})});function DA(e,t={}){if(!xN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Og(e,bN,t.initialState,"buildContext");return i.values&&n($n(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n($n(a))},...(o().configuration.analytics.analyticsMode==="legacy"?AN(n):wN(n))}}var AN=e=>({add(t,r){e(Qn({contextKey:t,contextValue:r}))},remove(t){e(Hn(t))}}),wN=e=>({add(t,r){if(Gf(t))throw new wa(t);e(Qn({contextKey:t,contextValue:r}))},remove(t){if(Gf(t))throw new wa(t);e(Hn(t))}});function xN(e){return e.addReducers({context:dl}),!0}function MA(e,t){return DA(e,t)}m();d();f();p();m();d();f();p();var ni=L("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=V(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new Ae({each:nt}),i=V(n,o).error;return i?{payload:e,error:i}:{payload:e}}),oi=L("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:nt,key:nt}});return V(e,t)}),ii=L("dictionaryFieldContext/remove",e=>V(e,nt));m();d();f();p();var pl=Be(ol(),e=>{e.addCase(ni,(t,r)=>{t.contextValues=r.payload}).addCase(oi,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(ii,(t,r)=>{delete t.contextValues[r.payload]}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function LA(e){if(!CN(e))throw Qt;let t=Zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(ni(o))},add(o,i){r(oi({field:o,key:i}))},remove(o){r(ii(o))}}}function CN(e){return e.addReducers({dictionaryFieldContext:pl}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var xa={value:Y,numberOfResults:new ne({min:0}),state:Y};m();d();f();p();var Ne=Y;var TN=new ne({min:1,default:8,required:!1}),_N=new ne({min:1,max:20,default:5,required:!1}),kN={desiredCount:_N,numberOfValues:TN},rfe=L("automaticFacet/setOptions",e=>V(e,kN)),nfe=L("automaticFacet/deselectAll",e=>V(e,Ne)),ON=Y,qA=L("automaticFacet/toggleSelectValue",e=>V(e,{field:ON,selection:new re({values:xa})}));m();d();f();p();m();d();f();p();var PN={state:new qe({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new H({required:!0,emptyAllowed:!0}),path:new Ae({required:!0,each:Y}),moreValuesAvailable:new fe({required:!1})};function Bf(e){e.children.forEach(t=>{Bf(t)}),Ot({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},PN)}var ai={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),delimitingCharacter:new H({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),basePath:new Ae({required:!1,each:Y}),filterByBasePath:new fe({required:!1})};var Afe=L("categoryFacet/register",e=>V(e,ai)),jA=L("categoryFacet/toggleSelectValue",e=>{try{return Ot(e.facetId,Y),Bf(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),UA=L("categoryFacet/deselectAll",e=>V(e,ai.facetId)),wfe=L("categoryFacet/updateNumberOfValues",e=>V(e,{facetId:ai.facetId,numberOfValues:ai.numberOfValues})),xfe=L("categoryFacet/updateSortCriterion",e=>V(e,{facetId:ai.facetId,criterion:new qe})),Cfe=L("categoryFacet/updateBasePath",e=>V(e,{facetId:ai.facetId,basePath:new Ae({each:Y})}));m();d();f();p();m();d();f();p();var Ca={facetId:Ne,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new H({required:!1,emptyAllowed:!0})};var NN={path:new Ae({required:!0,each:Y}),displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})},VA=L("categoryFacet/selectSearchResult",e=>V(e,{facetId:Ne,value:new re({values:NN})})),Gfe=L("categoryFacetSearch/register",e=>V(e,Ca));m();d();f();p();var GA={facetId:Ne,value:new re({values:{displayValue:nt,rawValue:nt,count:new ne({required:!0,min:0})}})},Jfe=L("facetSearch/register",e=>V(e,Ca)),eme=L("facetSearch/update",e=>V(e,Ca)),BA=L("facetSearch/toggleSelectValue",e=>V(e,GA)),$A=L("facetSearch/toggleExcludeValue",e=>V(e,GA));m();d();f();p();m();d();f();p();var sme=new H({regex:/^[a-zA-Z0-9-_]+$/}),cme=new H({required:!0}),ume=new Ae({each:new H}),lme=new H,dme=new fe,pme=new fe,fme=new ne({min:0}),FN=new ne({min:1}),mme=new fe({required:!0}),DN=new re,MN=new H,LN={captions:DN,numberOfValues:FN,query:MN},gme=new re({values:LN}),QA=new re({options:{required:!1},values:{type:new H({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new Ae({required:!0,max:25,each:new H({emptyAllowed:!1,required:!0})})}}),hme=new fe,HA=new Ae({min:1,max:25,required:!1,each:new H({emptyAllowed:!1,required:!0})});var qN={facetId:Ne,field:new H({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),resultsMustMatch:new qe({required:!1}),allowedValues:QA,customSort:HA},Tme=L("facet/register",e=>V(e,qN)),zA=L("facet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),WA=L("facet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:xa})})),fl=L("facet/deselectAll",e=>V(e,Ne)),_me=L("facet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})})),kme=L("facet/updateNumberOfValues",e=>V(e,{facetId:Ne,numberOfValues:new ne({required:!0,min:1})})),Ome=L("facet/updateIsFieldExpanded",e=>V(e,{facetId:Ne,isFieldExpanded:new fe({required:!0})})),Pme=L("facet/updateFreezeCurrentValues",e=>V(e,{facetId:Ne,freezeCurrentValues:new fe({required:!0})}));m();d();f();p();m();d();f();p();function YA(e){let t=KA(e.start,e),r=KA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function KA(e,t){let{dateFormat:r}=t;return Ly(e)?(wp(e),Fy(e)):typeof e=="string"&&Nr(e)?(wp(e),e):(ky(e,r),ac(ko(e,r)))}m();d();f();p();var XA=L("rangeFacet/updateSortCriterion",e=>V(e,{facetId:Ne,criterion:new qe({required:!0})}));m();d();f();p();var ml={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},gl={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y,numberOfResults:new ne({required:!0,min:0})};var jN={start:Y,end:Y,endInclusive:new fe({required:!0}),state:Y},UN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:jN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function ZA(e){return Nr(e)?Xi(e):e}function JA(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=YA(t);if(ko(ZA(r)).isAfter(ko(ZA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var vge=L("dateFacet/register",e=>{try{return Ot(e,UN),JA(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ew=L("dateFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),tw=L("dateFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:gl})})),rw=L("dateFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:gl})})}),JA({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});m();d();f();p();var VN={state:Y,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},GN={facetId:Ne,field:Y,tabs:new re({options:{required:!1},values:{included:new Ae({each:new H}),excluded:new Ae({each:new H})}}),activeTab:new H({required:!1}),currentValues:new Ae({required:!1,each:new re({values:VN})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new qe({required:!1}),rangeAlgorithm:new qe({required:!1})};function nw(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 Oge=L("numericFacet/register",e=>{try{return V(e,GN),nw(e),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}}),ow=L("numericFacet/toggleSelectValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),iw=L("numericFacet/toggleExcludeValue",e=>V(e,{facetId:Ne,selection:new re({values:ml})})),aw=L("numericFacet/updateFacetValues",e=>{try{return Ot(e,{facetId:Ne,values:new Ae({each:new re({values:ml})})}),nw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:dr(t)}}});var sw=Be(ba(),e=>{e.addCase(Xu,(t,r)=>{let n=$f(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Ea(n,o)}).addCase(Zu,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(yc,t=>{t.firstResult=0}).addCase(Ju,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(ei,(t,r)=>{let n=r.payload;t.firstResult=Ea(n,t.numberOfResults)}).addCase(tl,t=>{let r=$f(t),n=Math.max(r-1,1);t.firstResult=Ea(n,t.numberOfResults)}).addCase(el,t=>{let r=$f(t),n=$N(t),o=Math.min(r+1,n);t.firstResult=Ea(o,t.numberOfResults)}).addCase(St.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Ir,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(cl.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(aA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(fl,t=>{mt(t)}).addCase(tw,t=>{mt(t)}).addCase(WA,t=>{mt(t)}).addCase(iw,t=>{mt(t)}).addCase($A,t=>{mt(t)}).addCase(zA,t=>{mt(t)}).addCase(UA,t=>{mt(t)}).addCase(jA,t=>{mt(t)}).addCase(VA,t=>{mt(t)}).addCase(ew,t=>{mt(t)}).addCase(ow,t=>{mt(t)}).addCase(zu,t=>{mt(t)}).addCase(rw,t=>{mt(t)}).addCase(aw,t=>{mt(t)}).addCase(BA,t=>{mt(t)}).addCase(qA,t=>{mt(t)})});function mt(e){e.firstResult=ba().firstResult}function $f(e){let{firstResult:t,numberOfResults:r}=e;return QN(t,r)}function $N(e){let{totalCountFiltered:t,numberOfResults:r}=e;return HN(t,r)}function Ea(e,t){return(e-1)*t}function QN(e,t){return Math.round(e/t)+1}function HN(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Qf(e){return e.addReducers({pagination:sw}),{nextPage:el,previousPage:tl,registerNumberOfResults:Xu,registerPage:Ju,updateNumberOfResults:Zu,updatePage:ei}}var zN=new yt({id:new H({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function cw(e,t={}){if(!WN(e))throw Qt;let r=Zr(e),{dispatch:n}=e,o=()=>e.state,i=Pg(e,zN,t.options,"buildRecommendationList");return i.id!==""&&n(xo({id:i.id})),i.numberOfRecommendations&&n(Qf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Pr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function WN(e){return e.addReducers({recommendation:Co,configuration:Vt}),!0}m();d();f();p();m();d();f();p();function uw(e,t,r){if(!KN(e))throw Qt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Pa(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function KN(e){return e.addReducers({configuration:Vt}),!0}function lw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(Ws(t.options.result)))};return uw(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Jr=()=>new H({required:!1,emptyAllowed:!0}),hl=L("advancedSearchQueries/update",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()})),yl=L("advancedSearchQueries/register",e=>V(e,{aq:Jr(),cq:Jr(),lq:Jr(),dq:Jr()}));var dw=Be(Hr(),e=>{e.addCase(hl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0),Je(i)||(t.lq=i,t.lqWasSet=!0),Je(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(yl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Je(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Je(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Je(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Je(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(St.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Ir,(t,r)=>{let{aq:n,cq:o}=r.payload;Je(n)||(t.aq=n,t.aqWasSet=!0),Je(o)||(t.cq=o,t.cqWasSet=!0)})});function YN(e){return e.addReducers({advancedSearchQueries:dw}),{updateAdvancedSearchQueries:hl,registerAdvancedSearchQueries:yl}}m();d();f();p();function XN(e){return e.addReducers({configuration:Vt}),{disableAnalytics:uo,enableAnalytics:lo,setOriginLevel2:fs,setOriginLevel3:ms,updateAnalyticsConfiguration:co,updateBasicConfiguration:Rr}}m();d();f();p();function ZN(e){return e.addReducers({configuration:Vt,pipeline:fo,searchHub:Ro}),{updateSearchConfiguration:Kt}}m();d();f();p();function JN(e){return e.addReducers({context:dl}),{addContext:Qn,removeContext:Hn,setContext:$n}}m();d();f();p();function eF(e){return e.addReducers({debug:vs}),{disableDebug:hs,enableDebug:gs}}m();d();f();p();function tF(e){return e.addReducers({dictionaryFieldContext:pl}),{addContext:oi,removeContext:ii,setContext:ni}}m();d();f();p();m();d();f();p();m();d();f();p();var rF={collectionField:new H({emptyAllowed:!1,required:!1}),parentField:new H({emptyAllowed:!1,required:!1}),childField:new H({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},pw=L("folding/register",e=>V(e,rF)),eve=ke("folding/loadCollection",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Mr(i):Oo(i,o),s=yield n.search({...a,q:nF(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return vt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref38.apply(this,arguments)}}());function nF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var fw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var si=L("fields/registerFieldsToInclude",e=>V(e,ps)),vl=L("fields/fetchall/enable"),Sl=L("fields/fetchall/disable"),bl=ke("fields/fetchDescription",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:u}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:u??wr(s,a)});return vt(c)?n(c.error):c.success.fields});return function(_x164,_x165){return _ref39.apply(this,arguments)}}());m();d();f();p();var Al=["author","language","urihash","objecttype","collection","source","permanentid"],Hf=[...Al,"date","filetype","parents"],mw=[...Hf,"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"],gw=()=>({fieldsToInclude:Al,fetchAllFields:!1,fieldsDescription:[]});var wl=Be(gw(),e=>e.addCase(si,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(vl,t=>{t.fetchAllFields=!0}).addCase(Sl,t=>{t.fetchAllFields=!1}).addCase(bl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(pw,(t,{payload:r})=>{let n=fw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function oF(e){return e.addReducers({fields:wl}),{registerFieldsToInclude:si,enableFetchAllFields:vl,disableFetchAllFields:Sl,fetchFieldsDescription:bl}}m();d();f();p();function iF(e){return e.addReducers({pipeline:fo}),{setPipeline:po}}m();d();f();p();function aF(e){return e.addReducers({recommendation:Co}),{getRecommendations:Pr,setRecommendationId:xo}}m();d();f();p();function sF(e){return e.addReducers({}),{logRecommendationOpen:Ws}}m();d();f();p();m();d();f();p();var cF=new yt({content:new qe({required:!0}),conditions:new qe({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new Ae({required:!1,each:Y})});function hw(){let e=[],t=r=>{let n=cF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new fi("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function yw(e){if(!uF(e))throw Qt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=hw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(si(i))},selectTemplate:r,selectLinkTemplate:n}}function uF(e){return e.addReducers({fields:wl}),!0}m();d();f();p();function lF(e){return e.addReducers({searchHub:Ro}),{setSearchHub:Eo}}/**
|
|
41
|
+
`),y=JSON.parse(g);r?.event("SSE","Event received:",y,{type:y.type}),n.next(y)}catch(g){n.error(g)}}return n.asObservable()},wP=e=>{let t=new ir,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==zn.HEADERS&&o.type===zn.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=Lb(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()},CP=(e,t)=>{let r=ka(t),n=new ir,o=new tu,i=!1;return e.subscribe({next:a=>{if(o.next(a),a.type===zn.HEADERS&&!i){i=!0;let s=a.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:s,parser:s===Fp?"protobuf":"sse"}),s===Fp?wP(o).subscribe({next:u=>n.next(u),error:u=>n.error(u),complete:()=>n.complete()}):AP(o,r).subscribe({next:u=>{try{let c=jc.parse(u);r?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),n.next(c)}catch(c){r?.event("HTTP","Event invalid:",{json:u,error:String(c)}),n.error(c)}},error:u=>{if(u?.name==="AbortError"){n.next({type:D.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),n.complete();return}return n.error(u)},complete:()=>n.complete()})}else i||n.error(Error("No headers event received before data events"))},error:a=>{o.error(a),n.error(a)},complete:()=>{o.complete()}}),n.asObservable()},Be=S.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),xP=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),EP=S.object({type:S.literal(Be.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),RP=S.object({type:S.literal(Be.enum.TextMessageContent),messageId:S.string(),content:S.string()}),IP=S.object({type:S.literal(Be.enum.TextMessageEnd),messageId:S.string()}),TP=S.object({type:S.literal(Be.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),_P=S.object({type:S.literal(Be.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),kP=S.object({type:S.literal(Be.enum.ActionExecutionEnd),actionExecutionId:S.string()}),OP=S.object({type:S.literal(Be.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),PP=S.object({type:S.literal(Be.enum.AgentStateMessage),threadId:S.string(),agentName:S.string(),nodeName:S.string(),runId:S.string(),active:S.boolean(),role:S.string(),state:S.string(),running:S.boolean()}),NP=S.object({type:S.literal(Be.enum.MetaEvent),name:xP,value:S.any()}),FP=S.object({type:S.literal(Be.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[EP,RP,IP,TP,_P,kP,OP,PP,NP,FP]),S.object({id:S.string(),role:S.string(),content:S.string(),parentMessageId:S.string().optional()}),S.object({id:S.string(),name:S.string(),arguments:S.any(),parentMessageId:S.string().optional()}),S.object({id:S.string(),result:S.any(),actionExecutionId:S.string(),actionName:S.string()});var DP=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
|
+
`)},MP=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",u=null,c=null,g=[],y={},R=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(Rt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let v=h;return[{type:Be.enum.TextMessageStart,messageId:v.messageId,role:v.role}]}case D.TEXT_MESSAGE_CONTENT:{let v=h;return[{type:Be.enum.TextMessageContent,messageId:v.messageId,content:v.delta}]}case D.TEXT_MESSAGE_END:{let v=h;return[{type:Be.enum.TextMessageEnd,messageId:v.messageId}]}case D.TOOL_CALL_START:{let v=h;return g.push({id:v.toolCallId,type:"function",function:{name:v.toolCallName,arguments:""}}),a=!0,y[v.toolCallId]=v.toolCallName,[{type:Be.enum.ActionExecutionStart,actionExecutionId:v.toolCallId,actionName:v.toolCallName,parentMessageId:v.parentMessageId}]}case D.TOOL_CALL_ARGS:{let v=h,w=g.find(C=>C.id===v.toolCallId);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v.toolCallId}'`),[];w.function.arguments+=v.delta;let E=!1;if(c){let C=c.find(_=>_.tool==w.function.name);if(C)try{let _=JSON.parse(bu(w.function.arguments));C.tool_argument&&C.tool_argument in _?(R({...o,[C.state_key]:_[C.tool_argument]}),E=!0):C.tool_argument||(R({...o,[C.state_key]:_}),E=!0)}catch{}}return[{type:Be.enum.ActionExecutionArgs,actionExecutionId:v.toolCallId,args:v.delta},...(E?[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case D.TOOL_CALL_END:{let v=h;return[{type:Be.enum.ActionExecutionEnd,actionExecutionId:v.toolCallId}]}case D.TOOL_CALL_RESULT:{let v=h;return[{type:Be.enum.ActionExecutionResult,actionExecutionId:v.toolCallId,result:v.content,actionName:y[v.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let v=h;switch(v.name){case"Exit":i=!1;break;case"PredictState":c=v.value;break}return[{type:Be.enum.MetaEvent,name:v.name,value:v.value}]}case D.STATE_SNAPSHOT:return R(h.snapshot),[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case D.STATE_DELTA:{let v=h,w=zc.applyPatch(o,v.delta,!0,!1);return w?(R(w.newDocument),[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case D.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:u}:{})}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return u&&(o.messages=u),Object.keys(o).length===0?[]:[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:qP(u)}:{})}),active:!1}];case D.RUN_ERROR:{let v=h;return[{type:Be.enum.RunError,message:v.message,code:v.code}]}case D.STEP_STARTED:return s=h.stepName,g=[],c=null,[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],c=null,[{type:Be.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function qP(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=DP(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 LP=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,jP=e=>e==="tool"?"toolCallId":"messageId",si=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},ol=e=>t=>{let r=ka(e),n=new Map,o=u=>{let c=n.get(u);if(!c)return[];switch(n.delete(u),c.kind){case"text":{let g={type:D.TEXT_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:D.TOOL_CALL_END,toolCallId:c.fields.toolCallId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:D.REASONING_MESSAGE_END,messageId:c.fields.messageId,...(c.fields.subagentRunId!=null&&{subagentRunId:c.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...n.keys()].flatMap(u=>o(u)),a=(u,c)=>{for(let[g,y]of n)if(y.kind===u&&LP(y)===c)return{owner:g}},s=(u,c,g,y,R)=>{if(c!==void 0){let v=a(u,c);if(v){if(g!==void 0&&g!==v.owner)throw Error(`Cannot continue ${R} '${c}': chunk subagentRunId '${g}' does not match the open stream's subagent '${v.owner??"(the parent agent)"}'.`);return v.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===u)return;let h=[...n.entries()].filter(([,v])=>v.kind===u);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${y}: it carries neither a ${jP(u)} nor a subagentRunId, but ${h.length} lanes have an open ${R}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Rt(u=>{switch(u.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.CUSTOM:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...o(u.subagentRunId??void 0),u];case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.MESSAGES_SNAPSHOT:return[...i(),u];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:case D.SUBAGENT_STARTED:return[u];case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{let c=u.subagentRunId;return c==null?[u]:[...o(c),u]}case D.TEXT_MESSAGE_CHUNK:{let c=u,g=s("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=n.get(g),R=[],h;if(y?.kind==="text"&&(c.messageId===void 0||c.messageId===y.fields.messageId))h=y.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,name:c.name,subagentRunId:c.subagentRunId},n.set(g,{kind:"text",fields:h});let v=si({type:D.TEXT_MESSAGE_START,messageId:c.messageId,role:c.role||"assistant",...(c.name!==void 0&&{name:c.name}),...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(v),r?.event("TRANSFORM","TEXT_MESSAGE_START",v,{messageId:c.messageId})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,w=si({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);R.push(w),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",w,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;R.push({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return R}case D.TOOL_CALL_CHUNK:{let c=u,g=s("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=n.get(g),R=[],h;if(y?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===y.fields.toolCallId))h=y.fields;else{if(R.push(...o(g)),c.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(c.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"tool",fields:h});let v=si({type:D.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(v),r?.event("TRANSFORM","TOOL_CALL_START",v,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,w=si({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);R.push(w),r?.event("TRANSFORM","TOOL_CALL_ARGS",w,{toolCallId:h.toolCallId})}if(R.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;R.push({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return R}case D.REASONING_MESSAGE_CHUNK:{let c=u,g=s("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=n.get(g),R=[],h;if(y?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===y.fields.messageId))h=y.fields;else{if(R.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let v=si({type:D.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);R.push(v),r?.event("TRANSFORM","REASONING_MESSAGE_START",v,{messageId:c.messageId})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,w=si({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);R.push(w),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",w,{messageId:h.messageId})}if(R.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;R.push({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return R}}return u.type,[]}),Qn(()=>{i()}))};function UP(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Oa=class{runNext(e,t){return t.run(e).pipe(ol(!1))}runNextWithState(e,t){let r=Te(e.messages||[]),n=Te(e.state||{}),o=new tu;return Zb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(yu(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Te(r),state:Te(n)}});return function(_x93){return _ref22.apply(this,arguments)}}()))}},VP=class extends Oa{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function BP(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 GP=class extends Oa{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(BP)};return this.runNext(o,t)}},Gb="THINKING_START",$b="THINKING_END",Qb="THINKING_TEXT_MESSAGE_START",Hb="THINKING_TEXT_MESSAGE_CONTENT",zb="THINKING_TEXT_MESSAGE_END",$P=class extends Oa{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(zr(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case Gb:{this.currentReasoningId=_a();let{title:t,...r}=e;return this.warnAboutTransformation(Gb,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case Qb:return this.currentMessageId=_a(),this.warnAboutTransformation(Qb,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Hb:{let{delta:t,...r}=e;return this.warnAboutTransformation(Hb,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??_a(),delta:t}}case zb:{let t=this.currentMessageId??_a();return this.warnAboutTransformation(zb,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case $b:{let t=this.currentReasoningId??_a();return this.warnAboutTransformation($b,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function QP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function HP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function zP(e){let t=QP(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 WP(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>HP(n)?zP(n):n);return{...e,content:r}}var KP=class extends Oa{run(e,t){let r={...e,messages:e.messages.map(WP)};return this.runNext(r,t)}},Wb="SUBAGENT_STARTED",Kb="SUBAGENT_FINISHED",Yb="SUBAGENT_ERROR";function il(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function Xb(e){return e.map(t=>il(t))}var YP=class extends Oa{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=>il(n))};return this.runNext(r,t).pipe(Su(n=>{let o=n.type;(o===Wb||o===Kb||o===Yb)&&this.warnDroppedLifecycleEvent(o)}),Sp(n=>{let o=n.type;return o!==Wb&&o!==Kb&&o!==Yb}),zr(n=>{let o=il(n);if(o.type===D.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:Xb(i.messages)}}if(o.type===D.RUN_FINISHED){let i=o;if(i.outcome&&Array.isArray(i.outcome.interrupts))return{...i,outcome:{...i.outcome,interrupts:i.outcome.interrupts.map(a=>il(a))}}}if(o.type===D.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:Xb(i.input.messages)}}}return o}))}},XP="0.0.59",ZP=class{get maxVersion(){return XP}get debug(){return this._debug}set debug(e){this._debug=nl(e),this._debugLogger=qp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?qp(nl(!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??Br(),this.messages=Te(n??[]),this.state=Te(o??{}),this._debug=nl(i),this._debugLogger=qp(this._debug),ai(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new GP),ai(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new $P),ai(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new KP),ai(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new YP)}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 VP(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Br();let r=_this14.prepareRunAgentInput(e);_this14.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this14.agentId,threadId:_this14.threadId});let n,o=new Set(_this14.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new ir;let a;_this14.activeRunCompletionPromise=new Promise(u=>{a=u}),yield gu(eu(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this14).run(r),ol(_this14.debugLogger),Lp(_this14.debugLogger),u=>u.pipe(vu(_this14.activeRunDetach$)),u=>_this14.apply(r,u,i),u=>_this14.processApplyEvents(r,u,i),Ra(u=>(_this14.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this14.agentId,error:u instanceof Error?u.message:String(u)}),_this14.isRunning=!1,_this14.onError(r,u,i))),Qn(()=>{_this14.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this14.agentId,threadId:_this14.threadId}),_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Oe(null)));let s=Te(_this14.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new ip}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Br();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(n=u.result)}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new ir;let a;_this15.activeRunCompletionPromise=new Promise(u=>{a=u}),yield gu(eu(()=>hu(()=>_this15.connect(r)),ol(_this15.debugLogger),Lp(_this15.debugLogger),u=>u.pipe(vu(_this15.activeRunDetach$)),u=>_this15.apply(r,u,i),u=>_this15.processApplyEvents(r,u,i),Ra(u=>(_this15.isRunning=!1,u instanceof ip?ru:_this15.onError(r,u,i))),Qn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Oe(null)),{defaultValue:void 0});let s=Te(_this15.messages).filter(u=>!o.has(u.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return Zb(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(Su(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Te(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Br(),tools:Te(e?.tools??[]),context:Te(e?.context??[]),forwardedProps:Te(e?.forwardedProps??{}),state:Te(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Te(e.resume)})}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){if(_this17.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this17.pendingInterrupts.map(i=>i.id).filter(i=>!n.has(i));if(o.length>0)throw new he(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this17.pendingInterrupts)if(UP(i))throw new he(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let r=yield Pe(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this17.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})}r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})}))}})()}onError(e,t,r){return $n(Pe(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(zr(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let i=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||i==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield Pe(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Te(this.messages),e.state=Te(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Te(this.pendingInterrupts),e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Te(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Te(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Br();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(ol(this.debugLogger),Lp(this.debugLogger),MP(this.threadId,t.runId,this.agentId),r=>r.pipe(zr(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function JP(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 Jb=class extends ZP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(JP(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Te(e.headers??{}),this.fetch=e.fetch??((t,r)=>x(t,r))}run(e){return CP(bP(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Te(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();p();f();var eA=(e,t,r)=>{let n=Pt(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 Vp=class extends Jb{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}}},tA=(e,t,r)=>new Vp({url:`${eA(e,t,r)}/answer`});m();d();p();f();m();d();p();f();var eN=new K({required:!0}),rA=new K({required:!0,constrainTo:Cc}),nA=e=>({...e,name:xc(e.name)}),oA=q("followUpAnswers/setIsEnabled",e=>$(e,new ge({required:!0}))),iA=q("followUpAnswers/setFollowUpAnswersConversationId",e=>$(e,X)),aA=q("followUpAnswers/setFollowUpAnswersConversationToken",e=>$(e,X)),sA=q("followUpAnswers/clearFollowUpAnswersConversationToken"),Jne=q("followUpAnswers/createFollowUpAnswer",e=>$(e,{question:X})),eoe=q("followUpAnswers/setActiveFollowUpAnswerId",e=>$(e,X)),toe=q("followUpAnswers/setFollowUpAnswerContentFormat",e=>$(e,{contentFormat:Rc,answerId:X})),roe=q("followUpAnswers/setFollowUpIsLoading",e=>$(e,{isLoading:new ge({required:!0}),answerId:X})),noe=q("followUpAnswers/setFollowUpIsStreaming",e=>$(e,{isStreaming:new ge({required:!0}),answerId:X})),ooe=q("followUpAnswers/followUpMessageChunkReceived",e=>$(e,{textDelta:eN,answerId:X})),ioe=q("followUpAnswers/followUpCitationsReceived",e=>$(e,{citations:new be({required:!0,each:new re({values:Qf})}),answerId:X})),aoe=q("followUpAnswers/followUpCompleted",e=>$(e,{answerId:X,cannotAnswer:new ge({required:!1})})),soe=q("followUpAnswers/followUpFailed",e=>$(e,{message:new K,code:new ne({min:0}),answerId:X})),coe=q("followUpAnswers/activeFollowUpStartFailed",e=>$(e,{message:new K})),uoe=q("followUpAnswers/likeFollowUp",e=>$(e,{answerId:X})),loe=q("followUpAnswers/dislikeFollowUp",e=>$(e,{answerId:X})),doe=q("followUpAnswers/submitFollowUpFeedback",e=>$(e,{answerId:X})),cA=q("followUpAnswers/resetFollowUpAnswers"),foe=q("followUpAnswers/stepStarted",e=>$(nA(e),{answerId:X,name:rA,startedAt:new ne({min:0,required:!0})})),poe=q("followUpAnswers/stepFinished",e=>$(nA(e),{answerId:X,name:rA,finishedAt:new ne({min:0,required:!0})})),moe=q("followUpAnswers/startToolCall",e=>$(e,{answerId:X,toolCallName:X,startedAt:new ne({min:0,required:!0}),toolCallId:X})),goe=q("followUpAnswers/finishToolCall",e=>$(e,{answerId:X,finishedAt:new ne({min:0,required:!0}),toolCallId:X})),hoe=q("followUpAnswers/toolCallArgs",e=>$(e,{answerId:X,toolCallId:X,args:new re({options:{required:!0}}),type:new K({required:!0,constrainTo:Ec})}));m();d();p();f();var tN={"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 uA(e){return e?tN[e]??1004:1004}var lA=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ic(n.runId)),e(Vr(!1)),e(da(!0)),e(iA(n.threadId)),e(sA())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Ev({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Rv({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:a,timestamp:s}=n;e(Iv({toolCallId:a,toolCallName:i,startedAt:s??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:a}=n;e(Tv({toolCallId:i,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:a}=n;try{let s=JSON.parse(a);typeof s?.q=="string"?e(_c({toolCallId:i,args:s,type:"search"})):e(_c({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(_c({toolCallId:i,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(fa({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(ga(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(oA(a.followUpEnabled)),a?.conversationToken&&e(aA(a.conversationToken));return}case"citations":{e(pa({citations:a.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let i=uA(n.code);e(ma({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(Hf(i)),e(ha(!i)),e(da(!1)),e(Rf(i,t,a)),e(qo())}}};var dA=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _run=_asyncToGenerator(function*(n,o,i){t();let a=tc(n),s=kh(n),u=Oh(n),c=_h(n),g=Ph(n),y=tA(a,s,u);e=y;let R=lA(o),h=vv(n,i());try{o(Vr(!0)),yield y.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},R)}catch(v){o(Vr(!1)),o(ma({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",v)}});function run(_x94,_x95,_x96){return _run.apply(this,arguments)}return run}(),abortRun:t}};m();d();p();f();m();d();p();f();var al=q("breadcrumb/deselectAll"),fA=q("breadcrumb/deselectAllNonBreadcrumbs");m();d();p();f();var pA=q("facet/updateFacetAutoSelection",e=>$(e,{allow:new ge({required:!0})}));m();d();p();f();m();d();p();f();var sl=class extends Fr{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??Tt().q}get responseTime(){return this.activeInstantResultCache?.duration??Wt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Wt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var mA=()=>Le("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new sl(e)),gA=()=>({actionCause:"searchboxAsYouType"});m();d();p();f();var Bp={id:X},rN={...Bp,q:it},Rie=q("instantResults/register",e=>$(e,Bp)),cl=q("instantResults/updateQuery",e=>$(e,rN)),Iie=q("instantResults/clearExpired",e=>$(e,Bp));m();d();p();f();var ul=new ne({required:!0,min:0}),ll=q("pagination/registerNumberOfResults",e=>$(e,ul)),dl=q("pagination/updateNumberOfResults",e=>$(e,ul)),fl=q("pagination/registerPage",e=>$(e,ul)),ci=q("pagination/updatePage",e=>$(e,ul)),pl=q("pagination/nextPage"),ml=q("pagination/previousPage");m();d();p();f();var ui=q("query/updateQuery",e=>$(e,{q:new K,enableQuerySyntax:new ge}));m();d();p();f();m();d();p();f();m();d();p();f();var Kr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Gp=()=>Le("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Yr=e=>Le("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Tt().q,aq:r.advancedSearchQueries?.aq||Kr().aq,cq:r.advancedSearchQueries?.cq||Kr().cq,dq:r.advancedSearchQueries?.dq||Kr().dq,errorType:e.type,errorMessage:e.message}));m();d();p();f();m();d();p();f();var dae=q("didYouMean/enable"),fae=q("didYouMean/disable"),pae=q("didYouMean/automaticCorrections/disable"),mae=q("didYouMean/automaticCorrections/enable"),gl=q("didYouMean/correction",e=>$(e,X)),gae=q("didYouMean/automaticCorrections/mode",e=>$(e,new K({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();p();f();var $p=()=>Le("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var hA=()=>({actionCause:"didYouMeanAutomatic"});m();d();p();f();m();d();p();f();function hl(){return{contextValues:{}}}m();d();p();f();function yl(){return{contextValues:{}}}m();d();p();f();function yA(){return{freezeFacetOrder:!1,facets:{}}}m();d();p();f();function vA(){return[]}m();d();p();f();function Pa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();p();f();function SA(){return{}}m();d();p();f();function bA(){return{}}m();d();p();f();function AA(){return{}}function ar(e){return{context:e.context||hl(),dictionaryFieldContext:e.dictionaryFieldContext||yl(),facetSet:e.facetSet||ec(),numericFacetSet:e.numericFacetSet||Js(),dateFacetSet:e.dateFacetSet||Zs(),categoryFacetSet:e.categoryFacetSet||Xs(),automaticFacetSet:e.automaticFacetSet??Ys(),pagination:e.pagination||Pa(),query:e.query||Tt(),tabSet:e.tabSet||AA(),advancedSearchQueries:e.advancedSearchQueries||Kr(),staticFilterSet:e.staticFilterSet||bA(),querySet:e.querySet||SA(),sortCriteria:e.sortCriteria||rc(),pipeline:e.pipeline||Or(),searchHub:e.searchHub||To(),facetOptions:e.facetOptions||yA(),facetOrder:e.facetOrder??vA(),debug:e.debug??_s()}}m();d();p();f();var Vse=new re({values:{undoneQuery:it},options:{required:!0}}),wA=()=>Le("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();p();f();var vl=q("trigger/query/ignore",e=>$(e,new K({emptyAllowed:!0,required:!0}))),Sl=q("trigger/query/modification",e=>$(e,new re({values:{originalQuery:ot,modification:ot}})));m();d();p();f();var Xr=/*#__PURE__*/function(){var _Xr=_asyncToGenerator(function*(e,t){let r=iN(e),n=Ac(e),o=nN(e),i=yield jr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return qr({...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}}})})});function Xr(_x97,_x98){return _Xr.apply(this,arguments)}return Xr}();function nN(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(oN).filter(r=>r.currentValues.length>0):void 0}function oN(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function iN(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=aN(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function aN(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Zr=class{constructor(t,r=n=>{this.dispatch(ui({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=bc(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return wt(t.response)?(this.dispatch(Yr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o||!i)return null;let c=a.length===0&&s&&s.length!==0,g=!ue(u)&&!ue(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Zt(ar(_this25.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return wt(i.response)?(_this26.dispatch(Yr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Zt(ar(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:$p()})})()}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:$p()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(vl("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return wt(a.response)?(_this27.dispatch(Yr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Zt(ar(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:wA()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Tt().enableQuerySyntax},search:{...Wt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Zt(ar(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Xa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Xr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(gl(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(Sl({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Xr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var Vce=Fe("search/executeSearch",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield bl(r,t,e)});return function(_x101,_x102){return _ref27.apply(this,arguments)}}()),Bce=Fe("search/fetchPage",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Hp(r,t,e)});return function(_x103,_x104){return _ref28.apply(this,arguments)}}()),Gce=Fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield zp(t,r)});return function(_x105,_x106){return _ref29.apply(this,arguments)}}()),$ce=Fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield lN(t,e,r)});return function(_x107,_x108){return _ref30.apply(this,arguments)}}()),Qce=Fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){return Qp(e,t)});return function(_x109,_x110){return _ref31.apply(this,arguments)}}()),sN=/*#__PURE__*/function(){var _sN=_asyncToGenerator(function*(e,t){let r=yield Xr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});function sN(_x111,_x112){return _sN.apply(this,arguments)}return sN}(),cN=/*#__PURE__*/function(){var _cN=_asyncToGenerator(function*(e,t,r){let n=yield jr(e);return qr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});function cN(_x113,_x114,_x115){return _cN.apply(this,arguments)}return cN}(),uN=/*#__PURE__*/function(){var _uN=_asyncToGenerator(function*(e,t){let r=yield Xr(e,t);return r.request.numberOfResults=0,r});function uN(_x116,_x117){return _uN.apply(this,arguments)}return uN}(),CA=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Qp(_x118,_x119){return _Qp.apply(this,arguments)}function _Qp(){_Qp=_asyncToGenerator(function*(e,t){$(e,{id:X,q:X,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Zr({...t,analyticsAction:mA()},c=>{t.dispatch(cl({q:c,id:e.id}))}),a=yield cN(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(s);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Qp.apply(this,arguments)}function Hp(_x120,_x121,_x122){return _Hp.apply(this,arguments)}function _Hp(){_Hp=_asyncToGenerator(function*(e,t,r){CA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Zr({...t,analyticsAction:r}),u=yield Xr(e,a),c=yield s.fetchFromAPI(u,{origin:"mainSearch"});return yield s.process(c)});return _Hp.apply(this,arguments)}function zp(_x123,_x124){return _zp.apply(this,arguments)}function _zp(){_zp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield Gp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Zr({...e,analyticsAction:Gp()}),s=yield sN(t,i),u=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(u)});return _zp.apply(this,arguments)}function lN(_x125,_x126,_x127){return _lN.apply(this,arguments)}function _lN(){_lN=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Zr({...e,analyticsAction:t}),u=yield uN(r,a),c=yield s.fetchFromAPI(u,{origin:"facetValues"});return yield s.process(c)});return _lN.apply(this,arguments)}function bl(_x128,_x129,_x130){return _bl.apply(this,arguments)}function _bl(){_bl=_asyncToGenerator(function*(e,t,r){CA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Xr(e,a),u=new Zr({...t,analyticsAction:r}),c=yield u.fetchFromAPI(s,{origin:"mainSearch"});return yield u.process(c)});return _bl.apply(this,arguments)}m();d();p();f();var Jr=class{constructor(t,r=n=>{this.dispatch(ui({q:n}))}){de(this,"config",t);de(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=bc(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return wt(t.response)?(this.dispatch(Yr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:u}=n;if(!o)return null;if(!i)return!ue(u)&&!ue(u.correctedQuery)?_this32.processModernDidYouMeanAutoCorrection(t):null;let c=a.length===0&&s&&s.length!==0,g=!ue(u)&&!ue(u.correctedQuery);if(!c&&!g)return null;let R=c?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Zt(ar(_this32.getState()))),R})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return wt(i.response)?(_this33.dispatch(Yr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Zt(ar(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(vl("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return wt(a.response)?(_this34.dispatch(Yr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Zt(ar(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Zt(ar(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Xa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=hA(),o=yield _this35.fetchFromAPI(yield Ur(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(gl(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(Sl({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Ur(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var Oue=Fe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;$(e,{q:new K,enableQuerySyntax:new ge,clearFilters:new ge}),e.clearFilters&&(r(al()),r(fA())),r(pA({allow:!0})),r(ui({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ci(1))}),Pue=q("search/updateSearchAction"),Al=Fe("search/executeSearch",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return bl(r,t,e.legacy);EA(r);let n=e.next?RA(e.next):void 0,o=yield Ur(r,t.extra.navigatorContext,n),i=new Jr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref32.apply(this,arguments)}}()),xA=Fe("search/fetchPage",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(EA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Hp(r,t,e.legacy);let n=new Jr({...t,analyticsAction:e.next}),o=yield Ur(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref33.apply(this,arguments)}}()),Nue=Fe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return zp(t,r);let n=Zh("browseResults",t.getState),o=new Jr({...t,analyticsAction:n}),i=yield dN(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref34.apply(this,arguments)}}()),Fue=Fe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return bl(r,t,e.legacy);let n=new Jr({...t,analyticsAction:{}}),o=yield pN(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref35.apply(this,arguments)}}()),Due=Fe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qp(e,t);$(e,{id:X,q:X,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=RA(gA()),a=yield fN(r,t.extra.navigatorContext,n,o,i),s=new Jr({...t,analyticsAction:i},g=>{t.dispatch(cl({q:g,id:e.id}))}),u=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield s.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x141,_x142){return _ref36.apply(this,arguments)}}()),dN=/*#__PURE__*/function(){var _dN=_asyncToGenerator(function*(e,t,r){let n=yield Ur(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});function dN(_x143,_x144,_x145){return _dN.apply(this,arguments)}return dN}(),fN=/*#__PURE__*/function(){var _fN=_asyncToGenerator(function*(e,t,r,n,o){let i=jo(e,t,o);return qr({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});function fN(_x146,_x147,_x148,_x149,_x150){return _fN.apply(this,arguments)}return fN}(),pN=/*#__PURE__*/function(){var _pN=_asyncToGenerator(function*(e,t,r){let n=yield Ur(e,t,r);return n.request.numberOfResults=0,n});function pN(_x151,_x152,_x153){return _pN.apply(this,arguments)}return pN}(),EA=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},RA=e=>({actionCause:e.actionCause,type:e.actionCause});var IA=e=>{let t=Bg({extra:e}),r=dA();return t.startListening({actionCreator:Al.pending,effect:function(){var _effect=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Jd(i)||(r.abortRun(),o.dispatch(Tc()),o.dispatch(cA()),i.generatedAnswer.isEnabled===!1))return;let a=wn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});function effect(_x154,_x155){return _effect.apply(this,arguments)}return effect}()}),t};m();d();p();f();var TA=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)},_A=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();p();f();var Wp=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();p();f();function kA(e,t){let r={...e},n,o=i=>(a,s)=>{let u=i(a,s);return n?n(u,s):u};return{get combinedReducer(){let i=Nm(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(cn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();p();f();m();d();p();f();function mN(e){if(!e||!gN(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 OA(e,t=60){if(!e)return!1;let r=mN(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function gN(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function NA(e,t){let r=0,n=null,o=$a(()=>{r=0},500),i=/*#__PURE__*/function(){var _i2=_asyncToGenerator(function*(y,R=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(w){if(!R)throw w;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&y.dispatch(_r({accessToken:v})),v});function i(_x156){return _i2.apply(this,arguments)}return i}(),a=y=>{let R=vN(y.getState());return!!R&&OA(R)},s=/*#__PURE__*/function(){var _s3=_asyncToGenerator(function*(y){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(y))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(R){e.warn(R,"Access token renewal failed. A retry will occur if necessary.")}});function s(_x157){return _s3.apply(this,arguments)}return s}(),u=/*#__PURE__*/function(){var _u2=_asyncToGenerator(function*(y,R,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),PA(y,R.error),R;!n&&(r++,o());try{yield i(y,!0)}catch(w){e.debug(w,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}y.dispatch(h)});function u(_x158,_x159,_x160){return _u2.apply(this,arguments)}return u}(),c=(y,R,h)=>yN(h)?t?u(y,h,R):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),PA(y,h.error),h):h,g=(y,R,h)=>hN(h)?Promise.resolve(h).then(v=>c(y,R,v)):c(y,R,h);return y=>R=>h=>{if(!(typeof h=="function"))return R(h);let w=()=>g(y,h,R(h));return typeof t=="function"&&a(y)?s(y).then(w):w()}}function hN(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function yN(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===(new oo).name}function PA(e,t){e.dispatch(Os({status:401,statusCode:401,message:t.message,type:t.name}))}function vN(e){return e.configuration.accessToken}m();d();p();f();function FA({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return kg({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(_A(n.logger))})}function SN(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...i}=r??{},a={...i,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},s=a.analyticsMode!=="next",u=a.analyticsMode==="legacy"&&o===!0;return s&&Wl()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):(s&&Wl()&&u&&a.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),a)}function DA(e,t){let r={...e.reducers,configuration:Bt,version:Lv},n=bN({...e,reducers:r},t,Bt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(_r({accessToken:o,environment:i,organizationId:a}));let s=SN(e.configuration,n.logger);return s&&n.dispatch(ho(s)),n}function bN(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=kA({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Xi(c.state,o)},get navigatorContext(){return Wp(this.relay,o)}},u=AN(e,s,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(vo())},disableAnalytics(){u.dispatch(yo())},get state(){return u.getState()},get relay(){return Xi(this.state,o)},get navigatorContext(){return Wp(this.relay,o)},logger:a,store:u};return c}function AN(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=wN(e,t.logger,()=>t.navigatorContext);return FA({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function wN(e,t,r){let{renewAccessToken:n}=e.configuration,o=NA(t,n),i=IA({getNavigatorContext:r});return[Kv,o,TA(t),Uv].concat(Wf.middleware,i.middleware,e.middlewares||[])}m();d();p();f();var ZA=Ut(XA(),1);function JA(e){return(0,ZA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();p();f();function ew(e,t){let r=ZN(e),n=Nt,o=JN(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function ZN(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function JN(e){return e.preprocessRequest||za}m();d();p();f();m();d();p();f();var tw={organizationId:X,accessToken:X,name:new K({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new ge({required:!1}),originContext:new K({required:!1}),originLevel2:new K({required:!1}),originLevel3:new K({required:!1}),analyticsMode:new K({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new K({required:!1,url:!0}),trackingId:new K({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new ge({required:!1})}}),environment:new K({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function rw(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var nw=new At({...tw,pipeline:new K({required:!1,emptyAllowed:!0}),searchHub:ot,locale:ot,timezone:ot});function tm(){return{...rw(),searchHub:"default"}}var eF={debug:ks,pipeline:bo,searchHub:No,recommendation:Oo};function ow(e){let t=JA(e.loggerOptions);tF(e.configuration,t);let r=rF(e.configuration,t),n={...ew(e.configuration,t),apiClient:r},o={...e,reducers:eF},i=DA(o,n),{pipeline:a,searchHub:s,timezone:u,locale:c,proxyBaseUrl:g}=e.configuration;return i.dispatch(Xt({timezone:u,locale:c,proxyBaseUrl:g})),ue(a)||i.dispatch(So(a)),ue(s)||i.dispatch(Po(s)),{...i,get state(){return i.state}}}function tF(e,t){try{nw.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function rF(e,t){return new Ya({logger:t,preprocessRequest:e.preprocessRequest||za,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Ym,postprocessFacetSearchResponseMiddleware:Xm,postprocessQuerySuggestResponseMiddleware:Zm})}m();d();p();f();m();d();p();f();m();d();p();f();var nF=new be({each:X,required:!0}),iw=(e,t)=>($(e,X),Ba(t)?$(t,X):$(t,nF),{payload:{contextKey:e,contextValue:t}}),Yn=q("context/set",e=>{for(let[t,r]of Object.entries(e))iw(t,r);return{payload:e}}),Xn=q("context/add",e=>iw(e.contextKey,e.contextValue)),Zn=q("context/remove",e=>$(e,X));m();d();p();f();var El=Qe(hl(),e=>{e.addCase(Yn,(t,r)=>{t.contextValues=r.payload}).addCase(Xn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Zn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ct.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();p();f();function tn(e){let t,r=new Map,n=()=>r.size===0,o,i=a=>{try{let s=JSON.stringify(a),u=t!==s;return t=s,u}catch(s){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",s),!0}};return{subscribe(a){a();let s=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&r.forEach(u=>u())})),r.set(s,a),()=>{r.delete(s),n()&&(o?.(),o=void 0)}},get state(){return{}}}}m();d();p();f();var oF=["caseId","caseNumber"],iF={caseId:"caseContext",caseNumber:"caseContext"},Fa=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${iF[t]} to set this value.}`)}};function rm(e){return oF.includes(e)}var aF=new At({values:new re({options:{required:!1}})});function aw(e,t={}){if(!uF(e))throw zt;let r=tn(e),{dispatch:n}=e,o=()=>e.state,i=Qg(e,aF,t.initialState,"buildContext");return i.values&&n(Yn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Yn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?sF(n):cF(n))}}var sF=e=>({add(t,r){e(Xn({contextKey:t,contextValue:r}))},remove(t){e(Zn(t))}}),cF=e=>({add(t,r){if(rm(t))throw new Fa(t);e(Xn({contextKey:t,contextValue:r}))},remove(t){if(rm(t))throw new Fa(t);e(Zn(t))}});function uF(e){return e.addReducers({context:El}),!0}function sw(e,t){return aw(e,t)}m();d();p();f();m();d();p();f();var fi=q("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=$(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new be({each:it}),i=$(n,o).error;return i?{payload:e,error:i}:{payload:e}}),pi=q("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:it,key:it}});return $(e,t)}),mi=q("dictionaryFieldContext/remove",e=>$(e,it));m();d();p();f();var Rl=Qe(yl(),e=>{e.addCase(fi,(t,r)=>{t.contextValues=r.payload}).addCase(pi,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(mi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ct.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function cw(e){if(!lF(e))throw zt;let t=tn(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(fi(o))},add(o,i){r(pi({field:o,key:i}))},remove(o){r(mi(o))}}}function lF(e){return e.addReducers({dictionaryFieldContext:Rl}),!0}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Da={value:X,numberOfResults:new ne({min:0}),state:X};m();d();p();f();var Ne=X;var mF=new ne({min:1,default:8,required:!1}),gF=new ne({min:1,max:20,default:5,required:!1}),hF={desiredCount:gF,numberOfValues:mF},zpe=q("automaticFacet/setOptions",e=>$(e,hF)),Wpe=q("automaticFacet/deselectAll",e=>$(e,Ne)),yF=X,uw=q("automaticFacet/toggleSelectValue",e=>$(e,{field:yF,selection:new re({values:Da})}));m();d();p();f();m();d();p();f();var vF={state:new Ue({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new K({required:!0,emptyAllowed:!0}),path:new be({required:!0,each:X}),moreValuesAvailable:new ge({required:!1})};function nm(e){e.children.forEach(t=>{nm(t)}),Nt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},vF)}var gi={facetId:Ne,field:X,tabs:new re({options:{required:!1},values:{included:new be({each:new K}),excluded:new be({each:new K})}}),activeTab:new K({required:!1}),delimitingCharacter:new K({required:!1,emptyAllowed:!0}),filterFacetCount:new ge({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Ue({required:!1}),basePath:new be({required:!1,each:X}),filterByBasePath:new ge({required:!1})};var fme=q("categoryFacet/register",e=>$(e,gi)),lw=q("categoryFacet/toggleSelectValue",e=>{try{return Nt(e.facetId,X),nm(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:pr(t)}}}),dw=q("categoryFacet/deselectAll",e=>$(e,gi.facetId)),pme=q("categoryFacet/updateNumberOfValues",e=>$(e,{facetId:gi.facetId,numberOfValues:gi.numberOfValues})),mme=q("categoryFacet/updateSortCriterion",e=>$(e,{facetId:gi.facetId,criterion:new Ue})),gme=q("categoryFacet/updateBasePath",e=>$(e,{facetId:gi.facetId,basePath:new be({each:X})}));m();d();p();f();m();d();p();f();var Ma={facetId:Ne,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new K({required:!1,emptyAllowed:!0})};var SF={path:new be({required:!0,each:X}),displayValue:it,rawValue:it,count:new ne({required:!0,min:0})},fw=q("categoryFacet/selectSearchResult",e=>$(e,{facetId:Ne,value:new re({values:SF})})),Nme=q("categoryFacetSearch/register",e=>$(e,Ma));m();d();p();f();var pw={facetId:Ne,value:new re({values:{displayValue:it,rawValue:it,count:new ne({required:!0,min:0})}})},$me=q("facetSearch/register",e=>$(e,Ma)),Qme=q("facetSearch/update",e=>$(e,Ma)),mw=q("facetSearch/toggleSelectValue",e=>$(e,pw)),gw=q("facetSearch/toggleExcludeValue",e=>$(e,pw));m();d();p();f();m();d();p();f();var Zme=new K({regex:/^[a-zA-Z0-9-_]+$/}),Jme=new K({required:!0}),ege=new be({each:new K}),tge=new K,rge=new ge,nge=new ge,oge=new ne({min:0}),bF=new ne({min:1}),ige=new ge({required:!0}),AF=new re,wF=new K,CF={captions:AF,numberOfValues:bF,query:wF},age=new re({values:CF}),hw=new re({options:{required:!1},values:{type:new K({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new be({required:!0,max:25,each:new K({emptyAllowed:!1,required:!0})})}}),sge=new ge,yw=new be({min:1,max:25,required:!1,each:new K({emptyAllowed:!1,required:!0})});var xF={facetId:Ne,field:new K({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new be({each:new K}),excluded:new be({each:new K})}}),activeTab:new K({required:!1}),filterFacetCount:new ge({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Ue({required:!1}),resultsMustMatch:new Ue({required:!1}),allowedValues:hw,customSort:yw},Sge=q("facet/register",e=>$(e,xF)),vw=q("facet/toggleSelectValue",e=>$(e,{facetId:Ne,selection:new re({values:Da})})),Sw=q("facet/toggleExcludeValue",e=>$(e,{facetId:Ne,selection:new re({values:Da})})),Il=q("facet/deselectAll",e=>$(e,Ne)),bge=q("facet/updateSortCriterion",e=>$(e,{facetId:Ne,criterion:new Ue({required:!0})})),Age=q("facet/updateNumberOfValues",e=>$(e,{facetId:Ne,numberOfValues:new ne({required:!0,min:1})})),wge=q("facet/updateIsFieldExpanded",e=>$(e,{facetId:Ne,isFieldExpanded:new ge({required:!0})})),Cge=q("facet/updateFreezeCurrentValues",e=>$(e,{facetId:Ne,freezeCurrentValues:new ge({required:!0})}));m();d();p();f();m();d();p();f();function Aw(e){let t=bw(e.start,e),r=bw(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function bw(e,t){let{dateFormat:r}=t;return tv(e)?(Mf(e),Zy(e)):typeof e=="string"&&Mr(e)?(Mf(e),e):(Wy(e,r),Sc(Lo(e,r)))}m();d();p();f();var ww=q("rangeFacet/updateSortCriterion",e=>$(e,{facetId:Ne,criterion:new Ue({required:!0})}));m();d();p();f();var Tl={state:X,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ge({required:!0}),numberOfResults:new ne({required:!0,min:0})},_l={start:X,end:X,endInclusive:new ge({required:!0}),state:X,numberOfResults:new ne({required:!0,min:0})};var EF={start:X,end:X,endInclusive:new ge({required:!0}),state:X},RF={facetId:Ne,field:X,tabs:new re({options:{required:!1},values:{included:new be({each:new K}),excluded:new be({each:new K})}}),activeTab:new K({required:!1}),currentValues:new be({required:!1,each:new re({values:EF})}),generateAutomaticRanges:new ge({required:!0}),filterFacetCount:new ge({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Ue({required:!1}),rangeAlgorithm:new Ue({required:!1})};function Cw(e){return Mr(e)?ua(e):e}function xw(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Aw(t);if(Lo(Cw(r)).isAfter(Lo(Cw(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var uhe=q("dateFacet/register",e=>{try{return Nt(e,RF),xw(e),{payload:e,error:null}}catch(t){return{payload:e,error:pr(t)}}}),Ew=q("dateFacet/toggleSelectValue",e=>$(e,{facetId:Ne,selection:new re({values:_l})})),Rw=q("dateFacet/toggleExcludeValue",e=>$(e,{facetId:Ne,selection:new re({values:_l})})),Iw=q("dateFacet/updateFacetValues",e=>{try{return Nt(e,{facetId:Ne,values:new be({each:new re({values:_l})})}),xw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:pr(t)}}});m();d();p();f();var IF={state:X,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new ge({required:!0})},TF={facetId:Ne,field:X,tabs:new re({options:{required:!1},values:{included:new be({each:new K}),excluded:new be({each:new K})}}),activeTab:new K({required:!1}),currentValues:new be({required:!1,each:new re({values:IF})}),generateAutomaticRanges:new ge({required:!0}),filterFacetCount:new ge({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Ue({required:!1}),rangeAlgorithm:new Ue({required:!1})};function Tw(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var whe=q("numericFacet/register",e=>{try{return $(e,TF),Tw(e),{payload:e,error:null}}catch(t){return{payload:e,error:pr(t)}}}),_w=q("numericFacet/toggleSelectValue",e=>$(e,{facetId:Ne,selection:new re({values:Tl})})),kw=q("numericFacet/toggleExcludeValue",e=>$(e,{facetId:Ne,selection:new re({values:Tl})})),Ow=q("numericFacet/updateFacetValues",e=>{try{return Nt(e,{facetId:Ne,values:new be({each:new re({values:Tl})})}),Tw({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:pr(t)}}});var Pw=Qe(Pa(),e=>{e.addCase(ll,(t,r)=>{let n=om(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=qa(n,o)}).addCase(dl,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(kc,t=>{t.firstResult=0}).addCase(fl,(t,r)=>{let n=r.payload;t.firstResult=qa(n,t.numberOfResults)}).addCase(ci,(t,r)=>{let n=r.payload;t.firstResult=qa(n,t.numberOfResults)}).addCase(ml,t=>{let r=om(t),n=Math.max(r-1,1);t.firstResult=qa(n,t.numberOfResults)}).addCase(pl,t=>{let r=om(t),n=kF(t),o=Math.min(r+1,n);t.firstResult=qa(o,t.numberOfResults)}).addCase(Ct.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(kr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Al.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(xA.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Il,t=>{ht(t)}).addCase(Rw,t=>{ht(t)}).addCase(Sw,t=>{ht(t)}).addCase(kw,t=>{ht(t)}).addCase(gw,t=>{ht(t)}).addCase(vw,t=>{ht(t)}).addCase(dw,t=>{ht(t)}).addCase(lw,t=>{ht(t)}).addCase(fw,t=>{ht(t)}).addCase(Ew,t=>{ht(t)}).addCase(_w,t=>{ht(t)}).addCase(al,t=>{ht(t)}).addCase(Iw,t=>{ht(t)}).addCase(Ow,t=>{ht(t)}).addCase(mw,t=>{ht(t)}).addCase(uw,t=>{ht(t)})});function ht(e){e.firstResult=Pa().firstResult}function om(e){let{firstResult:t,numberOfResults:r}=e;return OF(t,r)}function kF(e){let{totalCountFiltered:t,numberOfResults:r}=e;return PF(t,r)}function qa(e,t){return(e-1)*t}function OF(e,t){return Math.round(e/t)+1}function PF(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function im(e){return e.addReducers({pagination:Pw}),{nextPage:pl,previousPage:ml,registerNumberOfResults:ll,registerPage:fl,updateNumberOfResults:dl,updatePage:ci}}var NF=new At({id:new K({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function Nw(e,t={}){if(!FF(e))throw zt;let r=tn(e),{dispatch:n}=e,o=()=>e.state,i=Hg(e,NF,t.options,"buildRecommendationList");return i.id!==""&&n(ko({id:i.id})),i.numberOfRecommendations&&n(im(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Dr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function FF(e){return e.addReducers({recommendation:Oo,configuration:Bt}),!0}m();d();p();f();m();d();p();f();function Fw(e,t,r){if(!DF(e))throw zt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:$a(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function DF(e){return e.addReducers({configuration:Bt}),!0}function Dw(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(ac(t.options.result)))};return Fw(e,t,()=>{n()})}m();d();p();f();m();d();p();f();m();d();p();f();var rn=()=>new K({required:!1,emptyAllowed:!0}),kl=q("advancedSearchQueries/update",e=>$(e,{aq:rn(),cq:rn(),lq:rn(),dq:rn()})),Ol=q("advancedSearchQueries/register",e=>$(e,{aq:rn(),cq:rn(),lq:rn(),dq:rn()}));var Mw=Qe(Kr(),e=>{e.addCase(kl,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;tt(n)||(t.aq=n,t.aqWasSet=!0),tt(o)||(t.cq=o,t.cqWasSet=!0),tt(i)||(t.lq=i,t.lqWasSet=!0),tt(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(Ol,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;tt(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),tt(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),tt(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),tt(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(Ct.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(kr,(t,r)=>{let{aq:n,cq:o}=r.payload;tt(n)||(t.aq=n,t.aqWasSet=!0),tt(o)||(t.cq=o,t.cqWasSet=!0)})});function MF(e){return e.addReducers({advancedSearchQueries:Mw}),{updateAdvancedSearchQueries:kl,registerAdvancedSearchQueries:Ol}}m();d();p();f();function qF(e){return e.addReducers({configuration:Bt}),{disableAnalytics:yo,enableAnalytics:vo,setOriginLevel2:Es,setOriginLevel3:Rs,updateAnalyticsConfiguration:ho,updateBasicConfiguration:_r}}m();d();p();f();function LF(e){return e.addReducers({configuration:Bt,pipeline:bo,searchHub:No}),{updateSearchConfiguration:Xt}}m();d();p();f();function jF(e){return e.addReducers({context:El}),{addContext:Xn,removeContext:Zn,setContext:Yn}}m();d();p();f();function UF(e){return e.addReducers({debug:ks}),{disableDebug:Ts,enableDebug:Is}}m();d();p();f();function VF(e){return e.addReducers({dictionaryFieldContext:Rl}),{addContext:pi,removeContext:mi,setContext:fi}}m();d();p();f();m();d();p();f();m();d();p();f();var BF={collectionField:new K({emptyAllowed:!1,required:!1}),parentField:new K({emptyAllowed:!1,required:!1}),childField:new K({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},qw=q("folding/register",e=>$(e,BF)),Qve=Fe("folding/loadCollection",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield jr(i):jo(i,o),s=yield n.search({...a,q:GF(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 wt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x161,_x162){return _ref38.apply(this,arguments)}}());function GF(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();p();f();var Lw=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();p();f();var hi=q("fields/registerFieldsToInclude",e=>$(e,xs)),Pl=q("fields/fetchall/enable"),Nl=q("fields/fetchall/disable"),Fl=Fe("fields/fetchDescription",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:u}=o.configuration.search,c=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:u??Er(s,a)});return wt(c)?n(c.error):c.success.fields});return function(_x163,_x164){return _ref39.apply(this,arguments)}}());m();d();p();f();var Dl=["author","language","urihash","objecttype","collection","source","permanentid"],am=[...Dl,"date","filetype","parents"],jw=[...am,"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"],Uw=()=>({fieldsToInclude:Dl,fetchAllFields:!1,fieldsDescription:[]});var Ml=Qe(Uw(),e=>e.addCase(hi,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Pl,t=>{t.fetchAllFields=!0}).addCase(Nl,t=>{t.fetchAllFields=!1}).addCase(Fl.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(qw,(t,{payload:r})=>{let n=Lw().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function $F(e){return e.addReducers({fields:Ml}),{registerFieldsToInclude:hi,enableFetchAllFields:Pl,disableFetchAllFields:Nl,fetchFieldsDescription:Fl}}m();d();p();f();function QF(e){return e.addReducers({pipeline:bo}),{setPipeline:So}}m();d();p();f();function HF(e){return e.addReducers({recommendation:Oo}),{getRecommendations:Dr,setRecommendationId:ko}}m();d();p();f();function zF(e){return e.addReducers({}),{logRecommendationOpen:ac}}m();d();p();f();m();d();p();f();var WF=new At({content:new Ue({required:!0}),conditions:new Ue({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new be({required:!1,each:X})});function Vw(){let e=[],t=r=>{let n=WF.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new Ci("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 Bw(e){if(!KF(e))throw zt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Vw();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(hi(i))},selectTemplate:r,selectLinkTemplate:n}}function KF(e){return e.addReducers({fields:Ml}),!0}m();d();p();f();function YF(e){return e.addReducers({searchHub:No}),{setSearchHub:Po}}/**
|
|
43
43
|
* @license
|
|
44
44
|
*
|
|
45
45
|
* Copyright 2026 Coveo Solutions Inc.
|
|
@@ -72,4 +72,4 @@ fast-json-patch/module/duplex.mjs:
|
|
|
72
72
|
*)
|
|
73
73
|
*/if(__exports!=exports)module.exports=exports;return module.exports});//# sourceMappingURL=headless.js.map
|
|
74
74
|
|
|
75
|
-
window.coveoQuanticVersion = '3.45.
|
|
75
|
+
window.coveoQuanticVersion = '3.45.8';
|