@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.
Files changed (78) hide show
  1. package/docs/out/quantic-docs.json +5 -5
  2. package/force-app/main/default/lwc/quanticBreadcrumbManager/quanticBreadcrumbManager.html +4 -4
  3. package/force-app/main/default/lwc/quanticCarousel/quanticCarousel.html +2 -2
  4. package/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.html +18 -18
  5. package/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js +3 -3
  6. package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.html +45 -45
  7. package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.js +9 -0
  8. package/force-app/main/default/lwc/quanticCategoryFacetValue/quanticCategoryFacetValue.html +11 -11
  9. package/force-app/main/default/lwc/quanticColoredResultBadge/quanticColoredResultBadge.html +5 -5
  10. package/force-app/main/default/lwc/quanticDateFacet/quanticDateFacet.html +4 -4
  11. package/force-app/main/default/lwc/quanticDateFacet/quanticDateFacet.js +4 -0
  12. package/force-app/main/default/lwc/quanticDidYouMean/templates/didYouMean.html +2 -2
  13. package/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.html +4 -4
  14. package/force-app/main/default/lwc/quanticFacet/quanticFacet.html +43 -43
  15. package/force-app/main/default/lwc/quanticFacet/quanticFacet.js +8 -0
  16. package/force-app/main/default/lwc/quanticFacetValue/quanticFacetValue.html +5 -5
  17. package/force-app/main/default/lwc/quanticFacetValue/quanticFacetValue.js +4 -0
  18. package/force-app/main/default/lwc/quanticFeedbackModal/feedbackForm.html +2 -2
  19. package/force-app/main/default/lwc/quanticFoldedResultList/quanticFoldedResultList.html +1 -1
  20. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.html +5 -5
  21. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.js +4 -0
  22. package/force-app/main/default/lwc/quanticModal/quanticModal.html +2 -2
  23. package/force-app/main/default/lwc/quanticNoResults/quanticNoResults.html +4 -4
  24. package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.html +6 -6
  25. package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.js +4 -0
  26. package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.html +3 -3
  27. package/force-app/main/default/lwc/quanticQueryError/quanticQueryError.html +6 -6
  28. package/force-app/main/default/lwc/quanticQueryError/quanticQueryError.js +4 -0
  29. package/force-app/main/default/lwc/quanticQuickviewContent/quanticQuickviewDefault.html +1 -1
  30. package/force-app/main/default/lwc/quanticQuickviewContent/quanticQuickviewYoutube.html +1 -1
  31. package/force-app/main/default/lwc/quanticRecentQueriesList/quanticRecentQueriesList.html +4 -4
  32. package/force-app/main/default/lwc/quanticRecentQueriesList/quanticRecentQueriesList.js +8 -0
  33. package/force-app/main/default/lwc/quanticRecentResultsList/quanticRecentResultsList.html +4 -4
  34. package/force-app/main/default/lwc/quanticRecentResultsList/quanticRecentResultsList.js +8 -0
  35. package/force-app/main/default/lwc/quanticRefineModalContent/quanticRefineModalContent.js +4 -0
  36. package/force-app/main/default/lwc/quanticRefineModalContent/templates/disabledDynamicNavigation.html +9 -9
  37. package/force-app/main/default/lwc/quanticRefineModalContent/templates/dynamicNavigation.html +9 -9
  38. package/force-app/main/default/lwc/quanticRefineToggle/quanticRefineToggle.html +2 -2
  39. package/force-app/main/default/lwc/quanticResult/quanticResult.html +1 -1
  40. package/force-app/main/default/lwc/quanticResultAction/quanticResultAction.html +3 -3
  41. package/force-app/main/default/lwc/quanticResultChildren/quanticResultChildren.html +3 -3
  42. package/force-app/main/default/lwc/quanticResultDate/quanticResultDate.html +2 -2
  43. package/force-app/main/default/lwc/quanticResultDate/quanticResultDate.js +1 -1
  44. package/force-app/main/default/lwc/quanticResultField/quanticResultField.js +1 -1
  45. package/force-app/main/default/lwc/quanticResultHighlightedTextField/quanticResultHighlightedTextField.html +3 -3
  46. package/force-app/main/default/lwc/quanticResultLabel/quanticResultLabel.html +3 -3
  47. package/force-app/main/default/lwc/quanticResultLabel/quanticResultLabel.js +4 -0
  48. package/force-app/main/default/lwc/quanticResultList/quanticResultList.html +1 -1
  49. package/force-app/main/default/lwc/quanticResultMultiValueText/quanticResultMultiValueText.html +3 -3
  50. package/force-app/main/default/lwc/quanticResultMultiValueText/quanticResultMultiValueText.js +1 -1
  51. package/force-app/main/default/lwc/quanticResultNumber/quanticResultNumber.html +2 -2
  52. package/force-app/main/default/lwc/quanticResultNumber/quanticResultNumber.js +1 -1
  53. package/force-app/main/default/lwc/quanticResultPrintableUri/quanticResultPrintableUri.html +4 -4
  54. package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.html +5 -5
  55. package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.js +2 -2
  56. package/force-app/main/default/lwc/quanticResultTag/quanticResultTag.html +2 -2
  57. package/force-app/main/default/lwc/quanticResultText/quanticResultText.html +3 -3
  58. package/force-app/main/default/lwc/quanticResultText/quanticResultText.js +1 -1
  59. package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.html +1 -1
  60. package/force-app/main/default/lwc/quanticSearchBoxInput/quanticSearchBoxInput.js +6 -2
  61. package/force-app/main/default/lwc/quanticSearchBoxInput/templates/defaultSearchBoxInput.html +4 -4
  62. package/force-app/main/default/lwc/quanticSearchBoxInput/templates/expandableSearchBoxInput.html +4 -4
  63. package/force-app/main/default/lwc/quanticSmartSnippet/quanticSmartSnippet.html +2 -2
  64. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/quanticSmartSnippetSuggestions.html +1 -1
  65. package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.html +1 -1
  66. package/force-app/main/default/lwc/quanticStandaloneSearchBox/templates/standaloneSearchBox.html +2 -2
  67. package/force-app/main/default/lwc/quanticSummary/quanticSummary.html +1 -1
  68. package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.html +7 -7
  69. package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js +5 -0
  70. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/quanticViewedByCustomerBadge.html +2 -2
  71. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  72. package/force-app/main/default/staticresources/coveoheadless/definitions/app/logger.d.ts +2 -2
  73. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/build-factory.d.ts +1 -1
  74. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +2 -2
  75. package/force-app/main/default/staticresources/coveoheadless/headless.js +20 -20
  76. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
  77. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
  78. package/package.json +6 -6
@@ -14,35 +14,35 @@ 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("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var IA=Object.create;var Go=Object.defineProperty;var RA=Object.getOwnPropertyDescriptor;var TA=Object.getOwnPropertyNames;var kA=Object.getPrototypeOf,_A=Object.prototype.hasOwnProperty;var OA=(e,t,n)=>t in e?Go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Fr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Ye=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Zi=(e,t)=>{for(var n in t)Go(e,n,{get:t[n],enumerable:!0})},uf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of TA(t))!_A.call(e,o)&&o!==n&&Go(e,o,{get:()=>t[o],enumerable:!(r=RA(t,o))||r.enumerable});return e};var Ft=(e,t,n)=>(n=e!=null?IA(kA(e)):{},uf(t||!e||!e.__esModule?Go(n,"default",{value:e,enumerable:!0}):n,e)),PA=e=>uf(Go({},"__esModule",{value:!0}),e);var se=(e,t,n)=>OA(e,typeof t!="symbol"?t+"":t,n);var C,d=Fr(()=>{"use strict";C=typeof globalThis<"u"?globalThis:window});function Ji(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ji=function(t){return typeof t}:Ji=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ji(e)}function DA(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=MA.bind(this))}function MA(e,t){var n=this.event&&this.event.type,r=n==="unload"||n==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!r),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),NA(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):FA(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var NA,FA,p=Fr(()=>{"use strict";NA=function(t){return typeof t=="string"},FA=function(t){return t instanceof Blob};DA.call((typeof window>"u"?"undefined":Ji(window))==="object"?window:{})});var Uu=Ye(Bo=>{"use strict";m();d();f();p();Object.defineProperty(Bo,"__esModule",{value:!0});function lf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function LA(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jA(e,t,n){return t=Dr(t),qA(e,mf()?Reflect.construct(t,n||[],Dr(e).constructor):t.apply(e,n))}function Mu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function df(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$A(r.key),r)}}function Lu(e,t,n){return t&&df(e.prototype,t),n&&df(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pf(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=HA(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){a=!0,i=u},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function Fu(){return Fu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=VA(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Fu.apply(null,arguments)}function Dr(e){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dr(e)}function UA(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&&Du(e,t)}function mf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mf=function(){return!!e})()}function qA(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return LA(e)}function Du(e,t){return Du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Du(e,t)}function VA(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Dr(e))!==null;);return e}function GA(e,t,n,r){var o=Fu(Dr(1&r?e.prototype:e),t,n);return 2&r&&typeof o=="function"?function(i){return o.apply(n,i)}:o}function BA(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $A(e){var t=BA(e,"string");return typeof t=="symbol"?t:t+""}function HA(e,t){if(e){if(typeof e=="string")return lf(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function QA(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 zA(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 ff=function(){function e(){Mu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Lu(e,[{key:"addEventListener",value:function(n,r,o){n in this.listeners||(this.listeners[n]=[]),this.listeners[n].push({callback:r,options:o})}},{key:"removeEventListener",value:function(n,r){if(n in this.listeners){for(var o=this.listeners[n],i=0,s=o.length;i<s;i++)if(o[i].callback===r){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(n){var r=this;if(n.type in this.listeners){for(var o=this.listeners[n.type],i=o.slice(),s=function(){var g=i[a];try{g.callback.call(r,n)}catch(v){Promise.resolve().then(function(){throw v})}g.options&&g.options.once&&r.removeEventListener(n.type,g.callback)},a=0,u=i.length;a<u;a++)s();return!n.defaultPrevented}}}])}(),ju=function(e){function t(){var n;return Mu(this,t),n=jA(this,t),n.listeners||ff.call(n),Object.defineProperty(n,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(n,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(n,"reason",{value:void 0,writable:!0,configurable:!0}),n}return UA(t,e),Lu(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),GA(t,"dispatchEvent",this,3)([r])}},{key:"throwIfAborted",value:function(){var r=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(r)throw i}}],[{key:"timeout",value:function(r){var o=new es;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(r,"ms"),"TimeoutError"))},r),o.signal}},{key:"any",value:function(r){var o=new es;function i(){o.abort(this.reason),s()}function s(){var g=pf(r),v;try{for(g.s();!(v=g.n()).done;){var x=v.value;x.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=pf(r),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(ff),es=function(){function e(){Mu(this,e),Object.defineProperty(this,"signal",{value:new ju,writable:!0,configurable:!0})}return Lu(e,[{key:"abort",value:function(n){var r=zA(n),o=QA(r);this.signal.reason=r,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(es.prototype[Symbol.toStringTag]="AbortController",ju.prototype[Symbol.toStringTag]="AbortSignal");function WA(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function KA(e){typeof e=="function"&&(e={fetch:e});var t=e,n=t.fetch,r=t.Request,o=r===void 0?n.Request:r,i=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!WA({fetch:n,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:n,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||a)&&(u=function(x,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(x,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},u.prototype=o.prototype);var c=n,g=function(x,h){var y=u&&u.prototype.isPrototypeOf(x)?x.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 w=new Promise(function(R,N){y.addEventListener("abort",function(){return N(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,c(x,h)])}return c(x,h)};return{fetch:g,Request:u}}Bo.AbortController=es;Bo.AbortSignal=ju;Bo.abortableFetch=KA});var gf,l,E,f=Fr(()=>{"use strict";gf=Ft(Uu(),1),l=Ft(Uu(),1),{fetch:E}=(0,gf.abortableFetch)({fetch})});function hf(e){return typeof e!="string"||e in{}}function qu(){return Object.create(null)}function Sf(e){return typeof e=="string"&&!!e.trim()}function Vu(e,t){var n=e.split(";").filter(Sf),r=n.shift();if(!r)return null;var o=YA(r),i=o.name,s=o.value;if(t=t?Object.assign({},ts,t):ts,hf(i))return t.silent||console.warn("set-cookie-parser: dropping cookie due to name:",i),null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(u){t.silent||console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=qu();return a.name=i,a.value=s,n.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(hf(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 x=new Date(v);Number.isNaN(x.getTime())?t.silent||console.error("set-cookie-parser: failed to parse expires time:",v):a.expires=x}else g==="max-age"?/^-?\d+$/.test(v)?a.maxAge=parseInt(v,10):t.silent||console.error("set-cookie-parser: failed to parse max-age:",v):g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=v:g==="partitioned"?a.partitioned=!0:g&&(a[g]=v)}),a}function YA(e){var t="",n="",r=e.split("=");return r.length>1?(t=r.shift(),n=r.join("=")):n=e,{name:yf(t),value:yf(n)}}function yf(e){for(var t=0,n=e.length;t<n&&vf(e.charCodeAt(t));)t+=1;for(;n>t&&vf(e.charCodeAt(n-1));)n-=1;return e.substring(t,n)}function vf(e){return e===32||e===9}function Mr(e,t){if(t=t?Object.assign({},ts,t):ts,!e)return t.map?qu():[];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 n=e.headers[Object.keys(e.headers).find(function(s){return s.toLowerCase()==="set-cookie"})];!n&&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=n}var r=t.split,o=Array.isArray(e);if(r==="auto"&&(r=!o),o||(e=[e]),e=e.filter(Sf),r&&(e=e.map(ns).flat()),t.map){var i=qu();return e.reduce(function(s,a){var u=Vu(a,t);return u&&(s[u.name]=u),s},i)}else return e.map(function(s){return Vu(s,t)}).filter(Boolean)}function ns(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],n=0,r,o,i,s,a;function u(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function c(){return o=e.charAt(n),o!=="="&&o!==";"&&o!==","}for(;n<e.length;){for(r=n,a=!1;u();)if(o=e.charAt(n),o===","){for(i=n,n+=1,u(),s=n;n<e.length&&c();)n+=1;n<e.length&&e.charAt(n)==="="?(a=!0,n=s,t.push(e.substring(r,i)),r=n):n=i+1}else n+=1;(!a||n>=e.length)&&t.push(e.substring(r,e.length))}return t}var ts,bf=Fr(()=>{"use strict";m();d();f();p();ts={decodeValues:!0,map:!1,silent:!1,split:"auto"};Mr.parseSetCookie=Mr;Mr.parse=Mr;Mr.parseString=Vu;Mr.splitCookiesString=ns});function $o(e){if(XA.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Gu(e){return e.replace(ZA,"")}function Ho(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>127||!JA(n))return!1}return!0}function JA(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function wf(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n===0||n===10||n===13)return!1}return!0}var XA,Af,ZA,Cf,Lr,Bu,Ef,I,If=Fr(()=>{"use strict";m();d();f();p();bf();XA=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Af=[`
19
- `,"\r","\t"," "],ZA=new RegExp(`(^[${Af.join("")}]|$[${Af.join("")}])`,"g");Lr=Symbol("normalizedHeaders"),Bu=Symbol("rawHeaderNames"),Ef=", ",I=class xf{constructor(t){this[Lr]={},this[Bu]=new Map,this[Cf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof xf||typeof C.Headers<"u"&&t instanceof C.Headers?t.forEach((n,r)=>{this.append(r,n)},this):Array.isArray(t)?t.forEach(([n,r])=>{this.append(n,Array.isArray(r)?r.join(Ef):r)}):t&&Object.getOwnPropertyNames(t).forEach(n=>{let r=t[n];this.append(n,Array.isArray(r)?r.join(Ef):r)})}[(Cf=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[Lr]).sort((n,r)=>n.localeCompare(r));for(let n of t)if(n==="set-cookie")for(let r of this.getSetCookie())yield[n,r];else yield[n,this.get(n)]}has(t){if(!Ho(t))throw new TypeError(`Invalid header name "${t}"`);return this[Lr].hasOwnProperty($o(t))}get(t){if(!Ho(t))throw TypeError(`Invalid header name "${t}"`);return this[Lr][$o(t)]??null}set(t,n){if(!Ho(t)||!wf(n))return;let r=$o(t),o=Gu(n);this[Lr][r]=Gu(o),this[Bu].set(r,t)}append(t,n){if(!Ho(t)||!wf(n))return;let r=$o(t),o=Gu(n),i=this.has(r)?`${this.get(r)}, ${o}`:o;this.set(t,i)}delete(t){if(!Ho(t)||!this.has(t))return;let n=$o(t);delete this[Lr][n],this[Bu].delete(n)}forEach(t,n){for(let[r,o]of this.entries())t.call(n,o,r,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:ns(t)}}});var m=Fr(()=>{"use strict";If()});var Rf=Ye(Qo=>{"use strict";m();d();f();p();var rs=Qo&&Qo.__assign||function(){return rs=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},rs.apply(this,arguments)};Object.defineProperty(Qo,"__esModule",{value:!0});var ew={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function tw(e){var t=rs(rs({},ew),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Qo.getSanitizedOptions=tw});var Tf=Ye($u=>{"use strict";m();d();f();p();Object.defineProperty($u,"__esModule",{value:!0});function nw(e){var t=Math.random()*e;return Math.round(t)}$u.fullJitter=nw});var kf=Ye(Hu=>{"use strict";m();d();f();p();Object.defineProperty(Hu,"__esModule",{value:!0});function rw(e){return e}Hu.noJitter=rw});var _f=Ye(Qu=>{"use strict";m();d();f();p();Object.defineProperty(Qu,"__esModule",{value:!0});var ow=Tf(),iw=kf();function sw(e){return e.jitter==="full"?ow.fullJitter:iw.noJitter}Qu.JitterFactory=sw});var Wu=Ye(zu=>{"use strict";m();d();f();p();Object.defineProperty(zu,"__esModule",{value:!0});var aw=_f(),cw=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(n){return setTimeout(n,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=aw.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,n=this.options.timeMultiple,r=this.numOfDelayedAttempts,o=t*Math.pow(n,r);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}();zu.Delay=cw});var Of=Ye(on=>{"use strict";m();d();f();p();var uw=on&&on.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),lw=on&&on.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(v){s(v)}}function u(g){try{c(r.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})},dw=on&&on.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(on,"__esModule",{value:!0});var pw=Wu(),fw=function(e){uw(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return lw(this,void 0,void 0,function(){return dw(this,function(n){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}(pw.Delay);on.SkipFirstDelay=fw});var Pf=Ye(zo=>{"use strict";m();d();f();p();var mw=zo&&zo.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(zo,"__esModule",{value:!0});var gw=Wu(),hw=function(e){mw(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(gw.Delay);zo.AlwaysDelay=hw});var Nf=Ye(Ku=>{"use strict";m();d();f();p();Object.defineProperty(Ku,"__esModule",{value:!0});var yw=Of(),vw=Pf();function Sw(e,t){var n=bw(e);return n.setAttemptNumber(t),n}Ku.DelayFactory=Sw;function bw(e){return e.delayFirstAttempt?new vw.AlwaysDelay(e):new yw.SkipFirstDelay(e)}});var Ff=Ye(Gn=>{"use strict";m();d();f();p();var Yu=Gn&&Gn.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(v){s(v)}}function u(g){try{c(r.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})},Xu=Gn&&Gn.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Gn,"__esModule",{value:!0});var Aw=Rf(),ww=Nf();function Cw(e,t){return t===void 0&&(t={}),Yu(this,void 0,void 0,function(){var n,r;return Xu(this,function(o){switch(o.label){case 0:return n=Aw.getSanitizedOptions(t),r=new Ew(e,n),[4,r.execute()];case 1:return[2,o.sent()]}})})}Gn.backOff=Cw;var Ew=function(){function e(t,n){this.request=t,this.options=n,this.attemptNumber=0}return e.prototype.execute=function(){return Yu(this,void 0,void 0,function(){var t,n;return Xu(this,function(r){switch(r.label){case 0:if(this.attemptLimitReached)return[3,7];r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return r.sent(),[4,this.request()];case 3:return[2,r.sent()];case 4:return t=r.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(n=r.sent(),!n||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 Yu(this,void 0,void 0,function(){var t;return Xu(this,function(n){switch(n.label){case 0:return t=ww.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return n.sent(),[2]}})})},e}()});var Ta=Ye((kd,_d)=>{"use strict";m();d();f();p();(function(e,t){typeof kd=="object"&&typeof _d<"u"?_d.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs=t()})(kd,function(){"use strict";var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",s="hour",a="day",u="week",c="month",g="quarter",v="year",x="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,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var G=["th","st","nd","rd"],j=L%100;return"["+L+(G[(j-20)%10]||G[j]||G[0])+"]"}},R=function(L,G,j){var Q=String(L);return!Q||Q.length>=G?L:""+Array(G+1-Q.length).join(j)+L},N={s:R,z:function(L){var G=-L.utcOffset(),j=Math.abs(G),Q=Math.floor(j/60),$=j%60;return(G<=0?"+":"-")+R(Q,2,"0")+":"+R($,2,"0")},m:function L(G,j){if(G.date()<j.date())return-L(j,G);var Q=12*(j.year()-G.year())+(j.month()-G.month()),$=G.clone().add(Q,c),K=j-$<0,H=G.clone().add(Q+(K?-1:1),c);return+(-(Q+(j-$)/(K?$-H:H-$))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:c,y:v,w:u,d:a,D:x,h:s,m:i,s:o,ms:r,Q:g}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},k="en",P={};P[k]=w;var A="$isDayjsObject",O=function(L){return L instanceof q||!(!L||!L[A])},_=function L(G,j,Q){var $;if(!G)return k;if(typeof G=="string"){var K=G.toLowerCase();P[K]&&($=K),j&&(P[K]=j,$=K);var H=G.split("-");if(!$&&H.length>1)return L(H[0])}else{var Y=G.name;P[Y]=G,$=Y}return!Q&&$&&(k=$),$||!Q&&k},T=function(L,G){if(O(L))return L.clone();var j=typeof G=="object"?G:{};return j.date=L,j.args=arguments,new q(j)},D=N;D.l=_,D.i=O,D.w=function(L,G){return T(L,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var q=function(){function L(j){this.$L=_(j.locale,null,!0),this.parse(j),this.$x=this.$x||j.x||{},this[A]=!0}var G=L.prototype;return G.parse=function(j){this.$d=function(Q){var $=Q.date,K=Q.utc;if($===null)return new Date(NaN);if(D.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var H=$.match(y);if(H){var Y=H[2]-1||0,ie=(H[7]||"0").substring(0,3);return K?new Date(Date.UTC(H[1],Y,H[3]||1,H[4]||0,H[5]||0,H[6]||0,ie)):new Date(H[1],Y,H[3]||1,H[4]||0,H[5]||0,H[6]||0,ie)}}return new Date($)}(j),this.init()},G.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()},G.$utils=function(){return D},G.isValid=function(){return this.$d.toString()!==h},G.isSame=function(j,Q){var $=T(j);return this.startOf(Q)<=$&&$<=this.endOf(Q)},G.isAfter=function(j,Q){return T(j)<this.startOf(Q)},G.isBefore=function(j,Q){return this.endOf(Q)<T(j)},G.$g=function(j,Q,$){return D.u(j)?this[Q]:this.set($,j)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(j,Q){var $=this,K=!!D.u(Q)||Q,H=D.p(j),Y=function(ge,de){var ve=D.w($.$u?Date.UTC($.$y,de,ge):new Date($.$y,de,ge),$);return K?ve:ve.endOf(a)},ie=function(ge,de){return D.w($.toDate()[ge].apply($.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(de)),$)},me=this.$W,xe=this.$M,je=this.$D,_e="set"+(this.$u?"UTC":"");switch(H){case v:return K?Y(1,0):Y(31,11);case c:return K?Y(1,xe):Y(0,xe+1);case u:var Pe=this.$locale().weekStart||0,Ne=(me<Pe?me+7:me)-Pe;return Y(K?je-Ne:je+(6-Ne),xe);case a:case x:return ie(_e+"Hours",0);case s:return ie(_e+"Minutes",1);case i:return ie(_e+"Seconds",2);case o:return ie(_e+"Milliseconds",3);default:return this.clone()}},G.endOf=function(j){return this.startOf(j,!1)},G.$set=function(j,Q){var $,K=D.p(j),H="set"+(this.$u?"UTC":""),Y=($={},$[a]=H+"Date",$[x]=H+"Date",$[c]=H+"Month",$[v]=H+"FullYear",$[s]=H+"Hours",$[i]=H+"Minutes",$[o]=H+"Seconds",$[r]=H+"Milliseconds",$)[K],ie=K===a?this.$D+(Q-this.$W):Q;if(K===c||K===v){var me=this.clone().set(x,1);me.$d[Y](ie),me.init(),this.$d=me.set(x,Math.min(this.$D,me.daysInMonth())).$d}else Y&&this.$d[Y](ie);return this.init(),this},G.set=function(j,Q){return this.clone().$set(j,Q)},G.get=function(j){return this[D.p(j)]()},G.add=function(j,Q){var $,K=this;j=Number(j);var H=D.p(Q),Y=function(xe){var je=T(K);return D.w(je.date(je.date()+Math.round(xe*j)),K)};if(H===c)return this.set(c,this.$M+j);if(H===v)return this.set(v,this.$y+j);if(H===a)return Y(1);if(H===u)return Y(7);var ie=($={},$[i]=t,$[s]=n,$[o]=e,$)[H]||1,me=this.$d.getTime()+j*ie;return D.w(me,this)},G.subtract=function(j,Q){return this.add(-1*j,Q)},G.format=function(j){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var K=j||"YYYY-MM-DDTHH:mm:ssZ",H=D.z(this),Y=this.$H,ie=this.$m,me=this.$M,xe=$.weekdays,je=$.months,_e=$.meridiem,Pe=function(de,ve,he,Ge){return de&&(de[ve]||de(Q,K))||he[ve].slice(0,Ge)},Ne=function(de){return D.s(Y%12||12,de,"0")},ge=_e||function(de,ve,he){var Ge=de<12?"AM":"PM";return he?Ge.toLowerCase():Ge};return K.replace(b,function(de,ve){return ve||function(he){switch(he){case"YY":return String(Q.$y).slice(-2);case"YYYY":return D.s(Q.$y,4,"0");case"M":return me+1;case"MM":return D.s(me+1,2,"0");case"MMM":return Pe($.monthsShort,me,je,3);case"MMMM":return Pe(je,me);case"D":return Q.$D;case"DD":return D.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return Pe($.weekdaysMin,Q.$W,xe,2);case"ddd":return Pe($.weekdaysShort,Q.$W,xe,3);case"dddd":return xe[Q.$W];case"H":return String(Y);case"HH":return D.s(Y,2,"0");case"h":return Ne(1);case"hh":return Ne(2);case"a":return ge(Y,ie,!0);case"A":return ge(Y,ie,!1);case"m":return String(ie);case"mm":return D.s(ie,2,"0");case"s":return String(Q.$s);case"ss":return D.s(Q.$s,2,"0");case"SSS":return D.s(Q.$ms,3,"0");case"Z":return H}return null}(de)||H.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(j,Q,$){var K,H=this,Y=D.p(Q),ie=T(j),me=(ie.utcOffset()-this.utcOffset())*t,xe=this-ie,je=function(){return D.m(H,ie)};switch(Y){case v:K=je()/12;break;case c:K=je();break;case g:K=je()/3;break;case u:K=(xe-me)/6048e5;break;case a:K=(xe-me)/864e5;break;case s:K=xe/n;break;case i:K=xe/t;break;case o:K=xe/e;break;default:K=xe}return $?K:D.a(K)},G.daysInMonth=function(){return this.endOf(c).$D},G.$locale=function(){return P[this.$L]},G.locale=function(j,Q){if(!j)return this.$L;var $=this.clone(),K=_(j,Q,!0);return K&&($.$L=K),$},G.clone=function(){return D.w(this.$d,this)},G.toDate=function(){return new Date(this.valueOf())},G.toJSON=function(){return this.isValid()?this.toISOString():null},G.toISOString=function(){return this.$d.toISOString()},G.toString=function(){return this.$d.toUTCString()},L}(),M=q.prototype;return T.prototype=M,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",v],["$D",x]].forEach(function(L){M[L[1]]=function(G){return this.$g(G,L[0],L[1])}}),T.extend=function(L,G){return L.$i||(L(G,q,T),L.$i=!0),T},T.locale=_,T.isDayjs=O,T.unix=function(L){return T(1e3*L)},T.en=P[k],T.Ls=P,T.p={},T})});var $h=Ye((Od,Pd)=>{"use strict";m();d();f();p();(function(e,t){typeof Od=="object"&&typeof Pd<"u"?Pd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_quarterOfYear=t()})(Od,function(){"use strict";var e="month",t="quarter";return function(n,r){var o=r.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,u){return a=Number(a),this.$utils().p(u)===t?this.add(3*a,e):i.bind(this)(a,u)};var s=o.startOf;o.startOf=function(a,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(a)===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 s.bind(this)(a,u)}}})});var Hh=Ye((Nd,Fd)=>{"use strict";m();d();f();p();(function(e,t){typeof Nd=="object"&&typeof Fd<"u"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_customParseFormat=t()})(Nd,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,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=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 w=b.match(/([+-]|\d\d)/g),R=60*w[1]+(+w[2]||0);return R===0?0:w[0]==="+"?-R:R}(y)}],g=function(y){var b=s[y];return b&&(b.indexOf?b:b.s.concat(b.f))},v=function(y,b){var w,R=s.meridiem;if(R){for(var N=1;N<=24;N+=1)if(y.indexOf(R(N,0,b))>-1){w=N>12;break}}else w=y===(b?"pm":"PM");return w},x={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[n,function(y){this.month=3*(y-1)+1}],S:[n,function(y){this.milliseconds=100*+y}],SS:[r,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:[r,u("day")],Do:[i,function(y){var b=s.ordinal,w=y.match(/\d+/);if(this.day=w[0],b)for(var R=1;R<=31;R+=1)b(R).replace(/\[|\]/g,"")===y&&(this.day=R)}],w:[o,u("week")],ww:[r,u("week")],M:[o,u("month")],MM:[r,u("month")],MMM:[i,function(y){var b=g("months"),w=(g("monthsShort")||b.map(function(R){return R.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],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:[r,function(y){this.year=a(y)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(y){var b,w;b=y,w=s&&s.formats;for(var R=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,D,q){var M=q&&q.toUpperCase();return D||w[q]||e[q]||w[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(L,G,j){return G||j.slice(1)})})).match(t),N=R.length,k=0;k<N;k+=1){var P=R[k],A=x[P],O=A&&A[0],_=A&&A[1];R[k]=_?{regex:O,parser:_}:P.replace(/^\[|\]$/g,"")}return function(T){for(var D={},q=0,M=0;q<N;q+=1){var L=R[q];if(typeof L=="string")M+=L.length;else{var G=L.regex,j=L.parser,Q=T.slice(M),$=G.exec(Q)[0];j.call(D,$),T=T.replace($,"")}}return function(K){var H=K.afternoon;if(H!==void 0){var Y=K.hours;H?Y<12&&(K.hours+=12):Y===12&&(K.hours=0),delete K.afternoon}}(D),D}}return function(y,b,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(a=y.parseTwoDigitYear);var R=b.prototype,N=R.parse;R.parse=function(k){var P=k.date,A=k.utc,O=k.args;this.$u=A;var _=O[1];if(typeof _=="string"){var T=O[2]===!0,D=O[3]===!0,q=T||D,M=O[2];D&&(M=O[2]),s=this.$locale(),!T&&M&&(s=w.Ls[M]),this.$d=function(Q,$,K,H){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var Y=h($)(Q),ie=Y.year,me=Y.month,xe=Y.day,je=Y.hours,_e=Y.minutes,Pe=Y.seconds,Ne=Y.milliseconds,ge=Y.zone,de=Y.week,ve=new Date,he=xe||(ie||me?1:ve.getDate()),Ge=ie||ve.getFullYear(),We=0;ie&&!me||(We=me>0?me-1:ve.getMonth());var Ct,ht=je||0,Nt=_e||0,Et=Pe||0,rn=Ne||0;return ge?new Date(Date.UTC(Ge,We,he,ht,Nt,Et,rn+60*ge.offset*1e3)):K?new Date(Date.UTC(Ge,We,he,ht,Nt,Et,rn)):(Ct=new Date(Ge,We,he,ht,Nt,Et,rn),de&&(Ct=H(Ct).week(de).toDate()),Ct)}catch{return new Date("")}}(P,_,A,w),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),q&&P!=this.format(_)&&(this.$d=new Date("")),s={}}else if(_ instanceof Array)for(var L=_.length,G=1;G<=L;G+=1){O[1]=_[G-1];var j=w.apply(this,O);if(j.isValid()){this.$d=j.$d,this.$L=j.$L,this.init();break}G===L&&(this.$d=new Date(""))}else N.call(this,k)}}})});var Ly=Ye((Kd,Yd)=>{"use strict";m();d();f();p();(function(e,t){typeof Kd=="object"&&typeof Yd<"u"?Yd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_timezone=t()})(Kd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,r,o){var i,s=function(g,v,x){x===void 0&&(x={});var h=new Date(g),y=function(b,w){w===void 0&&(w={});var R=w.timeZoneName||"short",N=b+"|"+R,k=t[N];return k||(k=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:R}),t[N]=k),k}(v,x);return y.formatToParts(h)},a=function(g,v){for(var x=s(g,v),h=[],y=0;y<x.length;y+=1){var b=x[y],w=b.type,R=b.value,N=e[w];N>=0&&(h[N]=parseInt(R,10))}var k=h[3],P=k===24?0:k,A=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(A).valueOf()-(O-=O%1e3))/6e4},u=r.prototype;u.tz=function(g,v){if(g===void 0&&(g=i),!this.isValid())return this;var x,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),w=a(+y,g);if(!Number(w))x=this.utcOffset(0,v);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),v){var R=x.utcOffset();x=x.add(h-R,"minute")}return x.$x.$timezone=g,x},u.offsetName=function(g){var v=this.$x.$timezone||o.tz.guess(),x=s(this.valueOf(),v,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var c=u.startOf;u.startOf=function(g,v){if(!this.$x||!this.$x.$timezone)return c.call(this,g,v);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(x,g,v).tz(this.$x.$timezone,!0)},o.tz=function(g,v,x){var h=x&&v,y=x||v||i,b=a(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=o.utc(g,h).valueOf();if(Number.isNaN(w)){var R=o(NaN);return R.$x.$timezone=y,R}var N=function(O,_,T){var D=O-60*_*1e3,q=a(D,T);if(_===q)return[D,_];var M=a(D-=60*(q-_)*1e3,T);return q===M?[D,q]:[O-60*Math.min(q,M)*1e3,Math.max(q,M)]}(w,b,y),k=N[0],P=N[1],A=o(k).utcOffset(P);return A.$x.$timezone=y,A},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){i=g}}})});var jy=Ye((Xd,Zd)=>{"use strict";m();d();f();p();(function(e,t){typeof Xd=="object"&&typeof Zd<"u"?Zd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_utc=t()})(Xd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,o,i){var s=o.prototype;i.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},s.utc=function(h){var y=i(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var u=s.init;s.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=s.utcOffset;s.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(k){k===void 0&&(k="");var P=k.match(t);if(!P)return null;var A=(""+P[0]).match(n)||["-",0,0],O=A[0],_=60*+A[1]+ +A[2];return _===0?0:O==="+"?_:-_}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var R=this.clone();if(y)return R.$offset=w,R.$u=!1,R;var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(R=this.local().add(w+N,e)).$offset=w,R.$x.$localOffset=N,R};var g=s.format;s.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var v=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var x=s.diff;s.diff=function(h,y,b){if(h&&this.$u===h.$u)return x.call(this,h,y,b);var w=this.local(),R=i(h).local();return x.call(w,R,y,b)}}})});var qb=Ye((Dce,Ub)=>{"use strict";m();d();f();p();function cP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}Ub.exports=uP;function uP(e,t,n){var r=n&&n.stringify||cP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=r(e);for(var a=1;a<i;a++)s[a]=r(t[a]);return s.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,v=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){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+=r(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<x&&(c+=e.slice(v)),c)}});var zb=Ye((qce,xu)=>{"use strict";m();d();f();p();var Vb=qb();xu.exports=yn;var Yi=EP().console||{},lP={mapHttpRequest:Eu,mapHttpResponse:Eu,wrapRequestSerializer:Kp,wrapResponseSerializer:Kp,wrapErrorSerializer:Kp,req:Eu,res:Eu,err:Bb,errWithCause:Bb};function Un(e,t){return e==="silent"?1/0:t.levels.values[e]}var Zp=Symbol("pino.logFuncs"),Yp=Symbol("pino.hierarchy"),dP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Gb(e,t){let n={logger:t,parent:e[Yp]};t[Yp]=n}function pP(e,t,n){let r={};t.forEach(o=>{r[o]=n[o]?n[o]:Yi[o]||Yi[dP[o]||"log"]||jo}),e[Zp]=r}function fP(e,t){return Array.isArray(e)?e.filter(function(r){return r!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function yn(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 n=e.browser.write||Yi;e.browser.write&&(e.browser.asObject=!0);let r=e.serializers||{},o=fP(e.browser.serialize,r),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof n=="function"&&a.forEach(function(b){n[b]=n}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(n);c.log||(c.log=jo),pP(c,a,n),Gb({},c),Object.defineProperty(c,"levelVal",{get:v}),Object.defineProperty(c,"level",{get:x,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:a,timestamp:AP(e),messageKey:e.messageKey||"msg",onChild:e.onChild||jo};c.levels=mP(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=jo,c.serializers=r,c._serialize=o,c._stdErrSerialize=i,c.child=function(...b){return y.call(this,g,...b)},t&&(c._logEvent=Xp());function v(){return Un(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Pr(this,g,c,"error"),Pr(this,g,c,"fatal"),Pr(this,g,c,"warn"),Pr(this,g,c,"info"),Pr(this,g,c,"debug"),Pr(this,g,c,"trace"),s.forEach(w=>{Pr(this,g,c,w)})}function y(b,w,R){if(!w)throw new Error("missing bindings for child Pino");R=R||{},o&&w.serializers&&(R.serializers=w.serializers);let N=R.serializers;if(o&&N){var k=Object.assign({},r,N),P=e.browser.serialize===!0?Object.keys(k):o;delete w.serializers,Jp([w],P,k,this._stdErrSerialize)}function A(_){this._childLevel=(_._childLevel|0)+1,this.bindings=w,k&&(this.serializers=k,this._serialize=P),t&&(this._logEvent=Xp([].concat(_._logEvent.bindings,w)))}A.prototype=this;let O=new A(this);return Gb(this,O),O.child=function(..._){return y.call(this,b,..._)},O.level=R.level||this.level,b.onChild(O),O}return c}function mP(e){let t=e.customLevels||{},n=Object.assign({},yn.levels.values,t),r=Object.assign({},yn.levels.labels,gP(t));return{values:n,labels:r}}function gP(e){let t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}yn.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"}};yn.stdSerializers=lP;yn.stdTimeFunctions=Object.assign({},{nullTime:Hb,epochTime:Qb,unixTime:wP,isoTime:CP});function hP(e){let t=[];e.bindings&&t.push(e.bindings);let n=e[Yp];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function Pr(e,t,n,r){if(Object.defineProperty(e,r,{value:Un(e.level,n)>Un(r,n)?jo:n[Zp][r],writable:!0,enumerable:!0,configurable:!0}),e[r]===jo){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Un(i,n);if(Un(r,n)<s)return}e[r]=vP(e,t,n,r);let o=hP(e);o.length!==0&&(e[r]=yP(o,e[r]))}function yP(e,t){return function(){return t.apply(this,[...e,...arguments])}}function vP(e,t,n,r){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Yi?Yi:this;for(var c=0;c<a.length;c++)a[c]=arguments[c];var g=!1;if(t.serialize&&(Jp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let v=SP(this,r,a,s,t);if(t.reportCaller&&v&&v.length>0&&v[0]&&typeof v[0]=="object")try{let x=$b();x&&(v[0].caller=x)}catch{}o.call(u,...v)}else{if(t.reportCaller)try{let v=$b();v&&a.push(v)}catch{}o.apply(u,a)}if(t.transmit){let v=t.transmit.level||e._level,x=Un(v,n),h=Un(r,n);if(h<x)return;bP(this,{ts:s,methodLevel:r,methodValue:h,transmitLevel:v,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Un(e._level,n)},a,g)}}}(e[Zp][r])}function SP(e,t,n,r,o){let{level:i,log:s=v=>v}=o.formatters||{},a=n.slice(),u=a[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),r&&(c.time=r),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 a[0]=="object";)Object.assign(c,a.shift());return[s(c),...a]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());u=a.length?Vb(a.shift(),a):void 0}else typeof u=="string"&&(u=Vb(a.shift(),a));return u!==void 0&&(c[o.messageKey]=u),[s(c)]}}function Jp(e,t,n,r){for(let o in e)if(r&&e[o]instanceof Error)e[o]=yn.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 n&&(e[o][i]=n[i](e[o][i]))}function bP(e,t,n,r=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,u=t.val,c=e._logEvent.bindings;r||Jp(n,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,u),e._logEvent=Xp(c)}function Xp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Bb(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let n in e)t[n]===void 0&&(t[n]=e[n]);return t}function AP(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Hb:Qb}function Eu(){return{}}function Kp(e){return e}function jo(){}function Hb(){return!1}function Qb(){return Date.now()}function wP(){return Math.round(Date.now()/1e3)}function CP(){return new Date(Date.now()).toISOString()}function EP(){function e(t){return typeof t<"u"&&t}try{return typeof C<"u"?C:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),C)}catch{return e(self)||e(window)||e(this)||{}}}xu.exports.default=yn;xu.exports.pino=yn;function $b(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
- `);for(let n=1;n<t.length;n++){let r=t[n].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(r)||r.indexOf("browser.js")!==-1||r.indexOf("node:internal")!==-1||r.indexOf("node_modules")!==-1)continue;let o=r.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=r.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var KP={};Zi(KP,{ResultTemplatesHelpers:()=>iy,buildCaseAssistEngine:()=>Jb,buildCaseField:()=>mA,buildCaseInput:()=>gA,buildController:()=>nn,buildDocumentSuggestion:()=>tf,buildDocumentSuggestionList:()=>tf,buildInteractiveResult:()=>yA,buildQuickview:()=>AA,getAnalyticsNextApiBaseUrl:()=>is,getOrganizationEndpoint:()=>it,loadCaseAssistAnalyticsActions:()=>HP,loadCaseFieldActions:()=>QP,loadCaseInputActions:()=>zP,loadDocumentSuggestionActions:()=>WP,loadGenericAnalyticsActions:()=>$P});module.exports=PA(KP);m();d();f();p();m();d();f();p();var Vf=Ft(Ff(),1);m();d();f();p();var xt=new Error("Failed to load reducers."),jr=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."}},Bn=class extends Error{constructor(n,r){super();se(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${n}`,this.statusCode=r??0}};m();d();f();p();function Df(e){return Array.isArray(e)}function Mf(e,t){return[...e.reduce((n,r)=>{let o=t(r);return n.has(o)||n.set(o,r),n},new Map).values()]}var xw=new Set(["1",1,"yes",!0]);function Zu(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(n=>xw.has(n))}function Lf(e){let t={};for(let[n,r]of e)t[n]=r;return t}function Wo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function os(e,t,n={}){let r;return(...o)=>{let i=n.isImmediate&&!r;if(clearTimeout(r),r=setTimeout(()=>{r=void 0,n.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}m();d();f();p();function jf(e){let t=[];for(let n in e){let r=encodeURIComponent(n),o=encodeURIComponent(e[n]);t.push(`${r}=${o}`)}return t.join("&")}function Uf(e){return typeof e!="object"||!e?!1:Object.values(e).every(Iw)}function Iw(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function qf(e){return e===429}var Sn=class e{static call(t){return _asyncToGenerator(function*(){let n=Rw(t),{logger:r}=t,o=yield e.preprocessRequest(n,t);r.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _a2=_asyncToGenerator(function*(){let u=yield E(i,s);if(qf(u.status))throw u;return u});function a(){return _a2.apply(this,arguments)}return a}();try{let u=yield(0,Vf.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _retry=_asyncToGenerator(function*(c){let g=c&&qf(c.status);return g&&(r.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 r.info("Platform renewing token"),new jr;case 404:throw new Bn(i,u.status);default:return r.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new Bn(i):u}})()}static preprocessRequest(t,n){return _asyncToGenerator(function*(){let{origin:r,preprocessRequest:o,logger:i,requestMetadata:s}=n,{signal:a,...u}=t,c=Wo(u);try{let g=yield o(t,r,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function it(e,t="prod",n="platform"){let r=t==="prod"?"":t,o=n==="platform"?"":`.${n}`;return`https://${e}${o}.org${r}.coveo.com`}function Ur(e,t,n="prod"){return e??it(t,n)}function qr(e,t="prod"){return`${it(e,t)}/rest/search/v2`}function is(e,t="prod"){return`${it(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Rw(e){let{url:t,method:n,requestParams:r,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",u=Tw(r,o);return{url:t,method:n,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:u}),signal:s}}function Tw(e,t){return t==="application/x-www-form-urlencoded"?Uf(e)?jf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();function kw(e,t){let n=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessCaseAssist",["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["CoveoHeadlessCaseAssist"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var XA=Object.create;var Zo=Object.defineProperty;var ZA=Object.getOwnPropertyDescriptor;var JA=Object.getOwnPropertyNames;var ew=Object.getPrototypeOf,tw=Object.prototype.hasOwnProperty;var nw=(e,t,n)=>t in e?Zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ur=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Xe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},ls=(e,t)=>{for(var n in t)Zo(e,n,{get:t[n],enumerable:!0})},Ep=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of JA(t))!tw.call(e,o)&&o!==n&&Zo(e,o,{get:()=>t[o],enumerable:!(r=ZA(t,o))||r.enumerable});return e};var Dt=(e,t,n)=>(n=e!=null?XA(ew(e)):{},Ep(t||!e||!e.__esModule?Zo(n,"default",{value:e,enumerable:!0}):n,e)),rw=e=>Ep(Zo({},"__esModule",{value:!0}),e);var ce=(e,t,n)=>nw(e,typeof t!="symbol"?t+"":t,n);var x,d=Ur(()=>{"use strict";x=typeof globalThis<"u"?globalThis:window});function ds(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ds=function(t){return typeof t}:ds=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ds(e)}function sw(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=aw.bind(this))}function aw(e,t){var n=this.event&&this.event.type,r=n==="unload"||n==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!r),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),ow(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):iw(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var ow,iw,f=Ur(()=>{"use strict";ow=function(t){return typeof t=="string"},iw=function(t){return t instanceof Blob};sw.call((typeof window>"u"?"undefined":ds(window))==="object"?window:{})});var Zu=Xe(Jo=>{"use strict";m();d();p();f();Object.defineProperty(Jo,"__esModule",{value:!0});function xp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function cw(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uw(e,t,n){return t=Vr(t),dw(e,kp()?Reflect.construct(t,n||[],Vr(e).constructor):t.apply(e,n))}function Ku(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ip(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,gw(r.key),r)}}function Yu(e,t,n){return t&&Ip(e.prototype,t),n&&Ip(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rp(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=hw(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){a=!0,i=u},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function zu(){return zu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=fw(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},zu.apply(null,arguments)}function Vr(e){return Vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vr(e)}function lw(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&&Wu(e,t)}function kp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kp=function(){return!!e})()}function dw(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 cw(e)}function Wu(e,t){return Wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Wu(e,t)}function fw(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Vr(e))!==null;);return e}function pw(e,t,n,r){var o=zu(Vr(1&r?e.prototype:e),t,n);return 2&r&&typeof o=="function"?function(i){return o.apply(n,i)}:o}function mw(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gw(e){var t=mw(e,"string");return typeof t=="symbol"?t:t+""}function hw(e,t){if(e){if(typeof e=="string")return xp(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function yw(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 vw(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 Tp=function(){function e(){Ku(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Yu(e,[{key:"addEventListener",value:function(n,r,o){n in this.listeners||(this.listeners[n]=[]),this.listeners[n].push({callback:r,options:o})}},{key:"removeEventListener",value:function(n,r){if(n in this.listeners){for(var o=this.listeners[n],i=0,s=o.length;i<s;i++)if(o[i].callback===r){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(n){var r=this;if(n.type in this.listeners){for(var o=this.listeners[n.type],i=o.slice(),s=function(){var g=i[a];try{g.callback.call(r,n)}catch(y){Promise.resolve().then(function(){throw y})}g.options&&g.options.once&&r.removeEventListener(n.type,g.callback)},a=0,u=i.length;a<u;a++)s();return!n.defaultPrevented}}}])}(),Xu=function(e){function t(){var n;return Ku(this,t),n=uw(this,t),n.listeners||Tp.call(n),Object.defineProperty(n,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(n,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(n,"reason",{value:void 0,writable:!0,configurable:!0}),n}return lw(t,e),Yu(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),pw(t,"dispatchEvent",this,3)([r])}},{key:"throwIfAborted",value:function(){var r=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(r)throw i}}],[{key:"timeout",value:function(r){var o=new fs;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(r,"ms"),"TimeoutError"))},r),o.signal}},{key:"any",value:function(r){var o=new fs;function i(){o.abort(this.reason),s()}function s(){var g=Rp(r),y;try{for(g.s();!(y=g.n()).done;){var E=y.value;E.removeEventListener("abort",i)}}catch(h){g.e(h)}finally{g.f()}}var a=Rp(r),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(c.aborted){o.abort(c.reason);break}else c.addEventListener("abort",i)}}catch(g){a.e(g)}finally{a.f()}return o.signal}}])}(Tp),fs=function(){function e(){Ku(this,e),Object.defineProperty(this,"signal",{value:new Xu,writable:!0,configurable:!0})}return Yu(e,[{key:"abort",value:function(n){var r=vw(n),o=yw(r);this.signal.reason=r,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(fs.prototype[Symbol.toStringTag]="AbortController",Xu.prototype[Symbol.toStringTag]="AbortSignal");function Sw(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 bw(e){typeof e=="function"&&(e={fetch:e});var t=e,n=t.fetch,r=t.Request,o=r===void 0?n.Request:r,i=t.AbortController,s=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,a=s===void 0?!1:s;if(!Sw({fetch:n,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:n,Request:u};var u=o;(u&&!u.prototype.hasOwnProperty("signal")||a)&&(u=function(E,h){var v;h&&h.signal&&(v=h.signal,delete h.signal);var A=new o(E,h);return v&&Object.defineProperty(A,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),A},u.prototype=o.prototype);var c=n,g=function(E,h){var v=u&&u.prototype.isPrototypeOf(E)?E.signal:h?h.signal:void 0;if(v){var A;try{A=new DOMException("Aborted","AbortError")}catch{A=new Error("Aborted"),A.name="AbortError"}if(v.aborted)return Promise.reject(A);var C=new Promise(function(w,k){v.addEventListener("abort",function(){return k(A)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([C,c(E,h)])}return c(E,h)};return{fetch:g,Request:u}}Jo.AbortController=fs;Jo.AbortSignal=Xu;Jo.abortableFetch=bw});var _p,l,I,p=Ur(()=>{"use strict";_p=Dt(Zu(),1),l=Dt(Zu(),1),{fetch:I}=(0,_p.abortableFetch)({fetch})});function Op(e){return typeof e!="string"||e in{}}function Ju(){return Object.create(null)}function Fp(e){return typeof e=="string"&&!!e.trim()}function el(e,t){var n=e.split(";"),r=n.shift();if(!Fp(r))return null;var o=Aw(r),i=o.name,s=o.value;if(t=t?Object.assign({},ps,t):ps,Op(i))return t.silent||console.warn("set-cookie-parser: dropping cookie due to name:",i),null;try{s=t.decodeValues?decodeURIComponent(s):s}catch(u){t.silent||console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",u)}var a=Ju();return a.name=i,a.value=s,n.forEach(function(u){var c=u.split("="),g=c.shift().trim().toLowerCase();if(Op(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 E=new Date(y);Number.isNaN(E.getTime())?t.silent||console.error("set-cookie-parser: failed to parse expires time:",y):a.expires=E}else g==="max-age"?/^-?\d+$/.test(y)?a.maxAge=parseInt(y,10):t.silent||console.error("set-cookie-parser: failed to parse max-age:",y):g==="secure"?a.secure=!0:g==="httponly"?a.httpOnly=!0:g==="samesite"?a.sameSite=y:g==="partitioned"?a.partitioned=!0:g&&(a[g]=y)}),a}function Aw(e){var t="",n="",r=e.split("=");return r.length>1?(t=r.shift(),n=r.join("=")):n=e,{name:Pp(t),value:Pp(n)}}function Pp(e){for(var t=0,n=e.length;t<n&&Np(e.charCodeAt(t));)t+=1;for(;n>t&&Np(e.charCodeAt(n-1));)n-=1;return e.substring(t,n)}function Np(e){return e===32||e===9}function Gr(e,t){if(t=t?Object.assign({},ps,t):ps,!e)return t.map?Ju():[];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 n=e.headers[Object.keys(e.headers).find(function(s){return s.toLowerCase()==="set-cookie"})];!n&&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=n}var r=t.split,o=Array.isArray(e);if(r==="auto"&&(r=!o),o||(e=[e]),e=e.filter(Fp),r&&(e=e.map(ms).flat()),t.map){var i=Ju();return e.reduce(function(s,a){var u=el(a,t);return u&&(s[u.name]=u),s},i)}else return e.map(function(s){return el(s,t)}).filter(Boolean)}function ms(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],n=0,r,o,i,s,a;function u(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function c(){return o=e.charAt(n),o!=="="&&o!==";"&&o!==","}for(;n<e.length;){for(r=n,a=!1;u();)if(o=e.charAt(n),o===","){for(i=n,n+=1,u(),s=n;n<e.length&&c();)n+=1;n<e.length&&e.charAt(n)==="="?(a=!0,n=s,t.push(e.substring(r,i)),r=n):n=i+1}else n+=1;(!a||n>=e.length)&&t.push(e.substring(r,e.length))}return t}var ps,Dp=Ur(()=>{"use strict";m();d();p();f();ps={decodeValues:!0,map:!1,silent:!1,split:"auto"};Gr.parseSetCookie=Gr;Gr.parse=Gr;Gr.parseString=el;Gr.splitCookiesString=ms});function ei(e){if(ww.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function tl(e){return e.replace(Cw,"")}function ti(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>127||!Ew(n))return!1}return!0}function Ew(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Lp(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n===0||n===10||n===13)return!1}return!0}var ww,Mp,Cw,jp,Br,nl,qp,R,Vp=Ur(()=>{"use strict";m();d();p();f();Dp();ww=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Mp=[`
19
+ `,"\r","\t"," "],Cw=new RegExp(`(^[${Mp.join("")}]|$[${Mp.join("")}])`,"g");Br=Symbol("normalizedHeaders"),nl=Symbol("rawHeaderNames"),qp=", ",R=class Up{constructor(t){this[Br]={},this[nl]=new Map,this[jp]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Up||typeof x.Headers<"u"&&t instanceof x.Headers?t.forEach((n,r)=>{this.append(r,n)},this):Array.isArray(t)?t.forEach(([n,r])=>{this.append(n,Array.isArray(r)?r.join(qp):r)}):t&&Object.getOwnPropertyNames(t).forEach(n=>{let r=t[n];this.append(n,Array.isArray(r)?r.join(qp):r)})}[(jp=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[Br]).sort((n,r)=>n.localeCompare(r));for(let n of t)if(n==="set-cookie")for(let r of this.getSetCookie())yield[n,r];else yield[n,this.get(n)]}has(t){if(!ti(t))throw new TypeError(`Invalid header name "${t}"`);return this[Br].hasOwnProperty(ei(t))}get(t){if(!ti(t))throw TypeError(`Invalid header name "${t}"`);return this[Br][ei(t)]??null}set(t,n){if(!ti(t)||!Lp(n))return;let r=ei(t),o=tl(n);this[Br][r]=tl(o),this[nl].set(r,t)}append(t,n){if(!ti(t)||!Lp(n))return;let r=ei(t),o=tl(n),i=this.has(r)?`${this.get(r)}, ${o}`:o;this.set(t,i)}delete(t){if(!ti(t)||!this.has(t))return;let n=ei(t);delete this[Br][n],this[nl].delete(n)}forEach(t,n){for(let[r,o]of this.entries())t.call(n,o,r,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:ms(t)}}});var m=Ur(()=>{"use strict";Vp()});var Gp=Xe(ni=>{"use strict";m();d();p();f();var gs=ni&&ni.__assign||function(){return gs=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},gs.apply(this,arguments)};Object.defineProperty(ni,"__esModule",{value:!0});var xw={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Iw(e){var t=gs(gs({},xw),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ni.getSanitizedOptions=Iw});var Bp=Xe(rl=>{"use strict";m();d();p();f();Object.defineProperty(rl,"__esModule",{value:!0});function Rw(e){var t=Math.random()*e;return Math.round(t)}rl.fullJitter=Rw});var $p=Xe(ol=>{"use strict";m();d();p();f();Object.defineProperty(ol,"__esModule",{value:!0});function Tw(e){return e}ol.noJitter=Tw});var Hp=Xe(il=>{"use strict";m();d();p();f();Object.defineProperty(il,"__esModule",{value:!0});var kw=Bp(),_w=$p();function Ow(e){return e.jitter==="full"?kw.fullJitter:_w.noJitter}il.JitterFactory=Ow});var al=Xe(sl=>{"use strict";m();d();p();f();Object.defineProperty(sl,"__esModule",{value:!0});var Pw=Hp(),Nw=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(n){return setTimeout(n,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=Pw.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,n=this.options.timeMultiple,r=this.numOfDelayedAttempts,o=t*Math.pow(n,r);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}();sl.Delay=Nw});var Qp=Xe(an=>{"use strict";m();d();p();f();var Fw=an&&an.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dw=an&&an.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(y){s(y)}}function u(g){try{c(r.throw(g))}catch(y){s(y)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})},Mw=an&&an.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=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 Lw=al(),jw=function(e){Fw(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return Dw(this,void 0,void 0,function(){return Mw(this,function(n){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}(Lw.Delay);an.SkipFirstDelay=jw});var zp=Xe(ri=>{"use strict";m();d();p();f();var qw=ri&&ri.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(ri,"__esModule",{value:!0});var Uw=al(),Vw=function(e){qw(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Uw.Delay);ri.AlwaysDelay=Vw});var Wp=Xe(cl=>{"use strict";m();d();p();f();Object.defineProperty(cl,"__esModule",{value:!0});var Gw=Qp(),Bw=zp();function $w(e,t){var n=Hw(e);return n.setAttemptNumber(t),n}cl.DelayFactory=$w;function Hw(e){return e.delayFirstAttempt?new Bw.AlwaysDelay(e):new Gw.SkipFirstDelay(e)}});var Kp=Xe(zn=>{"use strict";m();d();p();f();var ul=zn&&zn.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(y){s(y)}}function u(g){try{c(r.throw(g))}catch(y){s(y)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})},ll=zn&&zn.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(zn,"__esModule",{value:!0});var Qw=Gp(),zw=Wp();function Ww(e,t){return t===void 0&&(t={}),ul(this,void 0,void 0,function(){var n,r;return ll(this,function(o){switch(o.label){case 0:return n=Qw.getSanitizedOptions(t),r=new Kw(e,n),[4,r.execute()];case 1:return[2,o.sent()]}})})}zn.backOff=Ww;var Kw=function(){function e(t,n){this.request=t,this.options=n,this.attemptNumber=0}return e.prototype.execute=function(){return ul(this,void 0,void 0,function(){var t,n;return ll(this,function(r){switch(r.label){case 0:if(this.attemptLimitReached)return[3,7];r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return r.sent(),[4,this.request()];case 3:return[2,r.sent()];case 4:return t=r.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(n=r.sent(),!n||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 ul(this,void 0,void 0,function(){var t;return ll(this,function(n){switch(n.label){case 0:return t=zw.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return n.sent(),[2]}})})},e}()});var Va=Xe((Gd,Bd)=>{"use strict";m();d();p();f();(function(e,t){typeof Gd=="object"&&typeof Bd<"u"?Bd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof x<"u"?x:e||self).dayjs=t()})(Gd,function(){"use strict";var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",s="hour",a="day",u="week",c="month",g="quarter",y="year",E="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+)?$/,A=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(q){var L=["th","st","nd","rd"],V=q%100;return"["+q+(L[(V-20)%10]||L[V]||L[0])+"]"}},w=function(q,L,V){var j=String(q);return!j||j.length>=L?q:""+Array(L+1-j.length).join(V)+q},k={s:w,z:function(q){var L=-q.utcOffset(),V=Math.abs(L),j=Math.floor(V/60),U=V%60;return(L<=0?"+":"-")+w(j,2,"0")+":"+w(U,2,"0")},m:function q(L,V){if(L.date()<V.date())return-q(V,L);var j=12*(V.year()-L.year())+(V.month()-L.month()),U=L.clone().add(j,c),Q=V-U<0,z=L.clone().add(j+(Q?-1:1),c);return+(-(j+(V-U)/(Q?U-z:z-U))||0)},a:function(q){return q<0?Math.ceil(q)||0:Math.floor(q)},p:function(q){return{M:c,y,w:u,d:a,D:E,h:s,m:i,s:o,ms:r,Q:g}[q]||String(q||"").toLowerCase().replace(/s$/,"")},u:function(q){return q===void 0}},O="en",F={};F[O]=C;var b="$isDayjsObject",T=function(q){return q instanceof M||!(!q||!q[b])},_=function q(L,V,j){var U;if(!L)return O;if(typeof L=="string"){var Q=L.toLowerCase();F[Q]&&(U=Q),V&&(F[Q]=V,U=Q);var z=L.split("-");if(!U&&z.length>1)return q(z[0])}else{var X=L.name;F[X]=L,U=X}return!j&&U&&(O=U),U||!j&&O},P=function(q,L){if(T(q))return q.clone();var V=typeof L=="object"?L:{};return V.date=q,V.args=arguments,new M(V)},N=k;N.l=_,N.i=T,N.w=function(q,L){return P(q,{locale:L.$L,utc:L.$u,x:L.$x,$offset:L.$offset})};var M=function(){function q(V){this.$L=_(V.locale,null,!0),this.parse(V),this.$x=this.$x||V.x||{},this[b]=!0}var L=q.prototype;return L.parse=function(V){this.$d=function(j){var U=j.date,Q=j.utc;if(U===null)return new Date(NaN);if(N.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var z=U.match(v);if(z){var X=z[2]-1||0,re=(z[7]||"0").substring(0,3);return Q?new Date(Date.UTC(z[1],X,z[3]||1,z[4]||0,z[5]||0,z[6]||0,re)):new Date(z[1],X,z[3]||1,z[4]||0,z[5]||0,z[6]||0,re)}}return new Date(U)}(V),this.init()},L.init=function(){var V=this.$d;this.$y=V.getFullYear(),this.$M=V.getMonth(),this.$D=V.getDate(),this.$W=V.getDay(),this.$H=V.getHours(),this.$m=V.getMinutes(),this.$s=V.getSeconds(),this.$ms=V.getMilliseconds()},L.$utils=function(){return N},L.isValid=function(){return this.$d.toString()!==h},L.isSame=function(V,j){var U=P(V);return this.startOf(j)<=U&&U<=this.endOf(j)},L.isAfter=function(V,j){return P(V)<this.startOf(j)},L.isBefore=function(V,j){return this.endOf(j)<P(V)},L.$g=function(V,j,U){return N.u(V)?this[j]:this.set(U,V)},L.unix=function(){return Math.floor(this.valueOf()/1e3)},L.valueOf=function(){return this.$d.getTime()},L.startOf=function(V,j){var U=this,Q=!!N.u(j)||j,z=N.p(V),X=function(De,ye){var he=N.w(U.$u?Date.UTC(U.$y,ye,De):new Date(U.$y,ye,De),U);return Q?he:he.endOf(a)},re=function(De,ye){return N.w(U.toDate()[De].apply(U.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice(ye)),U)},oe=this.$W,ae=this.$M,Ie=this.$D,Pe="set"+(this.$u?"UTC":"");switch(z){case y:return Q?X(1,0):X(31,11);case c:return Q?X(1,ae):X(0,ae+1);case u:var xe=this.$locale().weekStart||0,He=(oe<xe?oe+7:oe)-xe;return X(Q?Ie-He:Ie+(6-He),ae);case a:case E:return re(Pe+"Hours",0);case s:return re(Pe+"Minutes",1);case i:return re(Pe+"Seconds",2);case o:return re(Pe+"Milliseconds",3);default:return this.clone()}},L.endOf=function(V){return this.startOf(V,!1)},L.$set=function(V,j){var U,Q=N.p(V),z="set"+(this.$u?"UTC":""),X=(U={},U[a]=z+"Date",U[E]=z+"Date",U[c]=z+"Month",U[y]=z+"FullYear",U[s]=z+"Hours",U[i]=z+"Minutes",U[o]=z+"Seconds",U[r]=z+"Milliseconds",U)[Q],re=Q===a?this.$D+(j-this.$W):j;if(Q===c||Q===y){var oe=this.clone().set(E,1);oe.$d[X](re),oe.init(),this.$d=oe.set(E,Math.min(this.$D,oe.daysInMonth())).$d}else X&&this.$d[X](re);return this.init(),this},L.set=function(V,j){return this.clone().$set(V,j)},L.get=function(V){return this[N.p(V)]()},L.add=function(V,j){var U,Q=this;V=Number(V);var z=N.p(j),X=function(ae){var Ie=P(Q);return N.w(Ie.date(Ie.date()+Math.round(ae*V)),Q)};if(z===c)return this.set(c,this.$M+V);if(z===y)return this.set(y,this.$y+V);if(z===a)return X(1);if(z===u)return X(7);var re=(U={},U[i]=t,U[s]=n,U[o]=e,U)[z]||1,oe=this.$d.getTime()+V*re;return N.w(oe,this)},L.subtract=function(V,j){return this.add(-1*V,j)},L.format=function(V){var j=this,U=this.$locale();if(!this.isValid())return U.invalidDate||h;var Q=V||"YYYY-MM-DDTHH:mm:ssZ",z=N.z(this),X=this.$H,re=this.$m,oe=this.$M,ae=U.weekdays,Ie=U.months,Pe=U.meridiem,xe=function(ye,he,we,$e){return ye&&(ye[he]||ye(j,Q))||we[he].slice(0,$e)},He=function(ye){return N.s(X%12||12,ye,"0")},De=Pe||function(ye,he,we){var $e=ye<12?"AM":"PM";return we?$e.toLowerCase():$e};return Q.replace(A,function(ye,he){return he||function(we){switch(we){case"YY":return String(j.$y).slice(-2);case"YYYY":return N.s(j.$y,4,"0");case"M":return oe+1;case"MM":return N.s(oe+1,2,"0");case"MMM":return xe(U.monthsShort,oe,Ie,3);case"MMMM":return xe(Ie,oe);case"D":return j.$D;case"DD":return N.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return xe(U.weekdaysMin,j.$W,ae,2);case"ddd":return xe(U.weekdaysShort,j.$W,ae,3);case"dddd":return ae[j.$W];case"H":return String(X);case"HH":return N.s(X,2,"0");case"h":return He(1);case"hh":return He(2);case"a":return De(X,re,!0);case"A":return De(X,re,!1);case"m":return String(re);case"mm":return N.s(re,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 z}return null}(ye)||z.replace(":","")})},L.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},L.diff=function(V,j,U){var Q,z=this,X=N.p(j),re=P(V),oe=(re.utcOffset()-this.utcOffset())*t,ae=this-re,Ie=function(){return N.m(z,re)};switch(X){case y:Q=Ie()/12;break;case c:Q=Ie();break;case g:Q=Ie()/3;break;case u:Q=(ae-oe)/6048e5;break;case a:Q=(ae-oe)/864e5;break;case s:Q=ae/n;break;case i:Q=ae/t;break;case o:Q=ae/e;break;default:Q=ae}return U?Q:N.a(Q)},L.daysInMonth=function(){return this.endOf(c).$D},L.$locale=function(){return F[this.$L]},L.locale=function(V,j){if(!V)return this.$L;var U=this.clone(),Q=_(V,j,!0);return Q&&(U.$L=Q),U},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()},q}(),B=M.prototype;return P.prototype=B,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",y],["$D",E]].forEach(function(q){B[q[1]]=function(L){return this.$g(L,q[0],q[1])}}),P.extend=function(q,L){return q.$i||(q(L,M,P),q.$i=!0),P},P.locale=_,P.isDayjs=T,P.unix=function(q){return P(1e3*q)},P.en=F[O],P.Ls=F,P.p={},P})});var cy=Xe(($d,Hd)=>{"use strict";m();d();p();f();(function(e,t){typeof $d=="object"&&typeof Hd<"u"?Hd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof x<"u"?x:e||self).dayjs_plugin_quarterOfYear=t()})($d,function(){"use strict";var e="month",t="quarter";return function(n,r){var o=r.prototype;o.quarter=function(a){return this.$utils().u(a)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(a-1))};var i=o.add;o.add=function(a,u){return a=Number(a),this.$utils().p(u)===t?this.add(3*a,e):i.bind(this)(a,u)};var s=o.startOf;o.startOf=function(a,u){var c=this.$utils(),g=!!c.u(u)||u;if(c.p(a)===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 s.bind(this)(a,u)}}})});var uy=Xe((Qd,zd)=>{"use strict";m();d();p();f();(function(e,t){typeof Qd=="object"&&typeof zd<"u"?zd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof x<"u"?x:e||self).dayjs_plugin_customParseFormat=t()})(Qd,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,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(A){this[v]=+A}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=function(A){if(!A||A==="Z")return 0;var C=A.match(/([+-]|\d\d)/g),w=60*C[1]+(+C[2]||0);return w===0?0:C[0]==="+"?-w:w}(v)}],g=function(v){var A=s[v];return A&&(A.indexOf?A:A.s.concat(A.f))},y=function(v,A){var C,w=s.meridiem;if(w){for(var k=1;k<=24;k+=1)if(v.indexOf(w(k,0,A))>-1){C=k>12;break}}else C=v===(A?"pm":"PM");return C},E={A:[i,function(v){this.afternoon=y(v,!1)}],a:[i,function(v){this.afternoon=y(v,!0)}],Q:[n,function(v){this.month=3*(v-1)+1}],S:[n,function(v){this.milliseconds=100*+v}],SS:[r,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:[r,u("day")],Do:[i,function(v){var A=s.ordinal,C=v.match(/\d+/);if(this.day=C[0],A)for(var w=1;w<=31;w+=1)A(w).replace(/\[|\]/g,"")===v&&(this.day=w)}],w:[o,u("week")],ww:[r,u("week")],M:[o,u("month")],MM:[r,u("month")],MMM:[i,function(v){var A=g("months"),C=(g("monthsShort")||A.map(function(w){return w.slice(0,3)})).indexOf(v)+1;if(C<1)throw new Error;this.month=C%12||C}],MMMM:[i,function(v){var A=g("months").indexOf(v)+1;if(A<1)throw new Error;this.month=A%12||A}],Y:[/[+-]?\d+/,u("year")],YY:[r,function(v){this.year=a(v)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function h(v){var A,C;A=v,C=s&&s.formats;for(var w=(v=A.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(P,N,M){var B=M&&M.toUpperCase();return N||C[M]||e[M]||C[B].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(q,L,V){return L||V.slice(1)})})).match(t),k=w.length,O=0;O<k;O+=1){var F=w[O],b=E[F],T=b&&b[0],_=b&&b[1];w[O]=_?{regex:T,parser:_}:F.replace(/^\[|\]$/g,"")}return function(P){for(var N={},M=0,B=0;M<k;M+=1){var q=w[M];if(typeof q=="string")B+=q.length;else{var L=q.regex,V=q.parser,j=P.slice(B),U=L.exec(j)[0];V.call(N,U),P=P.replace(U,"")}}return function(Q){var z=Q.afternoon;if(z!==void 0){var X=Q.hours;z?X<12&&(Q.hours+=12):X===12&&(Q.hours=0),delete Q.afternoon}}(N),N}}return function(v,A,C){C.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(a=v.parseTwoDigitYear);var w=A.prototype,k=w.parse;w.parse=function(O){var F=O.date,b=O.utc,T=O.args;this.$u=b;var _=T[1];if(typeof _=="string"){var P=T[2]===!0,N=T[3]===!0,M=P||N,B=T[2];N&&(B=T[2]),s=this.$locale(),!P&&B&&(s=C.Ls[B]),this.$d=function(j,U,Q,z){try{if(["x","X"].indexOf(U)>-1)return new Date((U==="X"?1e3:1)*j);var X=h(U)(j),re=X.year,oe=X.month,ae=X.day,Ie=X.hours,Pe=X.minutes,xe=X.seconds,He=X.milliseconds,De=X.zone,ye=X.week,he=new Date,we=ae||(re||oe?1:he.getDate()),$e=re||he.getFullYear(),Ue=0;re&&!oe||(Ue=oe>0?oe-1:he.getMonth());var pt,Bt=Ie||0,Fe=Pe||0,Oe=xe||0,It=He||0;return De?new Date(Date.UTC($e,Ue,we,Bt,Fe,Oe,It+60*De.offset*1e3)):Q?new Date(Date.UTC($e,Ue,we,Bt,Fe,Oe,It)):(pt=new Date($e,Ue,we,Bt,Fe,Oe,It),ye&&(pt=z(pt).week(ye).toDate()),pt)}catch{return new Date("")}}(F,_,b,C),this.init(),B&&B!==!0&&(this.$L=this.locale(B).$L),M&&F!=this.format(_)&&(this.$d=new Date("")),s={}}else if(_ instanceof Array)for(var q=_.length,L=1;L<=q;L+=1){T[1]=_[L-1];var V=C.apply(this,T);if(V.isValid()){this.$d=V.$d,this.$L=V.$L,this.init();break}L===q&&(this.$d=new Date(""))}else k.call(this,O)}}})});var tv=Xe((uf,lf)=>{"use strict";m();d();p();f();(function(e,t){typeof uf=="object"&&typeof lf<"u"?lf.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof x<"u"?x:e||self).dayjs_plugin_timezone=t()})(uf,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,r,o){var i,s=function(g,y,E){E===void 0&&(E={});var h=new Date(g),v=function(A,C){C===void 0&&(C={});var w=C.timeZoneName||"short",k=A+"|"+w,O=t[k];return O||(O=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:A,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:w}),t[k]=O),O}(y,E);return v.formatToParts(h)},a=function(g,y){for(var E=s(g,y),h=[],v=0;v<E.length;v+=1){var A=E[v],C=A.type,w=A.value,k=e[C];k>=0&&(h[k]=parseInt(w,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=r.prototype;u.tz=function(g,y){if(g===void 0&&(g=i),!this.isValid())return this;var E,h=this.utcOffset(),v=this.toDate(),A=v.toLocaleString("en-US",{timeZone:g}),C=a(+v,g);if(!Number(C))E=this.utcOffset(0,y);else if(E=o(A,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),y){var w=E.utcOffset();E=E.add(h-w,"minute")}return E.$x.$timezone=g,E},u.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),E=s(this.valueOf(),y,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return E&&E.value};var c=u.startOf;u.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return c.call(this,g,y);var E=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(E,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,E){var h=E&&y,v=E||y||i,A=a(+o(),v);if(typeof g!="string")return o(g).tz(v);var C=o.utc(g,h).valueOf();if(Number.isNaN(C)){var w=o(NaN);return w.$x.$timezone=v,w}var k=function(T,_,P){var N=T-60*_*1e3,M=a(N,P);if(_===M)return[N,_];var B=a(N-=60*(M-_)*1e3,P);return M===B?[N,M]:[T-60*Math.min(M,B)*1e3,Math.max(M,B)]}(C,A,v),O=k[0],F=k[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 nv=Xe((df,ff)=>{"use strict";m();d();p();f();(function(e,t){typeof df=="object"&&typeof ff<"u"?ff.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof x<"u"?x:e||self).dayjs_plugin_utc=t()})(df,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,o,i){var s=o.prototype;i.utc=function(h){var v={date:h,utc:!0,args:arguments};return new o(v)},s.utc=function(h){var v=i(this.toDate(),{locale:this.$L,utc:!0});return h?v.add(this.utcOffset(),e):v},s.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var a=s.parse;s.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),a.call(this,h)};var u=s.init;s.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=s.utcOffset;s.utcOffset=function(h,v){var A=this.$utils().u;if(A(h))return this.$u?0:A(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(n)||["-",0,0],T=b[0],_=60*+b[1]+ +b[2];return _===0?0:T==="+"?_:-_}(h),h===null))return this;var C=Math.abs(h)<=16?60*h:h;if(C===0)return this.utc(v);var w=this.clone();if(v)return w.$offset=C,w.$u=!1,w;var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(w=this.local().add(C+k,e)).$offset=C,w.$x.$localOffset=k,w};var g=s.format;s.format=function(h){var v=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,v)},s.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var y=s.toDate;s.toDate=function(h){return h==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var E=s.diff;s.diff=function(h,v,A){if(h&&this.$u===h.$u)return E.call(this,h,v,A);var C=this.local(),w=i(h).local();return E.call(C,w,v,A)}}})});var oA=Xe((Aue,rA)=>{"use strict";m();d();p();f();function MP(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}rA.exports=LP;function LP(e,t,n){var r=n&&n.stringify||MP,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=r(e);for(var a=1;a<i;a++)s[a]=r(t[a]);return s.join(" ")}if(typeof e!="string")return e;var u=t.length;if(u===0)return e;for(var c="",g=1-o,y=-1,E=e&&e.length||0,h=0;h<E;){if(e.charCodeAt(h)===37&&h+1<E){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+=r(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<E&&(c+=e.slice(y)),c)}});var lA=Xe((Iue,uA)=>{"use strict";m();d();p();f();function up(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 n=0;n<e.length;n++)t[n]=up(e[n]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=up(e[n]));return t}return e}function iA(e){let t=[],n="",r=!1,o=!1,i="";for(let s=0;s<e.length;s++){let a=e[s];!r&&a==="."?n&&(t.push(n),n=""):a==="["?(n&&(t.push(n),n=""),r=!0):a==="]"&&r?(t.push(n),n="",r=!1,o=!1):(a==="\""||a==="'")&&r?o?a===i?(o=!1,i=""):n+=a:(o=!0,i=a):n+=a}return n&&t.push(n),t}function sA(e,t,n){let r=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof r!="object"||r===null||!(s in r)||typeof r[s]!="object"||r[s]===null)return!1;r=r[s]}let o=t[t.length-1];if(o==="*"){if(Array.isArray(r))for(let i=0;i<r.length;i++)r[i]=n;else if(typeof r=="object"&&r!==null)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n)}else typeof r=="object"&&r!==null&&o in r&&Object.prototype.hasOwnProperty.call(r,o)&&(r[o]=n);return!0}function aA(e,t){let n=e;for(let o=0;o<t.length-1;o++){let i=t[o];if(typeof n!="object"||n===null||!(i in n)||typeof n[i]!="object"||n[i]===null)return!1;n=n[i]}let r=t[t.length-1];if(r==="*"){if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o]=void 0;else if(typeof n=="object"&&n!==null)for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&delete n[o]}else typeof n=="object"&&n!==null&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}var Lu=Symbol("PATH_NOT_FOUND");function jP(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object"||n===null||!(r in n))return Lu;n=n[r]}return n}function qP(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object"||n===null)return;n=n[r]}return n}function UP(e,t,n,r=!1){for(let o of t){let i=iA(o);if(i.includes("*"))cA(e,i,n,o,r);else if(r)aA(e,i);else{let s=jP(e,i);if(s===Lu)continue;let a=typeof n=="function"?n(s,i):n;sA(e,i,a)}}}function cA(e,t,n,r,o=!1){let i=t.indexOf("*");if(i===t.length-1){let s=t.slice(0,-1),a=e;for(let u of s){if(a==null||typeof a!="object"||a===null)return;a=a[u]}if(Array.isArray(a)){if(o)for(let u=0;u<a.length;u++)a[u]=void 0;else for(let u=0;u<a.length;u++){let c=[...s,u.toString()],g=typeof n=="function"?n(a[u],c):n;a[u]=g}}else if(typeof a=="object"&&a!==null)if(o){let u=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&u.push(c);for(let c of u)delete a[c]}else for(let u in a){let c=[...s,u],g=typeof n=="function"?n(a[u],c):n;a[u]=g}}else VP(e,t,n,i,r,o)}function VP(e,t,n,r,o,i=!1){let s=t.slice(0,r),a=t.slice(r+1),u=[];function c(g,y){if(y===s.length){if(Array.isArray(g))for(let E=0;E<g.length;E++)u[y]=E.toString(),c(g[E],y+1);else if(typeof g=="object"&&g!==null)for(let E in g)u[y]=E,c(g[E],y+1)}else if(y<s.length){let E=s[y];g&&typeof g=="object"&&g!==null&&E in g&&(u[y]=E,c(g[E],y+1))}else if(a.includes("*"))cA(g,a,typeof n=="function"?(h,v)=>{let A=[...u.slice(0,y),...v];return n(h,A)}:n,o,i);else if(i)aA(g,a);else{let E=typeof n=="function"?n(qP(g,a),[...u.slice(0,y),...a]):n;sA(g,a,E)}}if(s.length===0)c(e,0);else{let g=e;for(let y=0;y<s.length;y++){let E=s[y];if(g==null||typeof g!="object"||g===null)return;g=g[E],u[y]=E}g!=null&&c(g,s.length)}}function GP(e){if(e.length===0)return null;let t=new Map;for(let n of e){let r=iA(n),o=t;for(let i=0;i<r.length;i++){let s=r[i];o.has(s)||o.set(s,new Map),o=o.get(s)}}return t}function BP(e,t){if(!t)return e;function n(r,o,i=0){if(!o||o.size===0||r===null||typeof r!="object")return r;if(r instanceof Date)return new Date(r.getTime());if(Array.isArray(r)){let a=[];for(let u=0;u<r.length;u++){let c=u.toString();o.has(c)||o.has("*")?a[u]=n(r[u],o.get(c)||o.get("*")):a[u]=r[u]}return a}let s=Object.create(Object.getPrototypeOf(r));for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o.has(a)||o.has("*")?s[a]=n(r[a],o.get(a)||o.get("*")):s[a]=r[a]);return s}return n(e,t)}function $P(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,n=!1,r="";for(let o=0;o<e.length;o++){let i=e[o];if((i==="\""||i==="'")&&t>0)n?i===r&&(n=!1,r=""):(n=!0,r=i);else if(i==="["&&!n)t++;else if(i==="]"&&!n&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function HP(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)$P(t)}function QP(e={}){let{paths:t=[],censor:n="[REDACTED]",serialize:r=JSON.stringify,strict:o=!0,remove:i=!1}=e;HP(t);let s=GP(t);return function(u){if(o&&(u===null||typeof u!="object")&&(u==null||typeof u!="object"))return r?r(u):u;let c=BP(u,s),g=u,y=n;return typeof n=="function"&&(y=n),UP(c,t,y,i),r===!1?(c.restore=function(){return up(g)},c):typeof r=="function"?r(c):JSON.stringify(c)}}uA.exports=QP});var vA=Xe((Oue,qu)=>{"use strict";m();d();p();f();var dA=oA(),zP=lA();qu.exports=Sn;var fA="[Redacted]";function WP(e){if(Array.isArray(e))return{paths:e,censor:fA};let{paths:t,censor:n=fA,remove:r}=e;if(!Array.isArray(t))throw Error("pino – redact must contain an array of strings");return{paths:t,censor:r?void 0:n,remove:r}}function KP(e){if(!e)return null;let{paths:t,censor:n,remove:r}=WP(e);return zP({paths:t,censor:n,remove:r,serialize:!1})}var cs=lN().console||{},YP={mapHttpRequest:ju,mapHttpResponse:ju,wrapRequestSerializer:lp,wrapResponseSerializer:lp,wrapErrorSerializer:lp,req:ju,res:ju,err:mA,errWithCause:mA};function Gn(e,t){return e==="silent"?1/0:t.levels.values[e]}var pp=Symbol("pino.logFuncs"),dp=Symbol("pino.hierarchy"),jr=Symbol("pino.ownBindings"),Qo=Symbol("pino.bindings"),XP={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function pA(e,t){let n={logger:t,parent:e[dp]};t[dp]=n}function ZP(e,t,n){let r={};t.forEach(o=>{r[o]=n[o]?n[o]:cs[o]||cs[XP[o]||"log"]||zo}),e[pp]=r}function JP(e,t){return Array.isArray(e)?e.filter(function(r){return r!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Sn(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 n=e.browser.write||cs;e.browser.write&&(e.browser.asObject=!0);let r=e.serializers||{},o=JP(e.browser.serialize,r),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);typeof n=="function"&&a.forEach(function(C){n[C]=n}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let u=e.level||"info",c=Object.create(n);c.log||(c.log=zo),ZP(c,a,n),pA({},c),c[Qo]={},Object.defineProperty(c,"levelVal",{get:E}),Object.defineProperty(c,"level",{get:h,set:v});let g=KP(e.redact),y={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:a,timestamp:aN(e),messageKey:e.messageKey||"msg",onChild:e.onChild||zo,redactFn:g};c.levels=eN(e),c.level=u,c.isLevelEnabled=function(C){return this.levels.values[C]?this.levels.values[C]>=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=zo,c.serializers=r,c._serialize=o,c._stdErrSerialize=i,c.child=function(...C){return A.call(this,y,...C)},c.bindings=function(){return Object.assign({},this[Qo])},c.setBindings=function(C){this[jr]=Object.assign({},this[jr],C),this[Qo]=Object.assign({},this[Qo],C),this._logEvent&&this._logEvent.bindings.push(C),this.level=this._level},t&&(c._logEvent=fp());function E(){return Gn(this.level,this)}function h(){return this._level}function v(C){if(C!=="silent"&&!this.levels.values[C])throw Error("unknown level "+C);this._level=C,Lr(this,y,c,"error"),Lr(this,y,c,"fatal"),Lr(this,y,c,"warn"),Lr(this,y,c,"info"),Lr(this,y,c,"debug"),Lr(this,y,c,"trace"),s.forEach(w=>{Lr(this,y,c,w)})}function A(C,w,k){if(!w)throw new Error("missing bindings for child Pino");k=k||{},o&&w.serializers&&(k.serializers=w.serializers);let O=k.serializers;if(o&&O){var F=Object.assign({},r,O),b=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,mp([w],b,F,this._stdErrSerialize)}function T(P){this._childLevel=(P._childLevel|0)+1,this[jr]=w,this[Qo]=Object.assign({},P[Qo],w),F&&(this.serializers=F,this._serialize=b),t&&(this._logEvent=fp([].concat(P._logEvent.bindings,w)))}T.prototype=this;let _=new T(this);return pA(this,_),_.child=function(...P){return A.call(this,C,...P)},_.level=k.level||this.level,C.onChild(_),_}return c}function eN(e){let t=e.customLevels||{},n=Object.assign({},Sn.levels.values,t),r=Object.assign({},Sn.levels.labels,tN(t));return{values:n,labels:r}}function tN(e){let t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}Sn.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"}};Sn.stdSerializers=YP;Sn.stdTimeFunctions=Object.assign({},{nullTime:hA,epochTime:yA,unixTime:cN,isoTime:uN});function nN(e){let t=[];e[jr]&&t.push(e[jr]);let n=e[dp];for(;n.parent;)n=n.parent,n.logger[jr]&&t.push(n.logger[jr]);return t.reverse()}function Lr(e,t,n,r){if(Object.defineProperty(e,r,{value:Gn(e.level,n)>Gn(r,n)?zo:n[pp][r],writable:!0,enumerable:!0,configurable:!0}),e[r]===zo){if(!t.transmit)return;let i=t.transmit.level||e.level,s=Gn(i,n);if(Gn(r,n)<s)return}e[r]=oN(e,t,n,r);let o=nN(e);o.length!==0&&(e[r]=rN(o,e[r]))}function rN(e,t){return function(){return t.apply(this,[...e,...arguments])}}function oN(e,t,n,r){return function(o){return function(){let s=t.timestamp(),a=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===cs?cs:this;for(var c=0;c<a.length;c++)a[c]=arguments[c];var g=!1;if(t.serialize&&(mp(a,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=iN(this,r,a,s,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let E=gA();E&&(y[0].caller=E)}catch{}o.call(u,...y)}else{if(t.reportCaller)try{let y=gA();y&&a.push(y)}catch{}o.apply(u,a)}if(t.transmit){let y=t.transmit.level||e._level,E=Gn(y,n),h=Gn(r,n);if(h<E)return;sN(this,{ts:s,methodLevel:r,methodValue:h,transmitLevel:y,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Gn(e._level,n)},a,g)}}}(e[pp][r])}function iN(e,t,n,r,o){let{level:i,log:s=y=>y}=o.formatters||{},a=n.slice(),u=a[0],c={},g=(e._childLevel|0)+1;if(g<1&&(g=1),r&&(c.time=r),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 a[0]=="object";)Object.assign(c,a.shift());let y=s(c);return o.redactFn&&(y=o.redactFn(y)),[y,...a]}else{if(u!==null&&typeof u=="object"){for(;g--&&typeof a[0]=="object";)Object.assign(c,a.shift());u=a.length?dA(a.shift(),a):void 0}else typeof u=="string"&&(u=dA(a.shift(),a));u!==void 0&&(c[o.messageKey]=u);let y=s(c);return o.redactFn&&(y=o.redactFn(y)),[y]}}function mp(e,t,n,r){for(let o in e)if(r&&e[o]instanceof Error)e[o]=Sn.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 n&&(e[o][i]=n[i](e[o][i]))}function sN(e,t,n,r=!1){let o=t.send,i=t.ts,s=t.methodLevel,a=t.methodValue,u=t.val,c=e._logEvent.bindings;r||mp(n,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(g){return c.indexOf(g)===-1}),e._logEvent.level.label=s,e._logEvent.level.value=a,o(s,e._logEvent,u),e._logEvent=fp(c)}function fp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function mA(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let n in e)t[n]===void 0&&(t[n]=e[n]);return t}function aN(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?hA:yA}function ju(){return{}}function lp(e){return e}function zo(){}function hA(){return!1}function yA(){return Date.now()}function cN(){return Math.round(Date.now()/1e3)}function uN(){return new Date(Date.now()).toISOString()}function lN(){function e(t){return typeof t<"u"&&t}try{return typeof x<"u"?x:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),x)}catch{return e(self)||e(window)||e(this)||{}}}qu.exports.default=Sn;qu.exports.pino=Sn;function gA(){let e=(new Error).stack;if(!e)return null;let t=e.split(`
20
+ `);for(let n=1;n<t.length;n++){let r=t[n].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(r)||r.indexOf("browser.js")!==-1||r.indexOf("node:internal")!==-1||r.indexOf("node_modules")!==-1)continue;let o=r.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=r.match(/at\s+(.*?):(\d+):(\d+)/)),o){let i=o[1],s=o[2],a=o[3];return i+":"+s+":"+a}}return null}});var DN={};ls(DN,{ResultTemplatesHelpers:()=>Cy,buildCaseAssistEngine:()=>EA,buildCaseField:()=>qA,buildCaseInput:()=>UA,buildController:()=>on,buildDocumentSuggestion:()=>hp,buildDocumentSuggestionList:()=>hp,buildInteractiveResult:()=>GA,buildQuickview:()=>QA,getAnalyticsNextApiBaseUrl:()=>ys,getOrganizationEndpoint:()=>at,loadCaseAssistAnalyticsActions:()=>ON,loadCaseFieldActions:()=>PN,loadCaseInputActions:()=>NN,loadDocumentSuggestionActions:()=>FN,loadGenericAnalyticsActions:()=>_N});module.exports=rw(DN);m();d();p();f();m();d();p();f();var nm=Dt(Kp(),1);m();d();p();f();var Rt=new Error("Failed to load reducers."),$r=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."}},Wn=class extends Error{constructor(n,r){super();ce(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${n}`,this.statusCode=r??0}};m();d();p();f();function Yp(e){return Array.isArray(e)}function Xp(e,t){return[...e.reduce((n,r)=>{let o=t(r);return n.has(o)||n.set(o,r),n},new Map).values()]}var Yw=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(n=>Yw.has(n))}function Zp(e){let t={};for(let[n,r]of e)t[n]=r;return t}function oi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function hs(e,t,n={}){let r;return(...o)=>{let i=n.isImmediate&&!r;if(clearTimeout(r),r=setTimeout(()=>{r=void 0,n.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}m();d();p();f();function Jp(e){let t=[];for(let n in e){let r=encodeURIComponent(n),o=encodeURIComponent(e[n]);t.push(`${r}=${o}`)}return t.join("&")}function em(e){return typeof e!="object"||!e?!1:Object.values(e).every(Xw)}function Xw(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function tm(e){return e===429}var wn=class e{static call(t){return _asyncToGenerator(function*(){let n=Zw(t),{logger:r}=t,o=yield e.preprocessRequest(n,t);r.info(o,"Platform request");let{url:i,...s}=o,a=/*#__PURE__*/function(){var _a2=_asyncToGenerator(function*(){let u=yield I(i,s);if(tm(u.status))throw u;return u});function a(){return _a2.apply(this,arguments)}return a}();try{let u=yield(0,nm.backOff)(a,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _retry=_asyncToGenerator(function*(c){let g=c&&tm(c.status);return g&&(r.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 r.info("Platform renewing token"),new $r;case 404:throw new Wn(i,u.status);default:return r.info({response:u,requestInfo:o},"Platform response"),u}}catch(u){return u.message==="Failed to fetch"?new Wn(i):u}})()}static preprocessRequest(t,n){return _asyncToGenerator(function*(){let{origin:r,preprocessRequest:o,logger:i,requestMetadata:s}=n,{signal:a,...u}=t,c=oi(u);try{let g=yield o(t,r,s);return{...t,...g}}catch(g){i.error(g,"Platform request preprocessing failed. Returning default request options.")}return c})()}};function at(e,t="prod",n="platform"){let r=t==="prod"?"":t,o=n==="platform"?"":`.${n}`;return`https://${e}${o}.org${r}.coveo.com`}function Hr(e,t,n="prod"){return e??at(t,n)}function Qr(e,t="prod"){return`${at(e,t)}/rest/search/v2`}function ys(e,t="prod"){return`${at(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function Zw(e){let{url:t,method:n,requestParams:r,contentType:o,accessToken:i,signal:s}=e,a=e.method==="POST"||e.method==="PUT",u=Jw(r,o);return{url:t,method:n,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(a&&{body:u}),signal:s}}function Jw(e,t){return t==="application/x-www-form-urlencoded"?em(e)?Jp(e):"":JSON.stringify(e)}m();d();p();f();m();d();p();f();function eC(e,t){let n=`
21
21
  The following properties are invalid:
22
22
 
23
23
  ${e.join(`
24
24
  `)}
25
25
 
26
26
  ${t}
27
- `;return new Ju(n)}var Ju=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Dt=class{constructor(e){se(this,"definition");this.definition=e}validate(e={},t=""){let n={...this.default,...e},r=[];for(let o in this.definition){let i=this.definition[o].validate(n[o]);i&&r.push(`${o}: ${i}`)}if(r.length)throw kw(r,t);return n}get default(){let e={};for(let t in this.definition){let n=this.definition[t].default;n!==void 0&&(e[t]=n)}return e}},$n=class{constructor(e={}){se(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ae(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 Vr(e){return e===void 0}function _w(e){return e===null}function ae(e){return Vr(e)||_w(e)}var Ue=class{constructor(e={}){se(this,"value");this.value=new $n(e)}validate(e){let t=this.value.validate(e);return t||(Ow(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Ow(e){return Vr(e)||Gf(e)}function Gf(e){return typeof e=="boolean"}var Le=class{constructor(e={}){se(this,"config");se(this,"value");this.config=e,this.value=new $n(e)}validate(e){let t=this.value.validate(e);return t||(Pw(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 Pw(e){return Vr(e)||Bf(e)}function Bf(e){return typeof e=="number"&&!Number.isNaN(e)}var Nw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,te=class{constructor(e={}){se(this,"value");se(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new $n(this.config)}validate(e){let{emptyAllowed:t,url:n,regex:r,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(Vr(e))return null;if(!$f(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(n)try{new URL(e)}catch{return"value is not a valid URL."}return r&&!r.test(e)?`value did not match provided regex ${r}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Nw.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 $f(e){return Object.prototype.toString.call(e)==="[object String]"}var Re=class{constructor(e={}){se(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Vr(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Hf(e))return"value is not an object";for(let[n,r]of Object.entries(this.config.values))if(r.required&&ae(e[n]))return`value does not contain ${n}`;let t="";for(let[n,r]of Object.entries(this.config.values)){let o=e[n],i=r.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Hf(e){return e!==void 0&&typeof e=="object"}var Mt=class{constructor(e={}){se(this,"config");se(this,"value");this.config=e,this.value=new $n(this.config)}validate(e){if(!ae(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ae(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 n="";return e.forEach(r=>{this.config.each.required&&ae(r)&&(n=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(r,this.config.each);o!==null&&(n+=` ${o}`)}),n===""?null:n}return null}validatePrimitiveValue(e,t){return Gf(e)||$f(e)||Bf(e)||Hf(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Qf(e){return Array.isArray(e)}var el=class{constructor(e){se(this,"config");se(this,"value");this.config=e,this.value=new $n(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Vr(e)||Object.values(this.config.enum).find(r=>r===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();var ss=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();var Gr=class{constructor(t){se(this,"_basePath");se(this,"_params",{});this._basePath=t}addParam(t,n){this._params={...this.params,[t]:n}}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,n])=>`${t}=${encodeURIComponent(n)}`).join("&")}`:this.basePath}};m();d();f();p();function tl(e){let{url:t,accessToken:n,organizationId:r,authentication:o,...i}=e;return i}var nl=e=>{let{response:t}=e;return t.body?Fw(e):Dw(t)},Fw=e=>Lw(e)?jw(e):Mw(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},Dw=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function Mw(e){return e.body.statusCode!==void 0}function Lw(e){return e.body.exception!==void 0}var jw=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();function zf(e){return((e.headers.get("content-type")||"").split(";").find(r=>r.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var rl=(e,t,n,r)=>{let o=new Gr(`${e.url}${r}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:n,url:o.href,origin:"searchApiFetch"}};var Wf=(e,t)=>{let n=new Gr(`${e.url}${t}`);return n.addParam("access_token",e.accessToken),n.addParam("organizationId",e.organizationId),n.addParam("uniqueId",e.uniqueId),e.authentication&&n.addParam("authentication",e.authentication),e.q!==void 0&&n.addParam("q",e.q),e.enableNavigation!==void 0&&n.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&n.addParam("requestedOutputSize",`${e.requestedOutputSize}`),n.href},ol=/*#__PURE__*/function(){var _ol=_asyncToGenerator(function*(e,t){let n=yield Sn.call({...rl(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:tl(e),requestMetadata:{method:"html"},...t});if(n instanceof Error)throw n;let r=zf(n),o=yield n.arrayBuffer(),s=new TextDecoder(r).decode(o);return Uw(s)?{success:s}:{error:nl({response:n,body:s})}});function ol(_x3,_x4){return _ol.apply(this,arguments)}return ol}();function Uw(e){return typeof e=="string"}m();d();f();p();function qw(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function Vw(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function as(e,t){if(t&&e.name==="AbortError")return{error:Vw(e)};if(e instanceof Bn)return{error:qw(e)};throw e}m();d();f();p();m();d();f();p();var cs=(e,t,n,r,o={})=>{Gw(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${r}`,s=Bw(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:n,url:a,origin:"caseAssistApiFetch"}},us=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,n)=>(t[n]=e[n],t),{}),ls=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,n)=>(t[n]=e[n].value,t),{}),Gw=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},Bw=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var Kf=e=>{let t=e.debug?{debug:"1"}:{};return{...cs(e,"POST","application/json","/classify",t),requestParams:$w(e)}},$w=e=>({clientId:e.clientId,locale:e.locale,fields:us(e.fields)});m();d();f();p();var Yf=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...cs(e,"POST","application/json","/documents/suggest",t),requestParams:Hw(e)}},Hw=e=>({clientId:e.clientId,locale:e.locale,fields:us(e.fields),context:e.context,analytics:e.analytics});var ds=class{constructor(t){se(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let n=yield Sn.call({...Kf(t),..._this.options});if(n instanceof Error)return as(n);let r=yield n.json();return n.ok?{success:r}:{error:r}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let n=yield Sn.call({...Yf(t),..._this2.options});if(n instanceof Error)return as(n);let r=yield n.json();return n.ok?{success:r}:{error:r}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return ol(t,_this3.options)})()}};m();d();f();p();m();d();f();p();m();d();f();p();function Xe(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 Qw=typeof Symbol=="function"&&Symbol.observable||"@@observable",Xf=Qw,il=()=>Math.random().toString(36).substring(7).split("").join("."),zw={INIT:`@@redux/INIT${il()}`,REPLACE:`@@redux/REPLACE${il()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${il()}`},ps=zw;function Gt(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 sl(e,t,n){if(typeof e!="function")throw new Error(Xe(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Xe(1));return n(sl)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,u=!1;function c(){s===i&&(s=new Map,i.forEach((w,R)=>{s.set(R,w)}))}function g(){if(u)throw new Error(Xe(3));return o}function v(w){if(typeof w!="function")throw new Error(Xe(4));if(u)throw new Error(Xe(5));let R=!0;c();let N=a++;return s.set(N,w),function(){if(R){if(u)throw new Error(Xe(6));R=!1,c(),s.delete(N),i=null}}}function x(w){if(!Gt(w))throw new Error(Xe(7));if(typeof w.type>"u")throw new Error(Xe(8));if(typeof w.type!="string")throw new Error(Xe(17));if(u)throw new Error(Xe(9));try{u=!0,o=r(o,w)}finally{u=!1}return(i=s).forEach(N=>{N()}),w}function h(w){if(typeof w!="function")throw new Error(Xe(10));r=w,x({type:ps.REPLACE})}function y(){let w=v;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Xe(11));function N(){let P=R;P.next&&P.next(g())}return N(),{unsubscribe:w(N)}},[Xf](){return this}}}return x({type:ps.INIT}),{dispatch:x,subscribe:v,getState:g,replaceReducer:h,[Xf]:y}}function Ww(e){Object.keys(e).forEach(t=>{let n=e[t];if(typeof n(void 0,{type:ps.INIT})>"u")throw new Error(Xe(12));if(typeof n(void 0,{type:ps.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Xe(13))})}function Hn(e){let t=Object.keys(e),n={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(n[a]=e[a])}let r=Object.keys(n),o,i;try{Ww(n)}catch(s){i=s}return function(a={},u){if(i)throw i;let c=!1,g={};for(let v=0;v<r.length;v++){let x=r[v],h=n[x],y=a[x],b=h(y,u);if(typeof b>"u"){let w=u&&u.type;throw new Error(Xe(14))}g[x]=b,c=c||b!==y}return c=c||r.length!==Object.keys(a).length,c?g:a}}function Ko(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function Zf(...e){return t=>(n,r)=>{let o=t(n,r),i=()=>{throw new Error(Xe(15))},s={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},a=e.map(u=>u(s));return i=Ko(...a)(o.dispatch),{...o,dispatch:i}}}function Yo(e){return Gt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var gl=Symbol.for("immer-nothing"),Xo=Symbol.for("immer-draftable"),He=Symbol.for("immer-state");function Ze(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var yt=Object,zn=yt.getPrototypeOf,Zo="constructor",ri="prototype",ul="configurable",hs="enumerable",ms="writable",Jo="value",lt=e=>!!e&&!!e[He];function st(e){return e?sm(e)||ii(e)||!!e[Xo]||!!e[Zo]?.[Xo]||si(e)||Hr(e):!1}var Kw=yt[ri][Zo].toString(),Jf=new WeakMap;function sm(e){if(!e||!$r(e))return!1;let t=zn(e);if(t===null||t===yt[ri])return!0;let n=yt.hasOwnProperty.call(t,Zo)&&t[Zo];if(n===Object)return!0;if(!Qn(n))return!1;let r=Jf.get(n);return r===void 0&&(r=Function.toString.call(n),Jf.set(n,r)),r===Kw}function hl(e){return lt(e)||Ze(15,e),e[He].base_}function oi(e,t,n=!0){Wn(e)===0?(n?Reflect.ownKeys(e):yt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((r,o)=>t(o,r,e))}function Wn(e){let t=e[He];return t?t.type_:ii(e)?1:si(e)?2:Hr(e)?3:0}var Br=(e,t,n=Wn(e))=>n===2?e.has(t):yt[ri].hasOwnProperty.call(e,t),sn=(e,t,n=Wn(e))=>n===2?e.get(t):e[t],ys=(e,t,n,r=Wn(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Yw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ii=Array.isArray,si=e=>e instanceof Map,Hr=e=>e instanceof Set,$r=e=>typeof e=="object",Qn=e=>typeof e=="function",al=e=>typeof e=="boolean";function Xw(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Zw=e=>$r(e)?e?.[He]:null,an=e=>e.copy_||e.base_;var yl=e=>e.modified_?e.copy_:e.base_;function ll(e,t){if(si(e))return new Map(e);if(Hr(e))return new Set(e);if(ii(e))return Array[ri].slice.call(e);let n=sm(e);if(t===!0||t==="class_only"&&!n){let r=yt.getOwnPropertyDescriptors(e);delete r[He];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){let s=o[i],a=r[s];a[ms]===!1&&(a[ms]=!0,a[ul]=!0),(a.get||a.set)&&(r[s]={[ul]:!0,[ms]:!0,[hs]:a[hs],[Jo]:e[s]})}return yt.create(zn(e),r)}else{let r=zn(e);if(r!==null&&n)return{...e};let o=yt.create(r);return yt.assign(o,e)}}function Cs(e,t=!1){return Es(e)||lt(e)||!st(e)||(Wn(e)>1&&yt.defineProperties(e,{set:fs,add:fs,clear:fs,delete:fs}),yt.freeze(e),t&&oi(e,(n,r)=>{Cs(r,!0)},!1)),e}function Jw(){Ze(2)}var fs={[Jo]:Jw};function Es(e){return e===null||!$r(e)?!0:yt.isFrozen(e)}var vs="MapSet",Ss="Patches",em="ArrayMethods",bs={};function Kn(e){let t=bs[e];return t||Ze(0,e),t}var tm=e=>!!bs[e];function eC(e,t){bs[e]||(bs[e]=t)}var ei,am=()=>ei,tC=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:tm(vs)?Kn(vs):void 0,arrayMethodsPlugin_:tm(em)?Kn(em):void 0});function nm(e,t){t&&(e.patchPlugin_=Kn(Ss),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dl(e){pl(e),e.drafts_.forEach(nC),e.drafts_=null}function pl(e){e===ei&&(ei=e.parent_)}var rm=e=>ei=tC(ei,e);function nC(e){let t=e[He];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function om(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[He].modified_&&(dl(t),Ze(4)),st(e)&&(e=im(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(n[He].base_,e,t)}else e=im(t,n);return rC(t,e,!0),dl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gl?e:void 0}function im(e,t){if(Es(t))return t;let n=t[He];if(!n)return As(t,e.handledSet_,e);if(!xs(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);lm(n,e)}return n.copy_}function rC(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Cs(t,n)}function cm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var xs=(e,t)=>e.scope_===t,oC=[];function um(e,t,n,r){let o=an(e),i=e.type_;if(r!==void 0&&sn(o,r,i)===t){ys(o,r,n,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;oi(o,(u,c)=>{if(lt(c)){let g=a.get(c)||[];g.push(u),a.set(c,g)}})}let s=e.draftLocations_.get(t)??oC;for(let a of s)ys(o,a,n,i)}function iC(e,t,n){e.callbacks_.push(function(o){let i=t;if(!i||!xs(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=yl(i);um(e,i.draft_??i,s,n),lm(i,o)})}function lm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:r}=t;if(r){let o=r.getPath(e);o&&r.generatePatches_(e,o,t)}cm(e)}}function sC(e,t,n){let{scope_:r}=e;if(lt(n)){let o=n[He];xs(o,r)&&o.callbacks_.push(function(){gs(e);let s=yl(o);um(e,n,s,t)})}else st(n)&&e.callbacks_.push(function(){let i=an(e);e.type_===3?i.has(n)&&As(n,r.handledSet_,r):sn(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&As(sn(e.copy_,t,e.type_),r.handledSet_,r)})}function As(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||lt(e)||t.has(e)||!st(e)||Es(e)||(t.add(e),oi(e,(r,o)=>{if(lt(o)){let i=o[He];if(xs(i,n)){let s=yl(i);ys(e,r,s,e.type_),cm(i)}}else st(o)&&As(o,t,n)})),e}function aC(e,t){let n=ii(e),r={type_:n?1:0,scope_:t?t.scope_:am(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=r,i=ws;n&&(o=[r],i=ti);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,[a,r]}var ws={get(e,t){if(t===He)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t=="string";if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let o=an(e);if(!Br(o,t,e.type_))return uC(e,o,t);let i=o[t];if(e.finalized_||!st(i)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Xw(t))return i;if(i===cl(e.base_,t)||cC(e,t,i)){gs(e);let s=e.type_===1?+t:t,a=ml(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in an(e)},ownKeys(e){return Reflect.ownKeys(an(e))},set(e,t,n){let r=dm(an(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let o=cl(an(e),t),i=o?.[He];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(Yw(n,o)&&(n!==void 0||Br(e.base_,t,e.type_)))return!0;gs(e),fl(e)}return e.copy_[t]===n&&(n!==void 0||Br(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),sC(e,t,n)),!0},deleteProperty(e,t){return gs(e),cl(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),fl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=an(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[ms]:!0,[ul]:e.type_!==1||t!=="length",[hs]:r[hs],[Jo]:n[t]}},defineProperty(){Ze(11)},getPrototypeOf(e){return zn(e.base_)},setPrototypeOf(){Ze(12)}},ti={};for(let e in ws){let t=ws[e];ti[e]=function(){let n=arguments;return n[0]=n[0][0],t.apply(this,n)}}ti.deleteProperty=function(e,t){return ti.set.call(this,e,t,void 0)};ti.set=function(e,t,n){return ws.set.call(this,e[0],t,n,e[0])};function cl(e,t){let n=e[He];return(n?an(n):e)[t]}function cC(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!st(n)||n[He]?!1:e.baseRefs_.has(n)}function uC(e,t,n){let r=dm(t,n);return r?Jo in r?r[Jo]:r.get?.call(e.draft_):void 0}function dm(e,t){if(!(t in e))return;let n=zn(e);for(;n;){let r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=zn(n)}}function fl(e){e.modified_||(e.modified_=!0,e.parent_&&fl(e.parent_))}function gs(e){e.copy_||(e.assigned_=new Map,e.copy_=ll(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var lC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,n,r)=>{if(Qn(t)&&!Qn(n)){let i=n;n=t;let s=this;return function(u=i,...c){return s.produce(u,g=>n.call(this,g,...c))}}Qn(n)||Ze(6),r!==void 0&&!Qn(r)&&Ze(7);let o;if(st(t)){let i=rm(this),s=ml(i,t,void 0),a=!0;try{o=n(s),a=!1}finally{a?dl(i):pl(i)}return nm(i,r),om(o,i)}else if(!t||!$r(t)){if(o=n(t),o===void 0&&(o=t),o===gl&&(o=void 0),this.autoFreeze_&&Cs(o,!0),r){let i=[],s=[];Kn(Ss).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),r(i,s)}return o}else Ze(1,t)},this.produceWithPatches=(t,n)=>{if(Qn(t))return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},al(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),al(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),al(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){st(e)||Ze(8),lt(e)&&(e=Is(e));let t=rm(this),n=ml(t,e,void 0);return n[He].isManual_=!0,pl(t),n}finishDraft(e,t){let n=e&&e[He];(!n||!n.isManual_)&&Ze(9);let{scope_:r}=n;return nm(r,t),om(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));let r=Kn(Ss).applyPatches_;return lt(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ml(e,t,n,r){let[o,i]=si(t)?Kn(vs).proxyMap_(t,n):Hr(t)?Kn(vs).proxySet_(t,n):aC(t,n);return(n?.scope_??am()).drafts_.push(o),i.callbacks_=n?.callbacks_??[],i.key_=r,n&&r!==void 0?iC(n,i,r):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function Is(e){return lt(e)||Ze(10,e),pm(e)}function pm(e){if(!st(e)||Es(e))return e;let t=e[He],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ll(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ll(e,!0);let o=n;return Hr(n)&&(n=new Set),oi(o,(i,s)=>{ys(n,i,pm(s))},r),t&&(t.finalized_=!1),n}function fm(){function t(y,b=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,R=Zw(sn(w,y.key_)),N=sn(w,y.key_);if(N===void 0||N!==y.draft_&&N!==y.copy_||R!=null&&R.base_!==y.base_)return null;let k=y.parent_.type_===3,P;if(k){let A=y.parent_;P=Array.from(A.drafts_.keys()).indexOf(y.key_)}else P=y.key_;if(!(k&&w.size>P||Br(w,P))||y.parent_.type_===1&&y.parent_.allIndicesReassigned_)return null;b.push(P)}if(y.parent_)return t(y.parent_,b);b.reverse();try{n(y.copy_,b)}catch{return null}return b}function n(y,b){let w=y;for(let R=0;R<b.length-1;R++){let N=b[R];if(w=sn(w,N),!$r(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let r="replace",o="add",i="remove";function s(y,b,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:R,inversePatches_:N}=w;switch(y.type_){case 0:case 2:return u(y,b,R,N);case 1:return a(y,b,R,N);case 3:return c(y,b,R,N)}}function a(y,b,w,R){let{base_:N,assigned_:k}=y,P=y.copy_;P.length<N.length&&([N,P]=[P,N],[w,R]=[R,w]);let A=y.allIndicesReassigned_===!0;for(let O=0;O<N.length;O++){let _=P[O],T=N[O];if((A||k?.get(O.toString()))&&_!==T){let q=_?.[He];if(q&&q.modified_)continue;let M=b.concat([O]);w.push({op:r,path:M,value:h(_)}),R.push({op:r,path:M,value:h(T)})}}for(let O=N.length;O<P.length;O++){let _=b.concat([O]);w.push({op:o,path:_,value:h(P[O])})}for(let O=P.length-1;N.length<=O;--O){let _=b.concat([O]);R.push({op:i,path:_})}}function u(y,b,w,R){let{base_:N,copy_:k,type_:P}=y;oi(y.assigned_,(A,O)=>{let _=sn(N,A,P),T=sn(k,A,P),D=O?Br(N,A)?r:o:i;if(_===T&&D===r)return;let q=b.concat(A);w.push(D===i?{op:D,path:q}:{op:D,path:q,value:h(T)}),R.push(D===o?{op:i,path:q}:D===i?{op:o,path:q,value:h(_)}:{op:r,path:q,value:h(_)})})}function c(y,b,w,R){let{base_:N,copy_:k}=y,P=0;N.forEach(A=>{if(!k.has(A)){let O=b.concat([P]);w.push({op:i,path:O,value:A}),R.unshift({op:o,path:O,value:A})}P++}),P=0,k.forEach(A=>{if(!N.has(A)){let O=b.concat([P]);w.push({op:o,path:O,value:A}),R.unshift({op:i,path:O,value:A})}P++})}function g(y,b,w){let{patches_:R,inversePatches_:N}=w;R.push({op:r,path:[],value:b===gl?void 0:b}),N.push({op:r,path:[],value:y})}function v(y,b){return b.forEach(w=>{let{path:R,op:N}=w,k=y;for(let _=0;_<R.length-1;_++){let T=Wn(k),D=R[_];typeof D!="string"&&typeof D!="number"&&(D=""+D),(T===0||T===1)&&(D==="__proto__"||D===Zo)&&Ze(19),Qn(k)&&D===ri&&Ze(19),k=sn(k,D),(k===null||!$r(k))&&Ze(18,R.join("/"))}let P=Wn(k),A=x(w.value),O=R[R.length-1];switch(N){case r:switch(P){case 2:return k.set(O,A);case 3:Ze(16);default:return k[O]=A}case o:switch(P){case 1:return O==="-"?k.push(A):k.splice(O,0,A);case 2:return k.set(O,A);case 3:return k.add(A);default:return k[O]=A}case i:switch(P){case 1:return k.splice(O,1);case 2:return k.delete(O);case 3:return k.delete(w.value);default:return delete k[O]}default:Ze(17,N)}}),y}function x(y){if(!st(y))return y;if(ii(y))return y.map(x);if(si(y))return new Map(Array.from(y.entries()).map(([w,R])=>[w,x(R)]));if(Hr(y))return new Set(Array.from(y).map(x));let b=Object.create(zn(y));for(let w in y)b[w]=x(y[w]);return Br(y,Xo)&&(b[Xo]=y[Xo]),b}function h(y){return lt(y)?x(y):y}eC(Ss,{applyPatches_:v,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var dC=C.Iterator,gM=typeof dC?.from=="function";var ni=new lC,Yn=ni.produce,vl=ni.produceWithPatches.bind(ni);var Sl=ni.applyPatches.bind(ni);m();d();f();p();var pC=class{constructor(e){this.value=e}deref(){return this.value}},fC=()=>typeof WeakRef>"u"?pC:WeakRef,gm=fC(),mC=0,Rs=1;function ai(){return{s:mC,v:void 0,o:null,p:null}}function gC(e){return e instanceof gm?e.deref():e}function Qr(e,t={}){let n=ai(),{resultEqualityCheck:r,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 s=null,a=0,u,c=0,g=!1;function v(){a>=o&&(s=n,n=ai(),a=0)}function x(){let h=n,{length:y}=arguments;for(let R=0,N=y;R<N;R++){let k=arguments[R];if(typeof k=="function"||typeof k=="object"&&k!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let A=P.get(k);A===void 0?(h=ai(),P.set(k,h)):h=A}else{let P=h.p;P===null&&(h.p=P=new Map);let A=P.get(k);A===void 0?(h=ai(),P.set(k,h),a++):h=A}}if(h.s===Rs)return h.v;if(s!==null){let R=s;for(let N=0,k=y;N<k;N++){let P=arguments[N],A;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=R.o;A=O!==null?O.get(P):void 0}else{let O=R.p;A=O!==null?O.get(P):void 0}if(A===void 0){R=null;break}R=A}if(R!==null&&R.s===Rs){let N=h;return N.s=Rs,N.v=R.v,v(),R.v}}let b=h,w=e.apply(null,arguments);if(c++,r){let R=gC(u);R!=null&&r(R,w)&&(w=R,c!==0&&c--),u=typeof w=="object"&&w!==null||typeof w=="function"?new gm(w):w}return b.s=Rs,b.v=w,i&&v(),w}return x.clearCache=()=>{n=ai(),s=null,a=0,x.resetResultsCount()},x.resultsCount=()=>c,x.resetResultsCount=()=>{c=0},x}var bl=Symbol("NOT_FOUND");function hC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function yC(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){let n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var mm=e=>Array.isArray(e)?e:[e];function vC(e){let t=Array.isArray(e[0])?e[0]:e;return yC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Ts(e,...t){let n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let i=0,s=0,a,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),hC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...n,...u},{memoize:v,memoizeOptions:x=[],argsMemoize:h=Qr,argsMemoizeOptions:y=[]}=g,b=mm(x),w=mm(y),R=vC(o),N=v(function(){return i++,c.apply(null,arguments)},...b),k=!0,P=h(function(){s++;let{length:O}=R,_=new Array(O);for(let T=0;T<O;T++)_[T]=R[T].apply(null,arguments);return a=N.apply(null,_),a},...w);return Object.assign(P,{resultFunc:c,memoizedResultFunc:N,dependencies:R,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var Be=Ts(Qr);function SC(e){let t;return{get(n){return t&&e(t.key,n)?t.value:bl},put(n,r){t={key:n,value:r}},findMatchingEntry(n,r){let o=t;return o!==void 0&&r(o.value,n)?o:void 0},clear(){t=void 0}}}function bC(e,t){let n=[];function r(a){let u=n.findIndex(c=>t(c.key,a));if(u>-1){let c=n[u];return u>0&&(n.splice(u,1),n.unshift(c)),c.value}return bl}function o(a,u){n.unshift({key:a,value:u}),n.length>e&&n.pop()}function i(a,u){let c=n,{length:g}=c;for(let v=0;v<g;v++){let x=c[v];if(u(x.value,a))return x}}function s(){n=[]}return{get:r,put:o,findMatchingEntry:i,clear:s}}var AC=(e,t)=>e===t;function wC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;let{length:o}=n;for(let i=0;i<o;i++)if(!e(n[i],r[i]))return!1;return!0}}function Al(e,t){let n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=AC,maxSize:o=1,resultEqualityCheck:i}=n,s=wC(r),a=0,u=o<=1?SC(s):bC(o,s);function c(){let g=u.get(arguments);if(g===bl){if(g=e.apply(null,arguments),a++,i){let v=u.findMatchingEntry(g,i);v&&(g=v.value,a!==0&&a--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}m();d();f();p();function hm(e){return({dispatch:n,getState:r})=>o=>i=>typeof i=="function"?i(n,r,e):o(i)}var ym=hm(),vm=hm;var CC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ko:Ko.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var EC=e=>e&&typeof e.match=="function";function V(e,t){function n(...r){if(t){let o=t(...r);if(!o)throw new Error(at(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>Yo(r)&&r.type===e,n}var Im=class ci extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ci.prototype)}static get[Symbol.species](){return ci}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ci(...t[0].concat(this)):new ci(...t.concat(this))}};function Sm(e){return st(e)?Yn(e,()=>{}):e}function ks(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function xC(e){return typeof e=="boolean"}var IC=()=>function(t){let{thunk:n=!0,immutableCheck:r=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new Im;return n&&(xC(n)?s.push(ym):s.push(vm(n.extraArgument))),s},ui="RTK_autoBatch",Kr=()=>e=>({payload:e,meta:{[ui]:!0}}),bm=e=>t=>{setTimeout(t,e)},RC=(e,t)=>n=>{let r=!1,o,i,s=()=>{r||(r=!0,cancelAnimationFrame(o),clearTimeout(i),n())};o=e(s),i=setTimeout(s,t)},TC=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),o=!0,i=!1,s=!1,a=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?RC(window.requestAnimationFrame,100):bm(10):e.type==="callback"?e.queueNotification:bm(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},r,{subscribe(g){let v=()=>o&&g(),x=r.subscribe(v);return a.add(g),()=>{x(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[ui],i=!o,i&&(s||(s=!0,u(c))),r.dispatch(g)}finally{o=!0}}})},kC=e=>function(n){let{autoBatch:r=!0}=n??{},o=new Im(e);return r&&o.push(TC(typeof r=="object"?r:void 0)),o};function Rm(e){let t=IC(),{reducer:n=void 0,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},u;if(typeof n=="function")u=n;else if(Gt(n))u=Hn(n);else throw new Error(at(1));let c;typeof r=="function"?c=r(t):c=t();let g=Ko;o&&(g=CC({trace:!1,...(typeof o=="object"&&o)}));let v=Zf(...c),x=kC(v),h=typeof a=="function"?a(x):x(),y=g(...h);return sl(u,s,y)}function Tm(e){let t={},n=[],r,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(at(28));if(a in t)throw new Error(at(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return n.push({matcher:i,reducer:s}),o},addDefaultCase(i){return r=i,o}};return e(o),[t,n,r]}function _C(e){return typeof e=="function"}function Qe(e,t){let[n,r,o]=Tm(t),i;if(_C(e))i=()=>Sm(e());else{let a=Sm(e);i=()=>a}function s(a=i(),u){let c=[n[u.type],...r.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(lt(g)){let x=v(g,u);return x===void 0?g:x}else{if(st(g))return Yn(g,x=>v(x,u));{let x=v(g,u);if(x===void 0){if(g===null)return g;throw new Error(at(9))}return x}}return g},a)}return s.getInitialState=i,s}var km=(e,t)=>EC(e)?e.match(t):e(t);function Bt(...e){return t=>e.some(n=>km(n,t))}function Wr(...e){return t=>e.every(n=>km(n,t))}function Ns(e,t){if(!e||!e.meta)return!1;let n=typeof e.meta.requestId=="string",r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function li(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Fs(...e){return e.length===0?t=>Ns(t,["pending"]):li(e)?Bt(...e.map(t=>t.pending)):Fs()(e[0])}function Zn(...e){return e.length===0?t=>Ns(t,["rejected"]):li(e)?Bt(...e.map(t=>t.rejected)):Zn()(e[0])}function di(...e){let t=n=>n&&n.meta&&n.meta.rejectedWithValue;return e.length===0?Wr(Zn(...e),t):li(e)?Wr(Zn(...e),t):di()(e[0])}function cn(...e){return e.length===0?t=>Ns(t,["fulfilled"]):li(e)?Bt(...e.map(t=>t.fulfilled)):cn()(e[0])}function Ds(...e){return e.length===0?t=>Ns(t,["pending","fulfilled","rejected"]):li(e)?Bt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ds()(e[0])}var OC="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",pi=(e=21)=>{let t="",n=e;for(;n--;)t+=OC[Math.random()*64|0];return t},PC=["name","message","stack","code"],wl=class{constructor(e,t){se(this,"payload");se(this,"meta");se(this,"_type");this.payload=e,this.meta=t}},Am=class{constructor(e,t){se(this,"payload");se(this,"meta");se(this,"_type");this.payload=e,this.meta=t}},NC=e=>{if(typeof e=="object"&&e!==null){let t={};for(let n of PC)typeof e[n]=="string"&&(t[n]=e[n]);return t}return{message:String(e)}},wm="External signal was aborted",Ie=(()=>{function e(t,n,r){let o=V(t+"/fulfilled",(u,c,g,v)=>({payload:u,meta:{...(v||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=V(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),s=V(t+"/rejected",(u,c,g,v,x)=>({payload:v,error:(r&&r.serializeError||NC)(u||"Rejected"),meta:{...(x||{}),arg:g,requestId:c,rejectedWithValue:v!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function a(u,{signal:c}={}){return(g,v,x)=>{let h=r?.idGenerator?r.idGenerator(u):pi(),y=new l.AbortController,b,w;function R(k){w=k,y.abort()}c&&(c.aborted?R(wm):c.addEventListener("abort",()=>R(wm),{once:!0}));let N=_asyncToGenerator(function*(){let k;try{let P=r?.condition?.(u,{getState:v,extra:x});if(DC(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:w||"Aborted"};let A=new Promise((O,_)=>{b=()=>{_({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(i(h,u,r?.getPendingMeta?.({requestId:h,arg:u},{getState:v,extra:x}))),k=yield Promise.race([A,Promise.resolve(n(u,{dispatch:g,getState:v,extra:x,requestId:h,signal:y.signal,abort:R,rejectWithValue:(O,_)=>new wl(O,_),fulfillWithValue:(O,_)=>new Am(O,_)})).then(O=>{if(O instanceof wl)throw O;return O instanceof Am?o(O.payload,h,u,O.meta):o(O,h,u)})])}catch(P){k=P instanceof wl?s(null,h,u,P.payload,P.meta):s(P,h,u)}finally{b&&y.signal.removeEventListener("abort",b)}return r&&!r.dispatchConditionRejection&&s.match(k)&&k.meta.condition||g(k),k})();return Object.assign(N,{abort:R,requestId:h,arg:u,unwrap(){return N.then(FC)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Bt(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function FC(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function DC(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var _m=Symbol.for("rtk-slice-createasyncthunk"),LM={[_m]:Ie};function MC(e,t){return`${e}/${t}`}function LC({creators:e}={}){let t=e?.asyncThunk?.[_m];return function(r){let{name:o,reducerPath:i=o}=r;if(!o)throw new Error(at(11));typeof process<"u";let s=(typeof r.reducers=="function"?r.reducers(UC()):r.reducers)||{},a=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(k,P){let A=typeof k=="string"?k:k.type;if(!A)throw new Error(at(12));if(A in u.sliceCaseReducersByType)throw new Error(at(13));return u.sliceCaseReducersByType[A]=P,c},addMatcher(k,P){return u.sliceMatchers.push({matcher:k,reducer:P}),c},exposeAction(k,P){return u.actionCreators[k]=P,c},exposeCaseReducer(k,P){return u.sliceCaseReducersByName[k]=P,c}};a.forEach(k=>{let P=s[k],A={reducerName:k,type:MC(o,k),createNotation:typeof r.reducers=="function"};VC(P)?BC(A,P,c,t):qC(A,P,c)});function g(){let[k={},P=[],A=void 0]=typeof r.extraReducers=="function"?Tm(r.extraReducers):[r.extraReducers],O={...k,...u.sliceCaseReducersByType};return Qe(r.initialState,_=>{for(let T in O)_.addCase(T,O[T]);for(let T of u.sliceMatchers)_.addMatcher(T.matcher,T.reducer);for(let T of P)_.addMatcher(T.matcher,T.reducer);A&&_.addDefaultCase(A)})}let v=k=>k,x=new Map,h=new WeakMap,y;function b(k,P){return y||(y=g()),y(k,P)}function w(){return y||(y=g()),y.getInitialState()}function R(k,P=!1){function A(_){let T=_[k];return typeof T>"u"&&P&&(T=ks(h,A,w)),T}function O(_=v){return ks(ks(x,P,()=>new WeakMap),_,()=>{let T={};for(let[D,q]of Object.entries(r.selectors??{}))T[D]=jC(q,_,()=>ks(h,_,w),P);return T})}return{reducerPath:k,getSelectors:O,get selectors(){return O(A)},selectSlice:A}}let N={name:o,reducer:b,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:w,...R(i),injectInto(k,{reducerPath:P,...A}={}){let O=P??i;return k.inject({reducerPath:O,reducer:b},A),{...N,...R(O,!0)}}};return N}}function jC(e,t,n,r){function o(i,...s){let a=t(i);return typeof a>"u"&&r&&(a=n()),e(a,...s)}return o.unwrapped=e,o}var Jn=LC();function UC(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function qC({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!GC(r))throw new Error(at(17));i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?V(e,s):V(e))}function VC(e){return e._reducerDefinitionType==="asyncThunk"}function GC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function BC({type:e,reducerName:t},n,r,o){if(!o)throw new Error(at(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:u,settled:c,options:g}=n,v=o(e,i,g);r.exposeAction(t,v),s&&r.addCase(v.fulfilled,s),a&&r.addCase(v.pending,a),u&&r.addCase(v.rejected,u),c&&r.addMatcher(v.settled,c),r.exposeCaseReducer(t,{fulfilled:s||_s,pending:a||_s,rejected:u||_s,settled:c||_s})}function _s(){}var $C="task",Om="listener",Pm="completed",xl="cancelled",HC=`task-${xl}`,QC=`task-${Pm}`,Cl=`${Om}-${xl}`,zC=`${Om}-${Pm}`,Ms=class{constructor(e){se(this,"code");se(this,"name","TaskAbortError");se(this,"message");this.code=e,this.message=`${$C} ${xl} (reason: ${e})`}},Il=(e,t)=>{if(typeof e!="function")throw new TypeError(at(32))},Os=()=>{},Nm=(e,t=Os)=>(e.catch(t),e),Fm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Xn=e=>{if(e.aborted)throw new Ms(e.reason)};function Dm(e,t){let n=Os;return new Promise((r,o)=>{let i=()=>o(new Ms(e.reason));if(e.aborted){i();return}n=Fm(e,i),t.finally(()=>n()).then(r,o)}).finally(()=>{n=Os})}var WC=/*#__PURE__*/function(){var _WC=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(n){return{status:n instanceof Ms?"cancelled":"rejected",error:n}}finally{t?.()}});function WC(_x5,_x6){return _WC.apply(this,arguments)}return WC}(),Ps=e=>t=>Nm(Dm(e,t).then(n=>(Xn(e),n))),Mm=e=>{let t=Ps(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:zr}=Object,Cm={},Ls="listenerMiddleware",KC=(e,t)=>{let n=r=>Fm(e,()=>r.abort(e.reason));return(r,o)=>{Il(r,"taskExecutor");let i=new l.AbortController;n(i);let s=WC(/*#__PURE__*/_asyncToGenerator(function*(){Xn(e),Xn(i.signal);let a=yield r({pause:Ps(i.signal),delay:Mm(i.signal),signal:i.signal});return Xn(i.signal),a}),()=>i.abort(QC));return o?.autoJoin&&t.push(s.catch(Os)),{result:Ps(e)(s),cancel(){i.abort(HC)}}}},YC=(e,t)=>{let n=/*#__PURE__*/function(){var _n2=_asyncToGenerator(function*(r,o){Xn(t);let i=()=>{},s=[new Promise((a,u)=>{let c=e({predicate:r,effect:(g,v)=>{v.unsubscribe(),a([g,v.getState(),v.getOriginalState()])}});i=()=>{c(),u()}})];o!=null&&s.push(new Promise(a=>setTimeout(a,o,null)));try{let a=yield Dm(t,Promise.race(s));return Xn(t),a}finally{i()}});function n(_x7,_x8){return _n2.apply(this,arguments)}return n}();return(r,o)=>Nm(n(r,o))},Lm=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:i}=e;if(t)o=V(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(at(21));return Il(i,"options.listener"),{predicate:o,type:t,effect:i}},jm=zr(e=>{let{type:t,predicate:n,effect:r}=Lm(e);return{id:pi(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(at(22))}}},{withTypes:()=>jm}),Em=(e,t)=>{let{type:n,effect:r,predicate:o}=Lm(t);return Array.from(e.values()).find(i=>(typeof n=="string"?i.type===n:i.predicate===o)&&i.effect===r)},El=e=>{e.pending.forEach(t=>{t.abort(Cl)})},XC=(e,t)=>()=>{for(let n of t.keys())El(n);e.clear()},xm=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Um=zr(V(`${Ls}/add`),{withTypes:()=>Um}),ZC=V(`${Ls}/removeAll`),qm=zr(V(`${Ls}/remove`),{withTypes:()=>qm}),JC=(...e)=>{console.error(`${Ls}/error`,...e)},Vm=(e={})=>{let t=new Map,n=new Map,r=h=>{let y=n.get(h)??0;n.set(h,y+1)},o=h=>{let y=n.get(h)??1;y===1?n.delete(h):n.set(h,y-1)},{extra:i,onError:s=JC}=e;Il(s,"onError");let a=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&El(h)}),u=h=>{let y=Em(t,h)??jm(h);return a(y)};zr(u,{withTypes:()=>u});let c=h=>{let y=Em(t,h);return y&&(y.unsubscribe(),h.cancelActive&&El(y)),!!y};zr(c,{withTypes:()=>c});let g=/*#__PURE__*/function(){var _g2=_asyncToGenerator(function*(h,y,b,w){let R=new l.AbortController,N=YC(u,R.signal),k=[];try{h.pending.add(R),r(h),yield Promise.resolve(h.effect(y,zr({},b,{getOriginalState:w,condition:(P,A)=>N(P,A).then(Boolean),take:N,delay:Mm(R.signal),pause:Ps(R.signal),extra:i,signal:R.signal,fork:KC(R.signal,k),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,A,O)=>{P!==R&&(P.abort(Cl),O.delete(P))})},cancel:()=>{R.abort(Cl),h.pending.delete(R)},throwIfCancelled:()=>{Xn(R.signal)}})))}catch(P){P instanceof Ms||xm(s,P,{raisedBy:"effect"})}finally{yield Promise.all(k),R.abort(zC),o(h),h.pending.delete(R)}});function g(_x9,_x0,_x1,_x10){return _g2.apply(this,arguments)}return g}(),v=XC(t,n);return{middleware:h=>y=>b=>{if(!Yo(b))return y(b);if(Um.match(b))return u(b.payload);if(ZC.match(b)){v();return}if(qm.match(b))return c(b.payload);let w=h.getState(),R=()=>{if(w===Cm)throw new Error(at(23));return w},N;try{if(N=y(b),t.size>0){let k=h.getState(),P=Array.from(t.values());for(let A of P){let O=!1;try{O=A.predicate(b,k,w)}catch(_){O=!1,xm(s,_,{raisedBy:"predicate"})}O&&g(A,b,h,R)}}}finally{w=Cm}return N},startListening:u,stopListening:c,clearListeners:v}};function at(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 J=new te({required:!0,emptyAllowed:!1}),ze=new te({required:!1,emptyAllowed:!1}),Lt=new te({required:!0,emptyAllowed:!0}),KM=new te({required:!1,emptyAllowed:!0}),Gm=new Mt({each:J,required:!0}),Bm=new te({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),$m=new te({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),YM=new te({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),eE=({message:e,name:t,stack:n})=>({message:e,name:t,stack:n}),Rl=(e,t)=>{if("required"in t)return{payload:new Dt({value:t}).validate({value:e}).value};let o=new Re({options:{required:!0},values:t}).validate(e);if(o)throw new Ju(o);return{payload:e}},W=(e,t)=>{try{return Rl(e,t)}catch(n){return{payload:e,error:eE(n)}}};var js=(e,t,n,r)=>{let o=`Check the options of ${r}`;return tE(e,t,n,o,"Controller initialization error")},tE=(e,t,n,r,o)=>{try{return t.validate(n,r)}catch(i){throw e.logger.error(i,o),i}};var Us=V("caseAssistConfiguration/set",e=>W(e,{caseAssistId:J,locale:ze,proxyBaseUrl:new te({required:!1,url:!0})}));m();d();f();p();m();d();f();p();var Hm=()=>({caseAssistId:"",locale:"en-US"});var bn=Qe(Hm(),e=>{e.addCase(Us,(t,n)=>{t.caseAssistId=n.payload.caseAssistId,t.locale=n.payload.locale,t.apiBaseUrl=n.payload.proxyBaseUrl})});m();d();f();p();m();d();f();p();m();d();f();p();var Qm={q:new te,enableQuerySyntax:new Ue,aq:new te,cq:new te,firstResult:new Le({min:0}),numberOfResults:new Le({min:0}),sortCriteria:new te,f:new Re,fExcluded:new Re,cf:new Re,nf:new Re,mnf:new Re,df:new Re,debug:new Ue,sf:new Re,tab:new te,af:new Re};var qs=V("searchParameters/restore",e=>W(e,Qm)),zm=V("searchParameters/restoreTab",e=>W(e,J));m();d();f();p();var Wm=V("debug/enable"),Km=V("debug/disable");m();d();f();p();var Vs=()=>!1;var Ym=Qe(Vs(),e=>{e.addCase(Wm,()=>!0).addCase(Km,()=>!1).addCase(qs,(t,n)=>n.payload.debug??t)});m();d();f();p();var Gs=V("searchHub/set",e=>W(e,new te({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var Yr="3.58.1",Xm=["@coveo/atomic","@coveo/quantic"];var Tl=()=>ze,Zm=()=>J,Xr=V("configuration/updateBasicConfiguration",e=>W(e,{accessToken:ze,environment:new te({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:ze})),Bs=V("configuration/updateSearchConfiguration",e=>W(e,{proxyBaseUrl:new te({required:!1,url:!0}),pipeline:new te({required:!1,emptyAllowed:!0}),searchHub:ze,timezone:ze,locale:ze,authenticationProviders:new Mt({required:!1,each:J})})),nE={enabled:new Ue({default:!0}),originContext:Tl(),originLevel2:Tl(),originLevel3:Tl(),proxyBaseUrl:new te({required:!1,url:!0}),runtimeEnvironment:new $n,anonymous:new Ue({default:!1}),deviceId:ze,userDisplayName:ze,documentLocation:ze,trackingId:$m,analyticsMode:new te({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Re({options:{required:!1},values:Xm.reduce((e,t)=>(e[t]=Bm,e),{})})},$s=V("configuration/updateAnalyticsConfiguration",e=>W(e,nE)),Hs=V("configuration/analytics/disable"),Qs=V("configuration/analytics/enable"),Jm=V("configuration/analytics/originlevel2",e=>W(e,{originLevel2:Zm()})),eg=V("configuration/analytics/originlevel3",e=>W(e,{originLevel3:Zm()})),tg=V("knowledge/setAgentId",e=>W(e,new te({required:!0})));m();d();f();p();var rE=V("history/undo"),oE=V("history/redo"),$t=V("history/snapshot"),Ij=Ie("history/back",/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,{dispatch:t}){t(rE()),yield t(zs())});return function(_x11,_x12){return _ref3.apply(this,arguments)}}()),Rj=Ie("history/forward",/*#__PURE__*/function(){var _ref4=_asyncToGenerator(function*(e,{dispatch:t}){t(oE()),yield t(zs())});return function(_x13,_x14){return _ref4.apply(this,arguments)}}()),zs=Ie("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 Zr=()=>"default";var ng=Qe(Zr(),e=>{e.addCase(Gs,(t,n)=>n.payload).addCase(zs.fulfilled,(t,n)=>n.payload?.searchHub??t).addCase(Bs,(t,n)=>n.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function rg(){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 og=/^(?:[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 iE(e){return typeof e=="string"&&og.test(e)}var kl=iE;m();d();f();p();var Je=[];for(let e=0;e<256;++e)Je.push((e+256).toString(16).slice(1));function ig(e,t=0){return(Je[e[t+0]]+Je[e[t+1]]+Je[e[t+2]]+Je[e[t+3]]+"-"+Je[e[t+4]]+Je[e[t+5]]+"-"+Je[e[t+6]]+Je[e[t+7]]+"-"+Je[e[t+8]]+Je[e[t+9]]+"-"+Je[e[t+10]]+Je[e[t+11]]+Je[e[t+12]]+Je[e[t+13]]+Je[e[t+14]]+Je[e[t+15]]).toLowerCase()}m();d();f();p();var sE=new Uint8Array(16);function _l(){return crypto.getRandomValues(sE)}m();d();f();p();function aE(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():cE(e,t,n)}function cE(e,t,n){e=e||{};let r=e.random??e.rng?.()??_l();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return ig(r)}var Ol=aE;function uE(_x17){return _uE.apply(this,arguments)}function _uE(){_uE=_asyncToGenerator(function*({config:e,environment:t,event:n,listenerManager:r}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return r.call(n),t.send(o,i,n)});return _uE.apply(this,arguments)}var dg="2.1.3",Pl=128,pg=192,sg=224,ag=240,lE=248;function dE(e){return(e&lE)===ag?4:(e&ag)===sg?3:(e&sg)===pg?2:1}function pE(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&e.charAt(n-3)=="%";){let r=Number.parseInt(e.substring(n-2,n),16);if((r&Pl)!=Pl)break;if(n-=3,(r&pg)!=Pl){t-n>=dE(r)*3&&(n=t);break}}return e.substring(0,n)}function fE(e){let{trackingId:t}=e;return{trackingId:t}}function mE(e){return(e.source||[]).concat([`relay@${dg}`])}function fg(e,t,n){let{getReferrer:r,getLocation:o,getUserAgent:i}=n,s=fE(t),a=n.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:mE(t),clientId:a,userAgent:i(),referrer:cg(r()),location:cg(o())})}function cg(e){return e!==null?pE(e,1024):null}function gE(e,t,n,r){return{...t,meta:fg(e,n,r)}}var hE="*";function yE(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function n(u,c){return u.type==="*"||c===u.type}function r(u){return t(u)<0&&e.push(u),()=>a(u.type,u.callback)}function o(u){e.forEach(c=>{if(n(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===hE)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function s(u){let c=t(u);c>=0&&e.splice(c,1)}function a(u,c){c?s({type:u,callback:c}):i(u)}return{add:r,call:o,remove:a}}function ug({url:e,token:t,trackingId:n,...r}){return Object.freeze({url:e,token:t,trackingId:n,...(!!r.mode&&{mode:r.mode}),...(!!r.source&&{source:r.source}),...(!!r.environment&&{environment:r.environment})})}function vE(e){let t=ug(e);return{get:()=>t,update:n=>{t=ug({...t,...n})}}}var Nl=SE();function SE(){let e="coveo_",t=n=>{let r=n.split(".").slice(-2);return r.length==2?r.join("."):""};return{getItem(n){let r=`${e}${n}=`,o=document.cookie.split(";");for(let i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(r,0)===0)return s.substring(r.length,s.length)}return null},setItem(n,r,o){let i=t(window.location.hostname),s=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${n}=${r}${s}${a};path=/;SameSite=Lax`},removeItem(n){this.setItem(n,"",-1)}}}function bE(){return{getItem(e){return Nl.getItem(e)||localStorage.getItem(e)},removeItem(e){Nl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Nl.setItem(e,t,31556952e3)}}}var lg="visitorId";function AE(){let e=document.referrer;return e===""?null:e}function Fl(){let e=bE();return{runtime:"browser",send:function(){var _send=_asyncToGenerator(function*(t,n,r){let o=E(t,{method:"POST",body:JSON.stringify([r]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});rg().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:t,token:n});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let u of a.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});function send(_x18,_x19,_x20){return _send.apply(this,arguments)}return send}(),getReferrer:()=>AE(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(lg);if(t&&kl(t))return t;let n=Ol();return e.setItem(lg,n),n}}}function wE(){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 CE(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function EE(e){let t=e.get().mode!=="disabled",n=e.get().environment,r=CE();return t&&n?{...n,runtime:"custom"}:t&&xE()&&wE()?Fl():r}function xE(){try{return typeof window=="object"}catch{return!1}}function IE(e){return{get:()=>Object.freeze(EE(e))}}function mg(e){let t=vE(e),n=yE(),r=IE(t);return{emit:function(){var _emit=_asyncToGenerator(function*(o,i){let s=t.get(),a=r.get(),u=gE(o,i,s,a);return uE({config:s,environment:a,event:u,listenerManager:n})});function emit(_x21,_x22){return _emit.apply(this,arguments)}return emit}(),getMeta:o=>fg(o,t.get(),r.get()),on:(o,i)=>n.add({type:o,callback:i}),off:(o,i)=>n.remove(o,i),updateConfig:o=>t.update(o),version:dg}}m();d();f();p();function gg(){return typeof window<"u"&&typeof document<"u"}m();d();f();p();var Jr=Be(e=>e.source,e=>Object.entries(e).map(([t,n])=>`${t}@${n}`).concat(`@coveo/headless@${Yr}`));var RE=50,TE=Ts({memoize:Al,memoizeOptions:{maxSize:RE}}),fi=TE(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Jr(e.configuration.analytics),(e,t)=>t,(e,t,n,{trackingId:r,apiBaseUrl:o,enabled:i},s,a)=>{let u=_E(a);return mg({mode:i?"emit":"disabled",url:o??is(e,t),token:n,trackingId:r??null,source:s,environment:u})}),kE={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _send2=_asyncToGenerator(function*(){});function send(){return _send2.apply(this,arguments)}return send}()},_E=e=>{if(!e)return;let t=e();return{...(gg()?Fl():kE),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();m();d();f();p();m();d();f();p();var hg=class extends Error{constructor(t){super(t[0].message);se(this,"issues");this.name="SchemaError",this.issues=t}};var $l="uninitialized",Ll="pending",jl="fulfilled",Ul="rejected";function yg(e){return{status:e,isUninitialized:e===$l,isLoading:e===Ll,isSuccess:e===jl,isError:e===Ul}}var vg=Gt;function Pg(e,t){if(e===t||!(vg(e)&&vg(t)||Array.isArray(e)&&Array.isArray(t)))return t;let n=Object.keys(t),r=Object.keys(e),o=n.length===r.length,i=Array.isArray(t)?[]:{};for(let s of n)i[s]=Pg(e[s],t[s]),o&&(o=e[s]===i[s]);return o?e:i}function ql(e,t,n){return e.reduce((r,o,i)=>(t(o,i)&&r.push(n(o,i)),r),[]).flat()}function OE(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function PE(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Hl(e){return e!=null}function Sg(e){return[...(e?.values()??[])].filter(Hl)}function NE(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var FE=e=>e.replace(/\/$/,""),DE=e=>e.replace(/^\//,"");function ME(e,t){if(!e)return t;if(!t)return e;if(OE(t))return t;let n=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=FE(e),t=DE(t),`${e}${n}${t}`}function Xs(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var Vl=()=>new Map,LE=e=>{let t=new l.AbortController;return setTimeout(()=>{let n="signal timed out",r="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(n,r):Object.assign(new Error(n),{name:r}))},e),t.signal},jE=(...e)=>{for(let n of e)if(n.aborted)return l.AbortSignal.abort(n.reason);let t=new l.AbortController;for(let n of e)n.addEventListener("abort",()=>t.abort(n.reason),{signal:t.signal,once:!0});return t.signal},bg=(...e)=>E(...e),UE=e=>e.status>=200&&e.status<=299,qE=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Ag(e){if(!Gt(e))return e;let t={...e};for(let[n,r]of Object.entries(t))r===void 0&&delete t[n];return t}var VE=e=>typeof e=="object"&&(Gt(e)||Array.isArray(e)||typeof e.toJSON=="function");function Ng({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:n=bg,paramsSerializer:r,isJsonContentType:o=qE,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:u,validateStatus:c,...g}={}){return typeof E>"u"&&n===bg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(function*(x,h,y){let{getState:b,extra:w,endpoint:R,forced:N,type:k}=h,P,{url:A,headers:O=new I(g.headers),params:_=void 0,responseHandler:T=u??"json",validateStatus:D=c??UE,timeout:q=a,...M}=typeof x=="string"?{url:x}:x,L={...g,signal:q?jE(h.signal,LE(q)):h.signal,...M};O=new I(Ag(O)),L.headers=(yield t(O,{getState:b,arg:x,extra:w,endpoint:R,forced:N,type:k,extraOptions:y}))||O;let G=VE(L.body);if(L.body!=null&&!G&&typeof L.body!="string"&&L.headers.delete("content-type"),!L.headers.has("content-type")&&G&&L.headers.set("content-type",i),G&&o(L.headers)&&(L.body=JSON.stringify(L.body,s)),L.headers.has("accept")||(T==="json"?L.headers.set("accept","application/json"):T==="text"&&L.headers.set("accept","text/plain, text/html, */*")),_){let Y=~A.indexOf("?")?"&":"?",ie=r?r(_):new URLSearchParams(Ag(_));A+=Y+ie}A=ME(e,A);let j=new Request(A,L);P={request:new Request(A,L)};let Q;try{Q=yield n(j)}catch(Y){return{error:{status:(Y instanceof Error||typeof DOMException<"u"&&Y instanceof DOMException)&&Y.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Y)},meta:P}}let $=Q.clone();P.response=$;let K,H="";try{let Y;if(yield Promise.all([v(Q,T).then(ie=>K=ie,ie=>Y=ie),$.text().then(ie=>H=ie,()=>{})]),Y)throw Y}catch(Y){return{error:{status:"PARSING_ERROR",originalStatus:Q.status,data:H,error:String(Y)},meta:P}}return D(Q,K)?{data:K,meta:P}:{error:{status:Q.status,data:K},meta:P}});return function(_x23,_x24,_x25){return _ref6.apply(this,arguments)}}());function v(_x26,_x27){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let y=yield x.text();return y.length?JSON.parse(y):null}return x.text()});return _v2.apply(this,arguments)}}var eo=class{constructor(e,t=void 0){se(this,"value");se(this,"meta");this.value=e,this.meta=t}};function GE(){return _GE.apply(this,arguments)}function _GE(){_GE=_asyncToGenerator(function*(e=0,t=5,n){let r=Math.min(e,t),o=~~((Math.random()+.4)*(300<<r));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(n){let u=()=>{clearTimeout(a),s(new Error("Aborted"))};n.aborted?(clearTimeout(a),s(new Error("Aborted"))):n.addEventListener("abort",u,{once:!0})}})});return _GE.apply(this,arguments)}function Fg(e,t){throw Object.assign(new eo({error:e,meta:t}),{throwImmediately:!0})}function Dl(e){e.aborted&&Fg({status:"CUSTOM_ERROR",error:"Aborted"})}var wg={},BE=(e,t)=>(/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,r,o){let[i]=[5,(t||wg).maxRetries,(o||wg).maxRetries].filter(c=>c!==void 0).slice(-1),a={maxRetries:i,backoff:GE,retryCondition:(c,g,{attempt:v})=>v<=i,...t,...o},u=0;for(;;){Dl(r.signal);try{let c=yield e(n,r,o);if(c.error)throw new eo(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof eo)return c.value;throw c}if(c instanceof eo){if(!a.retryCondition(c.value.error,n,{attempt:u,baseQueryApi:r,extraOptions:o}))return c.value}else if(u>a.maxRetries)return{error:c};Dl(r.signal);try{yield a.backoff(u,a.maxRetries,r.signal)}catch(g){throw Dl(r.signal),g}}}});return function(_x28,_x29,_x30){return _ref7.apply(this,arguments)}}()),Dg=Object.assign(BE,{fail:Fg}),Js="__rtkq/",$E="online",HE="offline";var Mg="focused";var Ql=V(`${Js}${Mg}`),Lg=V(`${Js}un${Mg}`),zl=V(`${Js}${$E}`),jg=V(`${Js}${HE}`);var vi="query",Ug="mutation",qg="infinitequery";function ea(e){return e.type===vi}function QE(e){return e.type===Ug}function gi(e){return e.type===qg}function Zs(e){return ea(e)||gi(e)}function Wl(e,t,n,r,o,i){let s=zE(e)?e(t,n,r,o):e;return s?ql(s,Hl,a=>i(Vg(a))):[]}function zE(e){return typeof e=="function"}function Vg(e){return typeof e=="string"?{type:e}:e}function WE(e,t){return e.catch(t)}var to=(e,t)=>e.endpointDefinitions[t],hi=Symbol("forceQueryFn"),Gl=e=>typeof e[hi]=="function";function KE({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:n,mutationThunk:r,api:o,context:i,getInternalState:s}){let a=A=>s(A)?.runningQueries,u=A=>s(A)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:v}=o.internalActions;return{buildInitiateQuery:N,buildInitiateInfiniteQuery:k,buildInitiateMutation:P,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function x(A,O){return _=>{let T=e({queryArgs:O,endpointDefinition:to(i,A),endpointName:A});return a(_)?.get(T)}}function h(A,O){return _=>u(_)?.get(O)}function y(){return A=>Sg(a(A))}function b(){return A=>Sg(u(A))}function w(A){}function R(A,O){let _=(T,{subscribe:D=!0,forceRefetch:q,subscriptionOptions:M,[hi]:L,...G}={})=>(j,Q)=>{let $=e({queryArgs:T,endpointDefinition:O,endpointName:A}),K,H={...G,type:vi,subscribe:D,forceRefetch:q,subscriptionOptions:M,endpointName:A,originalArgs:T,queryCacheKey:$,[hi]:L};if(ea(O))K=t(H);else{let{direction:de,initialPageParam:ve,refetchCachedPages:he}=G;K=n({...H,direction:de,initialPageParam:ve,refetchCachedPages:he})}let Y=o.endpoints[A].select(T),ie=j(K),me=Y(Q());let{requestId:xe,abort:je}=ie,_e=me.requestId!==xe,Pe=a(j)?.get($),Ne=()=>Y(Q()),ge=Object.assign(L?ie.then(Ne):_e&&!Pe?Promise.resolve(me):Promise.all([Pe,ie]).then(Ne),{arg:T,requestId:xe,subscriptionOptions:M,queryCacheKey:$,abort:je,unwrap(){return _asyncToGenerator(function*(){let de=yield ge;if(de.isError)throw de.error;return de.data})()},refetch:de=>j(_(T,{subscribe:!1,forceRefetch:!0,...de})),unsubscribe(){D&&j(c({queryCacheKey:$,requestId:xe}))},updateSubscriptionOptions(de){ge.subscriptionOptions=de,j(v({endpointName:A,requestId:xe,queryCacheKey:$,options:de}))}});if(!Pe&&!_e&&!L){let de=a(j);de.set($,ge),ge.then(()=>{de.delete($)})}return ge};return _}function N(A,O){return R(A,O)}function k(A,O){return R(A,O)}function P(A){return(O,{track:_=!0,fixedCacheKey:T}={})=>(D,q)=>{let M=D(r({type:"mutation",endpointName:A,originalArgs:O,track:_,fixedCacheKey:T}));let{requestId:L,abort:G,unwrap:j}=M,Q=WE(M.unwrap().then(Y=>({data:Y})),Y=>({error:Y})),$=()=>{D(g({requestId:L,fixedCacheKey:T}))},K=Object.assign(Q,{arg:M.arg,requestId:L,abort:G,unwrap:j,reset:$}),H=u(D);return H.set(L,K),K.then(()=>{H.delete(L)}),T&&(H.set(T,K),K.then(()=>{H.get(T)===K&&H.delete(T)})),K}}}var Gg=class extends hg{constructor(t,n,r,o){super(t);se(this,"value");se(this,"schemaName");se(this,"_bqMeta");this.value=n,this.schemaName=r,this._bqMeta=o}},er=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function tr(_x31,_x32,_x33,_x34){return _tr.apply(this,arguments)}function _tr(){_tr=_asyncToGenerator(function*(e,t,n,r){let o=yield e["~standard"].validate(t);if(o.issues)throw new Gg(o.issues,t,n,r);return o.value});return _tr.apply(this,arguments)}function Cg(e){return e}var mi=(e={})=>({...e,[ui]:!0});function YE({reducerPath:e,baseQuery:t,context:{endpointDefinitions:n},serializeQueryArgs:r,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:u,skipSchemaValidation:c}){let g=(M,L,G,j)=>(Q,$)=>{let K=n[M],H=r({queryArgs:L,endpointDefinition:K,endpointName:M});if(Q(o.internalActions.queryResultPatched({queryCacheKey:H,patches:G})),!j)return;let Y=o.endpoints[M].select(L)($()),ie=Wl(K.providesTags,Y.data,void 0,L,{},i);Q(o.internalActions.updateProvidedBy([{queryCacheKey:H,providedTags:ie}]))};function v(M,L,G=0){let j=[L,...M];return G&&j.length>G?j.slice(0,-1):j}function x(M,L,G=0){let j=[...M,L];return G&&j.length>G?j.slice(1):j}let h=(M,L,G,j=!0)=>(Q,$)=>{let K=o.endpoints[M].select(L)($()),H={patches:[],inversePatches:[],undo:()=>Q(o.util.patchQueryData(M,L,H.inversePatches,j))};if(K.status==="uninitialized")return H;let Y;if("data"in K)if(st(K.data)){let[ie,me,xe]=vl(K.data,G);H.patches.push(...me),H.inversePatches.push(...xe),Y=ie}else Y=G(K.data),H.patches.push({op:"replace",path:[],value:Y}),H.inversePatches.push({op:"replace",path:[],value:K.data});return H.patches.length===0||Q(o.util.patchQueryData(M,L,H.patches,j)),H},y=(M,L,G)=>j=>j(o.endpoints[M].initiate(L,{subscribe:!1,forceRefetch:!0,[hi]:()=>({data:G})})),b=(M,L)=>M.query&&M[L]?M[L]:Cg,w=/*#__PURE__*/function(){var _w2=_asyncToGenerator(function*(M,{signal:L,abort:G,rejectWithValue:j,fulfillWithValue:Q,dispatch:$,getState:K,extra:H}){let Y=n[M.endpointName],{metaSchema:ie,skipSchemaValidation:me=c}=Y,xe=M.type===vi;try{let je=Cg,_e={signal:L,abort:G,dispatch:$,getState:K,extra:H,endpoint:M.endpointName,type:M.type,forced:xe?R(M,K()):void 0,queryCacheKey:xe?M.queryCacheKey:void 0},Pe=xe?M[hi]:void 0,Ne,ge=/*#__PURE__*/function(){var _ge=_asyncToGenerator(function*(ve,he,Ge,We){if(he==null&&ve.pages.length)return Promise.resolve({data:ve});let Ct=yield de({queryArg:M.originalArgs,pageParam:he}),ht=We?v:x;return{data:{pages:ht(ve.pages,Ct.data,Ge),pageParams:ht(ve.pageParams,he,Ge)},meta:Ct.meta}});function ge(_x37,_x38,_x39,_x40){return _ge.apply(this,arguments)}return ge}();function de(_x41){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(ve){let he,{extraOptions:Ge,argSchema:We,rawResponseSchema:Ct,responseSchema:ht}=Y;if(We&&!er(me,"arg")&&(ve=yield tr(We,ve,"argSchema",{})),Pe?he=Pe():Y.query?(je=b(Y,"transformResponse"),he=yield t(Y.query(ve),_e,Ge)):he=yield Y.queryFn(ve,_e,Ge,rn=>t(rn,_e,Ge)),typeof process<"u",he.error)throw new eo(he.error,he.meta);let{data:Nt}=he;Ct&&!er(me,"rawResponse")&&(Nt=yield tr(Ct,he.data,"rawResponseSchema",he.meta));let Et=yield je(Nt,he.meta,ve);return ht&&!er(me,"response")&&(Et=yield tr(ht,Et,"responseSchema",he.meta)),{...he,data:Et}});return _de.apply(this,arguments)}if(xe&&"infiniteQueryOptions"in Y){let{infiniteQueryOptions:ve}=Y,{maxPages:he=1/0}=ve,Ge=M.refetchCachedPages??ve.refetchCachedPages??!0,We,Ct={pages:[],pageParams:[]},ht=s.selectQueryEntry(K(),M.queryCacheKey)?.data,Nt=R(M,K())&&!M.direction||!ht?Ct:ht;if("direction"in M&&M.direction&&Nt.pages.length){let Et=M.direction==="backward";We=yield ge(Nt,(Et?Bl:Ys)(ve,Nt,M.originalArgs),he,Et)}else{let{initialPageParam:Et=ve.initialPageParam}=M,rn=ht?.pageParams??[],Nu=rn[0]??Et,af=rn.length;if(We=yield ge(Nt,Nu,he),Pe&&(We={data:We.data.pages[0]}),Ge)for(let cf=1;cf<af;cf++){let xA=Ys(ve,We.data,M.originalArgs);We=yield ge(We.data,xA,he)}}Ne=We}else Ne=yield de(M.originalArgs);return ie&&!er(me,"meta")&&Ne.meta&&(Ne.meta=yield tr(ie,Ne.meta,"metaSchema",Ne.meta)),Q(Ne.data,mi({fulfilledTimeStamp:Date.now(),baseQueryMeta:Ne.meta}))}catch(je){let _e=je;if(_e instanceof eo){let Pe=b(Y,"transformErrorResponse"),{rawErrorResponseSchema:Ne,errorResponseSchema:ge}=Y,{value:de,meta:ve}=_e;try{Ne&&!er(me,"rawErrorResponse")&&(de=yield tr(Ne,de,"rawErrorResponseSchema",ve)),ie&&!er(me,"meta")&&(ve=yield tr(ie,ve,"metaSchema",ve));let he=yield Pe(de,ve,M.originalArgs);return ge&&!er(me,"errorResponse")&&(he=yield tr(ge,he,"errorResponseSchema",ve)),j(he,mi({baseQueryMeta:ve}))}catch(he){_e=he}}try{if(_e instanceof Gg){let Pe={endpoint:M.endpointName,arg:M.originalArgs,type:M.type,queryCacheKey:xe?M.queryCacheKey:void 0};Y.onSchemaFailure?.(_e,Pe),a?.(_e,Pe);let{catchSchemaFailure:Ne=u}=Y;if(Ne)return j(Ne(_e,Pe),mi({baseQueryMeta:_e._bqMeta}))}}catch(Pe){_e=Pe}throw typeof process<"u",console.error(_e),_e}});function w(_x35,_x36){return _w2.apply(this,arguments)}return w}();function R(M,L){let G=s.selectQueryEntry(L,M.queryCacheKey),j=s.selectConfig(L).refetchOnMountOrArgChange,Q=G?.fulfilledTimeStamp,$=M.forceRefetch??(M.subscribe&&j);return $?$===!0||(Number(new Date)-Number(Q))/1e3>=$:!1}let N=()=>Ie(`${e}/executeQuery`,w,{getPendingMeta({arg:M}){let L=n[M.endpointName];return mi({startedTimeStamp:Date.now(),...(gi(L)?{direction:M.direction}:{})})},condition(M,{getState:L}){let G=L(),j=s.selectQueryEntry(G,M.queryCacheKey),Q=j?.fulfilledTimeStamp,$=M.originalArgs,K=j?.originalArgs,H=n[M.endpointName],Y=M.direction;if(Gl(M))return!0;if(j?.status==="pending")return!1;if(R(M,G)||ea(H)&&H?.forceRefetch?.({currentArg:$,previousArg:K,endpointState:j,state:G}))return!0;if(Q&&!Y)return!1;if(Y&&gi(H)){let ie=j?.data;if(ie?.pages.length){let{infiniteQueryOptions:me}=H;if((Y==="forward"?Ys:Bl)(me,ie,$)==null)return!1}}return!0},dispatchConditionRejection:!0}),k=N(),P=N(),A=Ie(`${e}/executeMutation`,w,{getPendingMeta(){return mi({startedTimeStamp:Date.now()})}}),O=M=>"force"in M,_=M=>"ifOlderThan"in M,T=(M,L,G={})=>(j,Q)=>{let $=O(G)&&G.force,K=_(G)&&G.ifOlderThan,H=(ie=!0)=>{let me={forceRefetch:ie,subscribe:!1};return o.endpoints[M].initiate(L,me)},Y=o.endpoints[M].select(L)(Q());if($)j(H());else if(K){let ie=Y?.fulfilledTimeStamp;if(!ie){j(H());return}(Number(new Date)-Number(new Date(ie)))/1e3>=K&&j(H())}else j(H(!1))};function D(M){return L=>L?.meta?.arg?.endpointName===M}function q(M,L){return{matchPending:Wr(Fs(M),D(L)),matchFulfilled:Wr(cn(M),D(L)),matchRejected:Wr(Zn(M),D(L))}}return{queryThunk:k,mutationThunk:A,infiniteQueryThunk:P,prefetch:T,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:q}}function Ys(e,{pages:t,pageParams:n},r){let o=t.length-1;return e.getNextPageParam(t[o],t,n[o],n,r)}function Bl(e,{pages:t,pageParams:n},r){return e.getPreviousPageParam?.(t[0],t,n[0],n,r)}function Bg(e,t,n,r){return Wl(n[e.meta.arg.endpointName][t],cn(e)?e.payload:void 0,di(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function Eg(e){return lt(e)?Is(e):e}function Ws(e,t,n){let r=e[t];r&&n(r)}function yi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function xg(e,t,n){let r=e[yi(t)];r&&n(r)}var Ks={};function XE({reducerPath:e,queryThunk:t,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:u,config:c}){let g=V(`${e}/resetApiState`);function v(_,T,D,q){var M;_[M=T.queryCacheKey]??(_[M]={status:$l,endpointName:T.endpointName}),Ws(_,T.queryCacheKey,L=>{L.status=Ll,L.requestId=D&&L.requestId?L.requestId:q.requestId,T.originalArgs!==void 0&&(L.originalArgs=T.originalArgs),L.startedTimeStamp=q.startedTimeStamp;let G=o[q.arg.endpointName];gi(G)&&"direction"in T&&(L.direction=T.direction)})}function x(_,T,D,q){Ws(_,T.arg.queryCacheKey,M=>{if(M.requestId!==T.requestId&&!q)return;let{merge:L}=o[T.arg.endpointName];if(M.status=jl,L){if(M.data!==void 0){let{fulfilledTimeStamp:G,arg:j,baseQueryMeta:Q,requestId:$}=T;M.data=Yn(M.data,K=>L(K,D,{arg:j.originalArgs,baseQueryMeta:Q,fulfilledTimeStamp:G,requestId:$}))}else M.data=D;}else M.data=o[T.arg.endpointName].structuralSharing??!0?Pg(lt(M.data)?hl(M.data):M.data,D):D;delete M.error,M.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=Jn({name:`${e}/queries`,initialState:Ks,reducers:{removeQueryResult:{reducer(_,{payload:{queryCacheKey:T}}){delete _[T]},prepare:Kr()},cacheEntriesUpserted:{reducer(_,T){for(let D of T.payload){let{queryDescription:q,value:M}=D;v(_,q,!0,{arg:q,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),x(_,{arg:q,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},M,!0)}},prepare:_=>({payload:_.map(T=>{let{endpointName:D,arg:q,value:M}=T,L=o[D];return{queryDescription:{type:vi,endpointName:D,originalArgs:T.arg,queryCacheKey:r({queryArgs:q,endpointDefinition:L,endpointName:D})},value:M}}),meta:{[ui]:!0,requestId:pi(),timestamp:Date.now()}})},queryResultPatched:{reducer(_,{payload:{queryCacheKey:T,patches:D}}){Ws(_,T,q=>{q.data=Sl(q.data,D.concat())})},prepare:Kr()}},extraReducers(_){_.addCase(t.pending,(T,{meta:D,meta:{arg:q}})=>{v(T,q,Gl(q),D)}).addCase(t.fulfilled,(T,{meta:D,payload:q})=>{x(T,D,q,Gl(D.arg))}).addCase(t.rejected,(T,{meta:{condition:D,arg:q,requestId:M},error:L,payload:G})=>{Ws(T,q.queryCacheKey,j=>{if(!D){if(j.requestId!==M)return;j.status=Ul,j.error=G??L}})}).addMatcher(a,(T,D)=>{let{queries:q}=s(D);for(let[M,L]of Object.entries(q))(L?.status==="fulfilled"||L?.status==="rejected")&&(T[M]=L)})}}),y=Jn({name:`${e}/mutations`,initialState:Ks,reducers:{removeMutationResult:{reducer(_,{payload:T}){let D=yi(T);D in _&&delete _[D]},prepare:Kr()}},extraReducers(_){_.addCase(n.pending,(T,{meta:D,meta:{requestId:q,arg:M,startedTimeStamp:L}})=>{M.track&&(T[yi(D)]={requestId:q,status:Ll,endpointName:M.endpointName,startedTimeStamp:L})}).addCase(n.fulfilled,(T,{payload:D,meta:q})=>{q.arg.track&&xg(T,q,M=>{M.requestId===q.requestId&&(M.status=jl,M.data=D,M.fulfilledTimeStamp=q.fulfilledTimeStamp)})}).addCase(n.rejected,(T,{payload:D,error:q,meta:M})=>{M.arg.track&&xg(T,M,L=>{L.requestId===M.requestId&&(L.status=Ul,L.error=D??q)})}).addMatcher(a,(T,D)=>{let{mutations:q}=s(D);for(let[M,L]of Object.entries(q))(L?.status==="fulfilled"||L?.status==="rejected")&&M!==L?.requestId&&(T[M]=L)})}}),b=Jn({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(_,T){var D,q,M;for(let{queryCacheKey:L,providedTags:G}of T.payload){w(_,L);for(let{type:j,id:Q}of G){let $=(q=(D=_.tags)[j]??(D[j]={}))[M=Q??"__internal_without_id"]??(q[M]=[]);$.includes(L)||$.push(L)}_.keys[L]=G}},prepare:Kr()}},extraReducers(_){_.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:D}})=>{w(T,D)}).addMatcher(a,(T,D)=>{var M,L,G;let{provided:q}=s(D);for(let[j,Q]of Object.entries(q.tags??{}))for(let[$,K]of Object.entries(Q)){let H=(L=(M=T.tags)[j]??(M[j]={}))[G=$??"__internal_without_id"]??(L[G]=[]);for(let Y of K)H.includes(Y)||H.push(Y),T.keys[Y]=q.keys[Y]}}).addMatcher(Bt(cn(t),di(t)),(T,D)=>{R(T,[D])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,D)=>{R(T,D.payload.map(({queryDescription:q,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:q}})))})}});function w(_,T){let D=Eg(_.keys[T]??[]);for(let q of D){let M=q.type,L=q.id??"__internal_without_id",G=_.tags[M]?.[L];G&&(_.tags[M][L]=Eg(G).filter(j=>j!==T))}delete _.keys[T]}function R(_,T){let D=T.map(q=>{let M=Bg(q,"providesTags",o,u),{queryCacheKey:L}=q.meta.arg;return{queryCacheKey:L,providedTags:M}});b.caseReducers.updateProvidedBy(_,b.actions.updateProvidedBy(D))}let N=Jn({name:`${e}/subscriptions`,initialState:Ks,reducers:{updateSubscriptionOptions(_,T){},unsubscribeQueryResult(_,T){},internal_getRTKQSubscriptions(){}}}),k=Jn({name:`${e}/internalSubscriptions`,initialState:Ks,reducers:{subscriptionsUpdated:{reducer(_,T){return Sl(_,T.payload)},prepare:Kr()}}}),P=Jn({name:`${e}/config`,initialState:{online:NE(),focused:PE(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(_,{payload:T}){_.middlewareRegistered=_.middlewareRegistered==="conflict"||i!==T?"conflict":!0}},extraReducers:_=>{_.addCase(zl,T=>{T.online=!0}).addCase(jg,T=>{T.online=!1}).addCase(Ql,T=>{T.focused=!0}).addCase(Lg,T=>{T.focused=!1}).addMatcher(a,T=>({...T}))}}),A=Hn({queries:h.reducer,mutations:y.reducer,provided:b.reducer,subscriptions:k.reducer,config:P.reducer});return{reducer:(_,T)=>A(g.match(T)?void 0:_,T),actions:{...P.actions,...h.actions,...N.actions,...k.actions,...y.actions,...b.actions,resetApiState:g}}}var Ml=Symbol.for("RTKQ/skipToken"),$g={status:$l},Ig=Yn($g,()=>{}),Rg=Yn($g,()=>{});function ZE({serializeQueryArgs:e,reducerPath:t,createSelector:n}){let r=k=>Ig,o=k=>Rg;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:s,selectQueries:a,selectMutations:c,selectQueryEntry:u,selectConfig:g};function i(k){return{...k,...yg(k.status)}}function s(k){return k[t]}function a(k){return s(k)?.queries}function u(k,P){return a(k)?.[P]}function c(k){return s(k)?.mutations}function g(k){return s(k)?.config}function v(k,P,A){return O=>{if(O===Ml)return n(r,A);let _=e({queryArgs:O,endpointDefinition:P,endpointName:k});return n(D=>u(D,_)??Ig,A)}}function x(k,P){return v(k,P,i)}function h(k,P){let{infiniteQueryOptions:A}=P;function O(_){let T={..._,...yg(_.status)},{isLoading:D,isError:q,direction:M}=T,L=M==="forward",G=M==="backward";return{...T,hasNextPage:R(A,T.data,T.originalArgs),hasPreviousPage:N(A,T.data,T.originalArgs),isFetchingNextPage:D&&L,isFetchingPreviousPage:D&&G,isFetchNextPageError:q&&L,isFetchPreviousPageError:q&&G}}return v(k,P,O)}function y(){return k=>{let P;return typeof k=="object"?P=yi(k)??Ml:P=k,n(P===Ml?o:O=>s(O)?.mutations?.[P]??Rg,i)}}function b(k,P){let A=k[t],O=new Set,_=ql(P,Hl,Vg);for(let T of _){let D=A.provided.tags[T.type];if(!D)continue;let q=(T.id!==void 0?D[T.id]:Object.values(D).flat())??[];for(let M of q)O.add(M)}return Array.from(O.values()).flatMap(T=>{let D=A.queries[T];return D?{queryCacheKey:T,endpointName:D.endpointName,originalArgs:D.originalArgs}:[]})}function w(k,P){return ql(Object.values(a(k)),A=>A?.endpointName===P&&A.status!=="uninitialized",A=>A.originalArgs)}function R(k,P,A){return P?Ys(k,P,A)!=null:!1}function N(k,P,A){return!P||!k.getPreviousPageParam?!1:Bl(k,P,A)!=null}}var Tg=WeakMap?new WeakMap:void 0,kg=({endpointName:e,queryArgs:t})=>{let n="",r=Tg?.get(t);if(typeof r=="string")n=r;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=Gt(s)?Object.keys(s).sort().reduce((a,u)=>(a[u]=s[u],a),{}):s,s));Gt(t)&&Tg?.set(t,o),n=o}return`${e}(${n})`};function JE(...e){return function(n){let r=Qr(c=>n.extractRehydrationInfo?.(c,{reducerPath:n.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...n,extractRehydrationInfo:r,serializeQueryArgs(c){let g=kg;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let v=c.endpointDefinition.serializeQueryArgs;g=x=>{let h=v(x);return typeof h=="string"?h:kg({...x,queryArgs:h})}}else n.serializeQueryArgs&&(g=n.serializeQueryArgs);return g(c)},tagTypes:[...(n.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:pi(),extractRehydrationInfo:r,hasRehydrationInfo:Qr(c=>r(c)!=null)},s={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,x]of Object.entries(g))typeof x=="function"?x(to(i,v)):Object.assign(to(i,v)||{},x);return s}},a=e.map(c=>c.init(s,o,i));function u(c){let g=c.endpoints({query:v=>({...v,type:vi}),mutation:v=>({...v,type:Ug}),infiniteQuery:v=>({...v,type:qg})});for(let[v,x]of Object.entries(g)){if(c.overrideExisting!==!0&&v in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(at(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=x;for(let h of a)h.injectEndpoint(v,x)}return s}return s.injectEndpoints({endpoints:n.endpoints})}}function un(e,...t){return Object.assign(e,...t)}var ex=({api:e,queryThunk:t,internalState:n,mwApi:r})=>{let o=`${e.reducerPath}/subscriptions`,i=null,s=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:u}=e.internalActions,c=(b,w)=>{if(a.match(w)){let{queryCacheKey:N,requestId:k,options:P}=w.payload,A=b.get(N);return A?.has(k)&&A.set(k,P),!0}if(u.match(w)){let{queryCacheKey:N,requestId:k}=w.payload,P=b.get(N);return P&&P.delete(k),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:N,requestId:k}}=w,P=Xs(b,N.queryCacheKey,Vl);return N.subscribe&&P.set(k,N.subscriptionOptions??P.get(k)??{}),!0}let R=!1;if(t.rejected.match(w)){let{meta:{condition:N,arg:k,requestId:P}}=w;if(N&&k.subscribe){let A=Xs(b,k.queryCacheKey,Vl);A.set(P,k.subscriptionOptions??A.get(P)??{}),R=!0}}return R},g=()=>n.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,R])=>[w,Object.fromEntries(R)]))))}return(b,w)=>{if(i||(i=y(n.currentSubscriptions)),e.util.resetApiState.match(b))return i={},n.currentSubscriptions.clear(),s=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let R=c(n.currentSubscriptions,b),N=!0;if(R){s||(s=setTimeout(()=>{let A=y(n.currentSubscriptions),[,O]=vl(i,()=>A);w.next(e.internalActions.subscriptionsUpdated(O)),i=A,s=null},500));let k=typeof b.type=="string"&&!!b.type.startsWith(o),P=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;N=!k&&!P}return[N,!1]}},tx=2147483647/1e3-1,nx=({reducerPath:e,api:t,queryThunk:n,context:r,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:v}=t.internalActions,x=Bt(g.match,n.fulfilled,n.rejected,v.match);function h(k){let P=o.currentSubscriptions.get(k);return P?P.size>0:!1}let y={};function b(k){for(let P of k.values())P?.abort?.()}let w=(k,P)=>{let A=s(P.getState());if(x(k)){let O;if(v.match(k))O=k.payload.map(_=>_.queryDescription.queryCacheKey);else{let{queryCacheKey:_}=g.match(k)?k.payload:k.meta.arg;O=[_]}R(O,P,A)}if(t.util.resetApiState.match(k)){for(let[O,_]of Object.entries(y))_&&clearTimeout(_),delete y[O];b(o.runningQueries),b(o.runningMutations)}if(r.hasRehydrationInfo(k)){let{queries:O}=r.extractRehydrationInfo(k);R(Object.keys(O),P,A)}};function R(k,P,A){let O=P.getState();for(let _ of k){let T=i(O,_);T?.endpointName&&N(_,T.endpointName,P,A)}}function N(k,P,A,O){let _=to(r,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(_===1/0)return;let T=Math.max(0,Math.min(_,tx));if(!h(k)){let D=y[k];D&&clearTimeout(D),y[k]=setTimeout(()=>{if(!h(k)){let q=i(A.getState(),k);q?.endpointName&&A.dispatch(a(q.endpointName,q.originalArgs))?.abort(),A.dispatch(c({queryCacheKey:k}))}delete y[k]},T*1e3)}}return w},_g=new Error("Promise never resolved before cacheEntryRemoved."),rx=({api:e,reducerPath:t,context:n,queryThunk:r,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let u=Ds(r),c=Ds(o),g=cn(r,o),v={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(A,O,_){let T=v[A];T?.valueResolved&&(T.valueResolved({data:O,meta:_}),delete T.valueResolved)}function w(A){let O=v[A];O&&(delete v[A],O.cacheEntryRemoved())}function R(A){let{arg:O,requestId:_}=A.meta,{endpointName:T,originalArgs:D}=O;return[T,D,_]}let N=(A,O,_)=>{let T=k(A);function D(q,M,L,G){let j=s(_,M),Q=s(O.getState(),M);!j&&Q&&P(q,G,M,O,L)}if(r.pending.match(A)){let[q,M,L]=R(A);D(q,T,L,M)}else if(y.match(A))for(let{queryDescription:q,value:M}of A.payload){let{endpointName:L,originalArgs:G,queryCacheKey:j}=q;D(L,j,A.meta.requestId,G),b(j,M,{})}else if(o.pending.match(A)){if(O.getState()[t].mutations[T]){let[q,M,L]=R(A);P(q,M,T,O,L)}}else if(g(A))b(T,A.payload,A.meta.baseQueryMeta);else if(x.match(A)||h.match(A))w(T);else if(e.util.resetApiState.match(A))for(let q of Object.keys(v))w(q)};function k(A){return u(A)?A.meta.arg.queryCacheKey:c(A)?A.meta.arg.fixedCacheKey??A.meta.requestId:x.match(A)?A.payload.queryCacheKey:h.match(A)?yi(A.payload):""}function P(A,O,_,T,D){let q=to(n,A),M=q?.onCacheEntryAdded;if(!M)return;let L={},G=new Promise(H=>{L.cacheEntryRemoved=H}),j=Promise.race([new Promise(H=>{L.valueResolved=H}),G.then(()=>{throw _g})]);j.catch(()=>{}),v[_]=L;let Q=e.endpoints[A].select(Zs(q)?O:_),$=T.dispatch((H,Y,ie)=>ie),K=M(O,{...T,getCacheEntry:()=>Q(T.getState()),requestId:D,extra:$,updateCachedData:Zs(q)?H=>T.dispatch(e.util.updateQueryData(A,O,H)):void 0,cacheDataLoaded:j,cacheEntryRemoved:G});Promise.resolve(K).catch(H=>{if(H!==_g)throw H})}return N},ox=({api:e,context:{apiUid:t},reducerPath:n})=>(r,o)=>{e.util.resetApiState.match(r)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},ix=({reducerPath:e,context:t,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Bt(cn(r),di(r)),v=Bt(cn(o,r),Zn(o,r)),x=[],h=0,y=(R,N)=>{(o.pending.match(R)||r.pending.match(R))&&h++,v(R)&&!(o.rejected.match(R)&&R.meta.condition)&&(h=Math.max(0,h-1)),g(R)?w(Bg(R,"invalidatesTags",n,s),N):v(R)?w([],N):i.util.invalidateTags.match(R)&&w(Wl(R.payload,void 0,void 0,void 0,void 0,s),N)};function b(){return h>0}function w(R,N){let k=N.getState(),P=k[e];if(x.push(...R),P.config.invalidationBehavior==="delayed"&&b())return;let A=x;if(x=[],A.length===0)return;let O=i.util.selectInvalidatedBy(k,A);t.batch(()=>{let _=Array.from(O.values());for(let{queryCacheKey:T}of _){let D=P.queries[T],q=Xs(u.currentSubscriptions,T,Vl);D&&(q.size===0?N.dispatch(c({queryCacheKey:T})):D.status!=="uninitialized"&&N.dispatch(a(D)))}})}return y},sx=({reducerPath:e,queryThunk:t,api:n,refetchQuery:r,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,u=null,c=(w,R)=>{(n.internalActions.updateSubscriptionOptions.match(w)||n.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,R),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,R),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&v(w.meta.arg,R),n.util.resetApiState.match(w)&&(y(),u&&(clearTimeout(u),u=null),a.clear())};function g(w,R){a.add(w),u||(u=setTimeout(()=>{for(let N of a)x({queryCacheKey:N},R);a.clear(),u=null},0))}function v({queryCacheKey:w},R){let N=R.getState()[e].queries[w],k=s.get(w);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P,skipPollingIfUnfocused:A}=b(k);if(!Number.isFinite(P))return;let O=i.get(w);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let _=Date.now()+P;i.set(w,{nextPollTimestamp:_,pollingInterval:P,timeout:setTimeout(()=>{let T=R.getState()[e],D=T.queries[w];if(!D||D.status==="uninitialized"){h(w);return}(T.config.focused||!A)&&R.dispatch(r(D)),v({queryCacheKey:w},R)},P)})}function x({queryCacheKey:w},R){let N=R.getState()[e].queries[w],k=s.get(w);if(!N||N.status==="uninitialized")return;let{lowestPollingInterval:P}=b(k);if(!Number.isFinite(P)){h(w);return}let A=i.get(w),O=Date.now()+P;(!A||O<A.nextPollTimestamp)&&v({queryCacheKey:w},R)}function h(w){let R=i.get(w);R?.timeout&&clearTimeout(R.timeout),i.delete(w)}function y(){for(let w of i.keys())h(w)}function b(w=new Map){let R=!1,N=Number.POSITIVE_INFINITY;for(let k of w.values())k.pollingInterval&&(N=Math.min(k.pollingInterval,N),R=k.skipPollingIfUnfocused||R);return{lowestPollingInterval:N,skipPollingIfUnfocused:R}}return c},ax=({api:e,context:t,queryThunk:n,mutationThunk:r})=>{let o=Fs(n,r),i=Zn(n,r),s=cn(n,r),a={};return(c,g)=>{if(o(c)){let{requestId:v,arg:{endpointName:x,originalArgs:h}}=c.meta,y=to(t,x),b=y?.onQueryStarted;if(b){let w={},R=new Promise((P,A)=>{w.resolve=P,w.reject=A});R.catch(()=>{}),a[v]=w;let N=e.endpoints[x].select(Zs(y)?h:v),k=g.dispatch((P,A,O)=>O);b(h,{...g,getCacheEntry:()=>N(g.getState()),requestId:v,extra:k,updateCachedData:Zs(y)?P=>g.dispatch(e.util.updateQueryData(x,h,P)):void 0,queryFulfilled:R})}}else if(s(c)){let{requestId:v,baseQueryMeta:x}=c.meta;a[v]?.resolve({data:c.payload,meta:x}),delete a[v]}else if(i(c)){let{requestId:v,rejectedWithValue:x,baseQueryMeta:h}=c.meta;a[v]?.reject({error:c.payload??c.error,isUnhandledError:!x,meta:h}),delete a[v]}}},cx=({reducerPath:e,context:t,api:n,refetchQuery:r,internalState:o})=>{let{removeQueryResult:i}=n.internalActions,s=(u,c)=>{Ql.match(u)&&a(c,"refetchOnFocus"),zl.match(u)&&a(c,"refetchOnReconnect")};function a(u,c){let g=u.getState()[e],v=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let y=v[h],b=x.get(h);if(!b||!y)continue;let w=[...b.values()];(w.some(R=>R[c]===!0)||w.every(R=>R[c]===void 0)&&g.config[c])&&(b.size===0?u.dispatch(i({queryCacheKey:h})):y.status!=="uninitialized"&&u.dispatch(r(y)))}})}return s};function ux(e){let{reducerPath:t,queryThunk:n,api:r,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:V(`${t}/invalidateTags`)},u=x=>x.type.startsWith(`${t}/`),c=[ox,nx,ix,sx,rx,ax];return{middleware:x=>{let h=!1,y=i(x.dispatch),b={...e,internalState:y,refetchQuery:v,isThisApiSliceAction:u,mwApi:x},w=c.map(k=>k(b)),R=ex(b),N=cx(b);return k=>P=>{if(!Yo(P))return k(P);h||(h=!0,x.dispatch(r.internalActions.middlewareRegistered(s)));let A={...x,next:k},O=x.getState(),[_,T]=R(P,A,O),D;if(_?D=k(P):D=T,x.getState()[t]&&(N(P,A,O),u(P)||o.hasRehydrationInfo(P)))for(let q of w)q(P,A,O);return D}},actions:a};function v(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Og=Symbol(),lx=({createSelector:e=Be}={})=>({name:Og,init(t,{baseQuery:n,tagTypes:r,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:v,catchSchemaFailure:x,skipSchemaValidation:h},y){fm();let b=ge=>(typeof process<"u",ge);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:zl,onOffline:jg,onFocus:Ql,onFocusLost:Lg},util:{}});let w=ZE({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:R,selectCachedArgsForQuery:N,buildQuerySelector:k,buildInfiniteQuerySelector:P,buildMutationSelector:A}=w;un(t.util,{selectInvalidatedBy:R,selectCachedArgsForQuery:N});let{queryThunk:O,infiniteQueryThunk:_,mutationThunk:T,patchQueryData:D,updateQueryData:q,upsertQueryData:M,prefetch:L,buildMatchThunkActions:G}=YE({baseQuery:n,reducerPath:o,context:y,api:t,serializeQueryArgs:i,assertTagType:b,selectors:w,onSchemaFailure:v,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:j,actions:Q}=XE({context:y,queryThunk:O,infiniteQueryThunk:_,mutationThunk:T,serializeQueryArgs:i,reducerPath:o,assertTagType:b,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});un(t.util,{patchQueryData:D,updateQueryData:q,upsertQueryData:M,prefetch:L,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),un(t.internalActions,Q);let $=new WeakMap,K=ge=>Xs($,ge,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:H,buildInitiateInfiniteQuery:Y,buildInitiateMutation:ie,getRunningMutationThunk:me,getRunningMutationsThunk:xe,getRunningQueriesThunk:je,getRunningQueryThunk:_e}=KE({queryThunk:O,mutationThunk:T,infiniteQueryThunk:_,api:t,serializeQueryArgs:i,context:y,getInternalState:K});un(t.util,{getRunningMutationThunk:me,getRunningMutationsThunk:xe,getRunningQueryThunk:_e,getRunningQueriesThunk:je});let{middleware:Pe,actions:Ne}=ux({reducerPath:o,context:y,queryThunk:O,mutationThunk:T,infiniteQueryThunk:_,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:_e,getInternalState:K});return un(t.util,Ne),un(t,{reducer:j,middleware:Pe}),{name:Og,injectEndpoint(ge,de){var Ge;let he=(Ge=t.endpoints)[ge]??(Ge[ge]={});ea(de)&&un(he,{name:ge,select:k(ge,de),initiate:H(ge,de)},G(O,ge)),QE(de)&&un(he,{name:ge,select:A(),initiate:ie(ge)},G(T,ge)),gi(de)&&un(he,{name:ge,select:P(ge,de),initiate:Y(ge,de)},G(O,ge))}}}}),Hg=JE(lx());m();d();f();p();m();d();f();p();var nr=e=>e.query,Qg=e=>e.query?.enableQuerySyntax;var Dq=Be(e=>nr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,n,r,o)=>({q:e,requestId:t,cannotAnswer:n,analyticsMode:r,actionCause:o})),dx=Be(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ln(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function U(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(v){s(v)}}function u(g){try{c(r.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})}var be;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(be||(be={}));function Xl(){return typeof window<"u"}function dd(){return typeof navigator<"u"}function no(){return typeof document<"u"}function Zl(){try{return typeof localStorage<"u"}catch{return!1}}function px(){try{return typeof sessionStorage<"u"}catch{return!1}}function oh(){return dd()&&navigator.cookieEnabled}var fx=[be.click,be.custom,be.search,be.view],mx=(e,t)=>fx.indexOf(e)!==-1?Object.assign({language:no()?document.documentElement.lang:"unknown",userAgent:dd()?navigator.userAgent:"unknown"},t):t,ro=class e{static set(t,n,r){let o;r&&(o=new Date,o.setTime(o.getTime()+r)),Jl(t,n,o,gx(window.location.hostname))}static get(t){for(var n=t+"=",r=document.cookie.split(";"),o=0;o<r.length;o++){var i=r[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function gx(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let n=2;n<=t.length;n++){let r=t.slice(-n).join(".");if(hx(r))return r}}function hx(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Jl(t,"1",void 0,e),ro.get(t)==="1"}catch{return!1}finally{try{Jl(t,"",new Date(0),e)}catch{}}}function Jl(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function yx(){return Zl()?localStorage:oh()?new bi:px()?sessionStorage:new io}var bi=class e{getItem(t){return ro.get(`${e.prefix}${t}`)}removeItem(t){ro.erase(`${e.prefix}${t}`)}setItem(t,n,r){ro.set(`${e.prefix}${t}`,n,r)}};bi.prefix="coveo_";var ed=class{constructor(){this.cookieStorage=new bi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,n){localStorage.setItem(t,n),this.cookieStorage.setItem(t,n,31556926e3)}},io=class{getItem(t){return null}removeItem(t){}setItem(t,n){}},ta="__coveo.analytics.history",vx=20,Sx=1e3*60,bx=75,ra=class{constructor(t){this.store=t||yx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let n=this.getHistoryWithInternalTime();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):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 n=yield this.getHistoryWithInternalTimeAsync();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):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(ta);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(ta);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ta,JSON.stringify(t.slice(0,vx)))}catch{}}clear(){try{this.store.removeItem(ta)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((r,o)=>(o.internalTime||0)-(r.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,bx)),t}isValidEntry(t){let n=this.getMostRecentElement();return n&&n.value==t.value?(t.internalTime||0)-(n.internalTime||0)>Sx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(n=>{let{name:r,time:o,value:i}=n;return{name:r,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:n,time:r,value:o}=t;return n&&typeof o=="string"&&n.toLowerCase()==="query"&&o.trim()===""?{name:n,time:r}:t}stripEmptyQueries(t){return t.map(n=>this.stripEmptyQuery(n))}};var Ax=(e,t)=>U(void 0,void 0,void 0,function*(){return e===be.view?(yield wx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),wx=e=>U(void 0,void 0,void 0,function*(){let t=new ra,n={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(n)}),Cx=/^(?:[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 oa(e){return typeof e=="string"&&Cx.test(e)}function zg(e){if(!oa(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 et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function ih(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}var Ex=new Uint8Array(16);function xx(){return crypto.getRandomValues(Ex)}function Ix(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var Rx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Tx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function kx(e,t,n,r,o,i){let s=typeof n=="string"?Ix(n):n,a=typeof r=="string"?zg(r):r;if(typeof r=="string"&&(r=zg(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+s.length);return u.set(a),u.set(s,a.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,ih(u)}function rr(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():_x(e,t,n)}function _x(e,t,n){e=e||{};let r=e.random??e.rng?.()??xx();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return ih(r)}function Ox(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function Kl(e,t){return e<<t|e>>>32-t}function Px(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[a*64+c*4]<<24|e[a*64+c*4+1]<<16|e[a*64+c*4+2]<<8|e[a*64+c*4+3];s[a]=u}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let u=new Uint32Array(80);for(let y=0;y<16;++y)u[y]=s[a][y];for(let y=16;y<80;++y)u[y]=Kl(u[y-3]^u[y-8]^u[y-14]^u[y-16],1);let c=n[0],g=n[1],v=n[2],x=n[3],h=n[4];for(let y=0;y<80;++y){let b=Math.floor(y/20),w=Kl(c,5)+Ox(b,g,v,x)+h+t[b]+u[y]>>>0;h=x,x=v,v=Kl(g,30)>>>0,g=c,c=w}n[0]=n[0]+c>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+v>>>0,n[3]=n[3]+x>>>0,n[4]=n[4]+h>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function ia(e,t,n,r){return kx(80,Px,e,t)}ia.DNS=Rx;ia.URL=Tx;var sh="2.33.1",Wg=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Si={pageview:"pageview",event:"event"},sa=class{constructor({client:t,uuidGenerator:n=rr}){this.client=t,this.uuidGenerator=n}},td=class extends sa{constructor({client:t,uuidGenerator:n=rr}){super({client:t,uuidGenerator:n}),this.actionData={},this.pageViewId=n(),this.nextPageViewId=this.pageViewId,this.currentLocation=Wg(window.location),this.lastReferrer=no()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,n){this.action=t,this.actionData=n}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,n){return Object.assign({hitType:t},this.getNextValues(t,n))}updateLocationInformation(t,n){this.updateLocationForNextPageView(t,n)}getDefaultContextInformation(t){let n={title:no()?document.title:"",encoding:no()?document.characterSet:"UTF-8"},r={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),r),o),n)}updateLocationForNextPageView(t,n){let{pageViewId:r,referrer:o,location:i}=this.getNextValues(t,n);this.lastReferrer=o,this.pageViewId=r,this.currentLocation=i,t===Si.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,n){return{pageViewId:t===Si.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Si.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Si.pageview?this.getCurrentLocationFromPayload(n):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let n=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${n(t.page)}`}else return Wg(window.location)}},An=class e{constructor(t,n){if(!oa(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(n/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,n){return!this.expired&&this.matchReferrer(t,n)}matchReferrer(t,n){try{let r=new URL(t);return n.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(r.host))}catch{return!1}}static fromString(t){let n=t.split(".");if(n.length!==2)return null;let[r,o]=n;if(r.length!==32||isNaN(parseInt(o)))return null;let i=r.substring(0,8)+"-"+r.substring(8,12)+"-"+r.substring(12,16)+"-"+r.substring(16,20)+"-"+r.substring(20,32);return oa(i)?new e(i,Number.parseInt(o)*1e3):null}};An.cvo_cid="cvo_cid";An.expirationTime=120;var nd=class extends sa{constructor({client:t,uuidGenerator:n=rr}){super({client:t,uuidGenerator:n})}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 n=new URL(t),r=yield this.client.getCurrentVisitorId();return n.searchParams.set(An.cvo_cid,new An(r,Date.now()).toString()),n.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};nd.Id="link";var Rt=Object.keys;function na(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Yl=128,ah=192,Kg=224,Yg=240;function Nx(e){return(e&248)===Yg?4:(e&Yg)===Kg?3:(e&Kg)===ah?2:1}function Fx(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&e.charAt(n-3)=="%";){let r=Number.parseInt(e.substring(n-2,n),16);if((r&Yl)!=Yl)break;if(n-=3,(r&ah)!=Yl){t-n>=Nx(r)*3&&(n=t);break}}return e.substring(0,n)}var rd={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},Dx=Rt(rd).map(e=>rd[e]),Mx=[...Dx].join("|"),Lx=new RegExp(`^(${Mx}$)`),jx={svcAction:"svc_action",svcActionData:"svc_action_data"},Ux=e=>Rt(e).filter(t=>e[t]!==void 0).reduce((t,n)=>{let r=rd[n]||n;return Object.assign(Object.assign({},t),{[r]:e[n]})},{}),qx=e=>Lx.test(e),Vx=[qx],Xg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Zg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},ct={action:"pa",list:"pal",listSource:"pls"},aa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Gx=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],od={id:"quoteId",affiliation:"quoteAffiliation"},id={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},Bx={add:ct,bookmark_add:ct,bookmark_remove:ct,click:ct,checkout:ct,checkout_option:ct,detail:ct,impression:ct,remove:ct,refund:Object.assign(Object.assign({},ct),aa),purchase:Object.assign(Object.assign({},ct),aa),quickview:ct,quote:Object.assign(Object.assign({},ct),od),review:Object.assign(Object.assign({},ct),id)},$x=Rt(Xg).map(e=>Xg[e]),Hx=Rt(Zg).map(e=>Zg[e]),Qx=Rt(ct).map(e=>ct[e]),zx=Rt(aa).map(e=>aa[e]),Wx=Rt(id).map(e=>id[e]),Kx=Rt(od).map(e=>od[e]),Yx=[...$x,"custom"].join("|"),Xx=[...Hx,"custom"].join("|"),ch="(pr[0-9]+)",uh="(il[0-9]+pi[0-9]+)",Zx=new RegExp(`^${ch}(${Yx})$`),Jx=new RegExp(`^(${uh}(${Xx}))|(il[0-9]+nm)$`),eI=new RegExp(`^(${Qx.join("|")})$`),tI=new RegExp(`^(${zx.join("|")})$`),nI=new RegExp(`^${ch}custom$`),rI=new RegExp(`^${uh}custom$`),oI=new RegExp(`^(${[...Gx,...Wx,...Kx].join("|")})$`),iI=e=>Zx.test(e),sI=e=>Jx.test(e),aI=e=>eI.test(e),cI=e=>tI.test(e),uI=e=>oI.test(e),lI=[sI,iI,aI,cI,uI],dI=[nI,rI],pI={anonymizeIp:"aip"},fI={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},mI={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},gI=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],hI=Object.assign(Object.assign(Object.assign(Object.assign({},pI),fI),mI),gI.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),sd=Object.assign(Object.assign({},hI),jx),yI=e=>{let t=!!e.action&&Bx[e.action]||{};return Rt(e).reduce((n,r)=>{let o=t[r]||sd[r]||r;return Object.assign(Object.assign({},n),{[o]:e[r]})},{})},vI=Rt(sd).map(e=>sd[e]),SI=e=>vI.indexOf(e)!==-1,bI=e=>e==="custom",AI=e=>[...lI,...Vx,SI,bI].some(t=>t(e)),wI=e=>Rt(e).reduce((t,n)=>{let r=CI(n);return r?Object.assign(Object.assign({},t),EI(r,e[n])):Object.assign(Object.assign({},t),{[n]:e[n]})},{}),CI=e=>{let t;return[...dI].every(n=>{var r;return t=(r=n.exec(e))===null||r===void 0?void 0:r[1],!t}),t},EI=(e,t)=>Rt(t).reduce((n,r)=>Object.assign(Object.assign({},n),{[`${e}${r}`]:t[r]}),{}),ad=class{constructor(t){this.opts=t}sendEvent(t,n){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:r,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${r}/analytics/${t}?${i}`,n,o),u=this.encodeForEventType(t,a),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,n,r){return U(this,void 0,void 0,function*(){let o=t,i=n;if(r){let s=yield r({url:t,body:JSON.stringify(n)},"analyticsBeacon"),{url:a,body:u}=s;o=a||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,n){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,n):this.encodeEventToJson(t,n,this.opts.token)}getQueryParamsForEventType(t){return U(this,void 0,void 0,function*(){let{token:n,visitorIdProvider:r}=this.opts,o=yield r.getCurrentVisitorId();return[n&&this.isEventTypeLegacy(t)?`access_token=${n}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[be.click,be.custom,be.search,be.view].indexOf(t)!==-1}encodeEventToJson(t,n,r){let o=`${t}Event=${encodeURIComponent(JSON.stringify(n))}`;return r&&(o=`access_token=${encodeURIComponent(r)}&${o}`),o}},cd=class{sendEvent(t,n){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},Jg=C.fetch,ca=class{constructor(t){this.opts=t}sendEvent(t,n){return U(this,void 0,void 0,function*(){let{baseUrl:r,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${r}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(n)},u=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:c}=u,g=ln(u,["url"]),v;try{v=yield Jg(c,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(v.ok){let x=yield v.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{v.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,v,n),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,n=`${t}/analytics/visit`;yield Jg(n,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[be.click,be.custom,be.search,be.view].indexOf(t)!==-1}getVisitorIdParam(){return U(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,n=yield t.getCurrentVisitorId();return n?`?visitor=${n}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},ud=class{constructor(t,n){Zl()&&oh()?this.storage=new ed:Zl()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new io),this.client=new ca(t),this.beaconClient=new ad(t),window.addEventListener("beforeunload",()=>{let r=n();for(let{eventType:o,payload:i}of r)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},ld=class{constructor(t,n){this.storage=n||new io,this.client=new ca(t)}getClientDependingOnEventType(t){return this.client}},ua=class{constructor(){this.storage=new io,this.client=new cd}getClientDependingOnEventType(t){return this.client}},xI="xx",II=e=>e?.startsWith(xI)||!1,RI=`
27
+ `;return new fl(n)}var fl=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Mt=class{constructor(e){ce(this,"definition");this.definition=e}validate(e={},t=""){let n={...this.default,...e},r=[];for(let o in this.definition){let i=this.definition[o].validate(n[o]);i&&r.push(`${o}: ${i}`)}if(r.length)throw eC(r,t);return n}get default(){let e={};for(let t in this.definition){let n=this.definition[t].default;n!==void 0&&(e[t]=n)}return e}},Kn=class{constructor(e={}){ce(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 zr(e){return e===void 0}function tC(e){return e===null}function ue(e){return zr(e)||tC(e)}var Ve=class{constructor(e={}){ce(this,"value");this.value=new Kn(e)}validate(e){let t=this.value.validate(e);return t||(nC(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function nC(e){return zr(e)||rm(e)}function rm(e){return typeof e=="boolean"}var qe=class{constructor(e={}){ce(this,"config");ce(this,"value");this.config=e,this.value=new Kn(e)}validate(e){let t=this.value.validate(e);return t||(rC(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 rC(e){return zr(e)||om(e)}function om(e){return typeof e=="number"&&!Number.isNaN(e)}var oC=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,te=class{constructor(e={}){ce(this,"value");ce(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Kn(this.config)}validate(e){let{emptyAllowed:t,url:n,regex:r,constrainTo:o,ISODate:i}=this.config,s=this.value.validate(e);if(s)return s;if(zr(e))return null;if(!im(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(n)try{new URL(e)}catch{return"value is not a valid URL."}return r&&!r.test(e)?`value did not match provided regex ${r}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(oC.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 im(e){return Object.prototype.toString.call(e)==="[object String]"}var Re=class{constructor(e={}){ce(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(zr(e))return this.config.options.required?"value is required and is currently undefined":null;if(!sm(e))return"value is not an object";for(let[n,r]of Object.entries(this.config.values))if(r.required&&ue(e[n]))return`value does not contain ${n}`;let t="";for(let[n,r]of Object.entries(this.config.values)){let o=e[n],i=r.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function sm(e){return e!==void 0&&typeof e=="object"}var Lt=class{constructor(e={}){ce(this,"config");ce(this,"value");this.config=e,this.value=new Kn(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 n="";return e.forEach(r=>{this.config.each.required&&ue(r)&&(n=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(r,this.config.each);o!==null&&(n+=` ${o}`)}),n===""?null:n}return null}validatePrimitiveValue(e,t){return rm(e)||im(e)||om(e)||sm(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function am(e){return Array.isArray(e)}var pl=class{constructor(e){ce(this,"config");ce(this,"value");this.config=e,this.value=new Kn(e)}validate(e){let t=this.value.validate(e);return t!==null?t:zr(e)||Object.values(this.config.enum).find(r=>r===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();p();f();var vs=e=>e;m();d();p();f();m();d();p();f();m();d();p();f();var Wr=class{constructor(t){ce(this,"_basePath");ce(this,"_params",{});this._basePath=t}addParam(t,n){this._params={...this.params,[t]:n}}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,n])=>`${t}=${encodeURIComponent(n)}`).join("&")}`:this.basePath}};m();d();p();f();function ml(e){let{url:t,accessToken:n,organizationId:r,authentication:o,...i}=e;return i}var gl=e=>{let{response:t}=e;return t.body?iC(e):sC(t)},iC=e=>cC(e)?uC(e):aC(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},sC=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function aC(e){return e.body.statusCode!==void 0}function cC(e){return e.body.exception!==void 0}var uC=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();p();f();function cm(e){return((e.headers.get("content-type")||"").split(";").find(r=>r.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();p();f();var hl=(e,t,n,r)=>{let o=new Wr(`${e.url}${r}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:n,url:o.href,origin:"searchApiFetch"}};var um=(e,t)=>{let n=new Wr(`${e.url}${t}`);return n.addParam("access_token",e.accessToken),n.addParam("organizationId",e.organizationId),n.addParam("uniqueId",e.uniqueId),e.authentication&&n.addParam("authentication",e.authentication),e.q!==void 0&&n.addParam("q",e.q),e.enableNavigation!==void 0&&n.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&n.addParam("requestedOutputSize",`${e.requestedOutputSize}`),n.href},yl=/*#__PURE__*/function(){var _yl=_asyncToGenerator(function*(e,t){let n=yield wn.call({...hl(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:ml(e),requestMetadata:{method:"html"},...t});if(n instanceof Error)throw n;let r=cm(n),o=yield n.arrayBuffer(),s=new TextDecoder(r).decode(o);return lC(s)?{success:s}:{error:gl({response:n,body:s})}});function yl(_x3,_x4){return _yl.apply(this,arguments)}return yl}();function lC(e){return typeof e=="string"}m();d();p();f();function dC(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function fC(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ss(e,t){if(t&&e.name==="AbortError")return{error:fC(e)};if(e instanceof Wn)return{error:dC(e)};throw e}m();d();p();f();m();d();p();f();var bs=(e,t,n,r,o={})=>{pC(e);let i=`${e.url}/rest/organizations/${e.organizationId}/caseassists/${e.caseAssistId}${r}`,s=mC(o),a=s?`${i}?${s}`:i;return{accessToken:e.accessToken,method:t,contentType:n,url:a,origin:"caseAssistApiFetch"}},As=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,n)=>(t[n]=e[n],t),{}),ws=e=>Object.keys(e).filter(t=>e[t].value!=="").reduce((t,n)=>(t[n]=e[n].value,t),{}),pC=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.");if(!e.caseAssistId)throw new Error("The 'caseAssistId' attribute must contain a valid Case Assist configuration ID.")},mC=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&");var lm=e=>{let t=e.debug?{debug:"1"}:{};return{...bs(e,"POST","application/json","/classify",t),requestParams:gC(e)}},gC=e=>({clientId:e.clientId,locale:e.locale,fields:As(e.fields)});m();d();p();f();var dm=e=>{let t={};return e.debug&&(t.debug="1"),e.numberOfResults&&(t.numberOfResults=e.numberOfResults.toString()),{...bs(e,"POST","application/json","/documents/suggest",t),requestParams:hC(e)}},hC=e=>({clientId:e.clientId,locale:e.locale,fields:As(e.fields),context:e.context,analytics:e.analytics});var Cs=class{constructor(t){ce(this,"options",t)}getCaseClassifications(t){var _this=this;return _asyncToGenerator(function*(){let n=yield wn.call({...lm(t),..._this.options});if(n instanceof Error)return Ss(n);let r=yield n.json();return n.ok?{success:r}:{error:r}})()}getDocumentSuggestions(t){var _this2=this;return _asyncToGenerator(function*(){let n=yield wn.call({...dm(t),..._this2.options});if(n instanceof Error)return Ss(n);let r=yield n.json();return n.ok?{success:r}:{error:r}})()}html(t){var _this3=this;return _asyncToGenerator(function*(){return yl(t,_this3.options)})()}};m();d();p();f();m();d();p();f();m();d();p();f();function Je(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 yC=typeof Symbol=="function"&&Symbol.observable||"@@observable",fm=yC,vl=()=>Math.random().toString(36).substring(7).split("").join("."),vC={INIT:`@@redux/INIT${vl()}`,REPLACE:`@@redux/REPLACE${vl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${vl()}`},Es=vC;function $t(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 Sl(e,t,n){if(typeof e!="function")throw new Error(Je(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Je(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Je(1));return n(Sl)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,u=!1;function c(){s===i&&(s=new Map,i.forEach((C,w)=>{s.set(w,C)}))}function g(){if(u)throw new Error(Je(3));return o}function y(C){if(typeof C!="function")throw new Error(Je(4));if(u)throw new Error(Je(5));let w=!0;c();let k=a++;return s.set(k,C),function(){if(w){if(u)throw new Error(Je(6));w=!1,c(),s.delete(k),i=null}}}function E(C){if(!$t(C))throw new Error(Je(7));if(typeof C.type>"u")throw new Error(Je(8));if(typeof C.type!="string")throw new Error(Je(17));if(u)throw new Error(Je(9));try{u=!0,o=r(o,C)}finally{u=!1}return(i=s).forEach(k=>{k()}),C}function h(C){if(typeof C!="function")throw new Error(Je(10));r=C,E({type:Es.REPLACE})}function v(){let C=y;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Je(11));function k(){let F=w;F.next&&F.next(g())}return k(),{unsubscribe:C(k)}},[fm](){return this}}}return E({type:Es.INIT}),{dispatch:E,subscribe:y,getState:g,replaceReducer:h,[fm]:v}}function SC(e){Object.keys(e).forEach(t=>{let n=e[t];if(typeof n(void 0,{type:Es.INIT})>"u")throw new Error(Je(12));if(typeof n(void 0,{type:Es.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Je(13))})}function Yn(e){let t=Object.keys(e),n={};for(let s=0;s<t.length;s++){let a=t[s];typeof e[a]=="function"&&(n[a]=e[a])}let r=Object.keys(n),o,i;try{SC(n)}catch(s){i=s}return function(a={},u){if(i)throw i;let c=!1,g={};for(let y=0;y<r.length;y++){let E=r[y],h=n[E],v=a[E],A=h(v,u);if(typeof A>"u"){let C=u&&u.type;throw new Error(Je(14))}g[E]=A,c=c||A!==v}return c=c||r.length!==Object.keys(a).length,c?g:a}}function ii(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function pm(...e){return t=>(n,r)=>{let o=t(n,r),i=()=>{throw new Error(Je(15))},s={getState:o.getState,dispatch:(u,...c)=>i(u,...c)},a=e.map(u=>u(s));return i=ii(...a)(o.dispatch),{...o,dispatch:i}}}function si(e){return $t(e)&&"type"in e&&typeof e.type=="string"}m();d();p();f();var Tl=Symbol.for("immer-nothing"),ai=Symbol.for("immer-draftable"),We=Symbol.for("immer-state");function et(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var bt=Object,Zn=bt.getPrototypeOf,ci="constructor",pi="prototype",wl="configurable",Ts="enumerable",Is="writable",ui="value",ft=e=>!!e&&!!e[We];function ct(e){return e?Am(e)||gi(e)||!!e[ai]||!!e[ci]?.[ai]||hi(e)||Xr(e):!1}var bC=bt[pi][ci].toString(),mm=new WeakMap;function Am(e){if(!e||!Yr(e))return!1;let t=Zn(e);if(t===null||t===bt[pi])return!0;let n=bt.hasOwnProperty.call(t,ci)&&t[ci];if(n===Object)return!0;if(!Xn(n))return!1;let r=mm.get(n);return r===void 0&&(r=Function.toString.call(n),mm.set(n,r)),r===bC}function kl(e){return ft(e)||et(15,e),e[We].base_}function mi(e,t,n=!0){Jn(e)===0?(n?Reflect.ownKeys(e):bt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((r,o)=>t(o,r,e))}function Jn(e){let t=e[We];return t?t.type_:gi(e)?1:hi(e)?2:Xr(e)?3:0}var Kr=(e,t,n=Jn(e))=>n===2?e.has(t):bt[pi].hasOwnProperty.call(e,t),cn=(e,t,n=Jn(e))=>n===2?e.get(t):e[t],ks=(e,t,n,r=Jn(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function AC(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var gi=Array.isArray,hi=e=>e instanceof Map,Xr=e=>e instanceof Set,Yr=e=>typeof e=="object",Xn=e=>typeof e=="function",bl=e=>typeof e=="boolean";function wC(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var CC=e=>Yr(e)?e?.[We]:null,un=e=>e.copy_||e.base_;var _l=e=>e.modified_?e.copy_:e.base_;function Cl(e,t){if(hi(e))return new Map(e);if(Xr(e))return new Set(e);if(gi(e))return Array[pi].slice.call(e);let n=Am(e);if(t===!0||t==="class_only"&&!n){let r=bt.getOwnPropertyDescriptors(e);delete r[We];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){let s=o[i],a=r[s];a[Is]===!1&&(a[Is]=!0,a[wl]=!0),(a.get||a.set)&&(r[s]={[wl]:!0,[Is]:!0,[Ts]:a[Ts],[ui]:e[s]})}return bt.create(Zn(e),r)}else{let r=Zn(e);if(r!==null&&n)return{...e};let o=bt.create(r);return bt.assign(o,e)}}function Ds(e,t=!1){return Ms(e)||ft(e)||!ct(e)||(Jn(e)>1&&bt.defineProperties(e,{set:xs,add:xs,clear:xs,delete:xs}),bt.freeze(e),t&&mi(e,(n,r)=>{Ds(r,!0)},!1)),e}function EC(){et(2)}var xs={[ui]:EC};function Ms(e){return e===null||!Yr(e)?!0:bt.isFrozen(e)}var _s="MapSet",Os="Patches",gm="ArrayMethods",Ps={};function er(e){let t=Ps[e];return t||et(0,e),t}var hm=e=>!!Ps[e];function xC(e,t){Ps[e]||(Ps[e]=t)}var li,wm=()=>li,IC=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:hm(_s)?er(_s):void 0,arrayMethodsPlugin_:hm(gm)?er(gm):void 0});function ym(e,t){t&&(e.patchPlugin_=er(Os),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function El(e){xl(e),e.drafts_.forEach(RC),e.drafts_=null}function xl(e){e===li&&(li=e.parent_)}var vm=e=>li=IC(li,e);function RC(e){let t=e[We];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[We].modified_&&(El(t),et(4)),ct(e)&&(e=bm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(n[We].base_,e,t)}else e=bm(t,n);return TC(t,e,!0),El(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Tl?e:void 0}function bm(e,t){if(Ms(t))return t;let n=t[We];if(!n)return Ns(t,e.handledSet_,e);if(!Ls(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);xm(n,e)}return n.copy_}function TC(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ds(t,n)}function Cm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ls=(e,t)=>e.scope_===t,kC=[];function Em(e,t,n,r){let o=un(e),i=e.type_;if(r!==void 0&&cn(o,r,i)===t){ks(o,r,n,i);return}if(!e.draftLocations_){let a=e.draftLocations_=new Map;mi(o,(u,c)=>{if(ft(c)){let g=a.get(c)||[];g.push(u),a.set(c,g)}})}let s=e.draftLocations_.get(t)??kC;for(let a of s)ks(o,a,n,i)}function _C(e,t,n){e.callbacks_.push(function(o){let i=t;if(!i||!Ls(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let s=_l(i);Em(e,i.draft_??i,s,n),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_:r}=t;if(r){let o=r.getPath(e);o&&r.generatePatches_(e,o,t)}Cm(e)}}function OC(e,t,n){let{scope_:r}=e;if(ft(n)){let o=n[We];Ls(o,r)&&o.callbacks_.push(function(){Rs(e);let s=_l(o);Em(e,n,s,t)})}else ct(n)&&e.callbacks_.push(function(){let i=un(e);e.type_===3?i.has(n)&&Ns(n,r.handledSet_,r):cn(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ns(cn(e.copy_,t,e.type_),r.handledSet_,r)})}function Ns(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ft(e)||t.has(e)||!ct(e)||Ms(e)||(t.add(e),mi(e,(r,o)=>{if(ft(o)){let i=o[We];if(Ls(i,n)){let s=_l(i);ks(e,r,s,e.type_),Cm(i)}}else ct(o)&&Ns(o,t,n)})),e}function PC(e,t){let n=gi(e),r={type_:n?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=r,i=Fs;n&&(o=[r],i=di);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,[a,r]}var Fs={get(e,t){if(t===We)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t=="string";if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let o=un(e);if(!Kr(o,t,e.type_))return FC(e,o,t);let i=o[t];if(e.finalized_||!ct(i)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&wC(t))return i;if(i===Al(e.base_,t)||NC(e,t,i)){Rs(e);let s=e.type_===1?+t:t,a=Rl(e.scope_,i,e,s);return e.copy_[s]=a}return i},has(e,t){return t in un(e)},ownKeys(e){return Reflect.ownKeys(un(e))},set(e,t,n){let r=Im(un(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let o=Al(un(e),t),i=o?.[We];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(AC(n,o)&&(n!==void 0||Kr(e.base_,t,e.type_)))return!0;Rs(e),Il(e)}return e.copy_[t]===n&&(n!==void 0||Kr(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),OC(e,t,n)),!0},deleteProperty(e,t){return Rs(e),Al(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Il(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Is]:!0,[wl]:e.type_!==1||t!=="length",[Ts]:r[Ts],[ui]:n[t]}},defineProperty(){et(11)},getPrototypeOf(e){return Zn(e.base_)},setPrototypeOf(){et(12)}},di={};for(let e in Fs){let t=Fs[e];di[e]=function(){let n=arguments;return n[0]=n[0][0],t.apply(this,n)}}di.deleteProperty=function(e,t){return di.set.call(this,e,t,void 0)};di.set=function(e,t,n){return Fs.set.call(this,e[0],t,n,e[0])};function Al(e,t){let n=e[We];return(n?un(n):e)[t]}function NC(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!ct(n)||n[We]?!1:e.baseRefs_.has(n)}function FC(e,t,n){let r=Im(t,n);return r?ui in r?r[ui]:r.get?.call(e.draft_):void 0}function Im(e,t){if(!(t in e))return;let n=Zn(e);for(;n;){let r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Zn(n)}}function Il(e){e.modified_||(e.modified_=!0,e.parent_&&Il(e.parent_))}function Rs(e){e.copy_||(e.assigned_=new Map,e.copy_=Cl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var DC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,n,r)=>{if(Xn(t)&&!Xn(n)){let i=n;n=t;let s=this;return function(u=i,...c){return s.produce(u,g=>n.call(this,g,...c))}}Xn(n)||et(6),r!==void 0&&!Xn(r)&&et(7);let o;if(ct(t)){let i=vm(this),s=Rl(i,t,void 0),a=!0;try{o=n(s),a=!1}finally{a?El(i):xl(i)}return ym(i,r),Sm(o,i)}else if(!t||!Yr(t)){if(o=n(t),o===void 0&&(o=t),o===Tl&&(o=void 0),this.autoFreeze_&&Ds(o,!0),r){let i=[],s=[];er(Os).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:s}),r(i,s)}return o}else et(1,t)},this.produceWithPatches=(t,n)=>{if(Xn(t))return(s,...a)=>this.produceWithPatches(s,u=>t(u,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},bl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),bl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),bl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ct(e)||et(8),ft(e)&&(e=js(e));let t=vm(this),n=Rl(t,e,void 0);return n[We].isManual_=!0,xl(t),n}finishDraft(e,t){let n=e&&e[We];(!n||!n.isManual_)&&et(9);let{scope_:r}=n;return ym(r,t),Sm(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));let r=er(Os).applyPatches_;return ft(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Rl(e,t,n,r){let[o,i]=hi(t)?er(_s).proxyMap_(t,n):Xr(t)?er(_s).proxySet_(t,n):PC(t,n);return(n?.scope_??wm()).drafts_.push(o),i.callbacks_=n?.callbacks_??[],i.key_=r,n&&r!==void 0?_C(n,i,r):i.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:c}=u;i.modified_&&c&&c.generatePatches_(i,[],u)}),o}function js(e){return ft(e)||et(10,e),Rm(e)}function Rm(e){if(!ct(e)||Ms(e))return e;let t=e[We],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Cl(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Cl(e,!0);let o=n;return Xr(n)&&(n=new Set),mi(o,(i,s)=>{ks(n,i,Rm(s))},r),t&&(t.finalized_=!1),n}function Tm(){function t(v,A=[]){if(v.key_!==void 0){let C=v.parent_.copy_??v.parent_.base_,w=CC(cn(C,v.key_)),k=cn(C,v.key_);if(k===void 0||k!==v.draft_&&k!==v.copy_||w!=null&&w.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&&C.size>F||Kr(C,F))||v.parent_.type_===1&&v.parent_.allIndicesReassigned_)return null;A.push(F)}if(v.parent_)return t(v.parent_,A);A.reverse();try{n(v.copy_,A)}catch{return null}return A}function n(v,A){let C=v;for(let w=0;w<A.length-1;w++){let k=A[w];if(C=cn(C,k),!Yr(C)||C===null)throw new Error(`Cannot resolve path at '${A.join("/")}'`)}return C}let r="replace",o="add",i="remove";function s(v,A,C){if(v.scope_.processedForPatches_.has(v))return;v.scope_.processedForPatches_.add(v);let{patches_:w,inversePatches_:k}=C;switch(v.type_){case 0:case 2:return u(v,A,w,k);case 1:return a(v,A,w,k);case 3:return c(v,A,w,k)}}function a(v,A,C,w){let{base_:k,assigned_:O}=v,F=v.copy_;F.length<k.length&&([k,F]=[F,k],[C,w]=[w,C]);let b=v.allIndicesReassigned_===!0;for(let T=0;T<k.length;T++){let _=F[T],P=k[T];if((b||O?.get(T.toString()))&&_!==P){let M=_?.[We];if(M&&M.modified_)continue;let B=A.concat([T]);C.push({op:r,path:B,value:h(_)}),w.push({op:r,path:B,value:h(P)})}}for(let T=k.length;T<F.length;T++){let _=A.concat([T]);C.push({op:o,path:_,value:h(F[T])})}for(let T=F.length-1;k.length<=T;--T){let _=A.concat([T]);w.push({op:i,path:_})}}function u(v,A,C,w){let{base_:k,copy_:O,type_:F}=v;mi(v.assigned_,(b,T)=>{let _=cn(k,b,F),P=cn(O,b,F),N=T?Kr(k,b)?r:o:i;if(_===P&&N===r)return;let M=A.concat(b);C.push(N===i?{op:N,path:M}:{op:N,path:M,value:h(P)}),w.push(N===o?{op:i,path:M}:N===i?{op:o,path:M,value:h(_)}:{op:r,path:M,value:h(_)})})}function c(v,A,C,w){let{base_:k,copy_:O}=v,F=0;k.forEach(b=>{if(!O.has(b)){let T=A.concat([F]);C.push({op:i,path:T,value:b}),w.unshift({op:o,path:T,value:b})}F++}),F=0,O.forEach(b=>{if(!k.has(b)){let T=A.concat([F]);C.push({op:o,path:T,value:b}),w.unshift({op:i,path:T,value:b})}F++})}function g(v,A,C){let{patches_:w,inversePatches_:k}=C;w.push({op:r,path:[],value:A===Tl?void 0:A}),k.push({op:r,path:[],value:v})}function y(v,A){return A.forEach(C=>{let{path:w,op:k}=C,O=v;for(let _=0;_<w.length-1;_++){let P=Jn(O),N=w[_];typeof N!="string"&&typeof N!="number"&&(N=""+N),(P===0||P===1)&&(N==="__proto__"||N===ci)&&et(19),Xn(O)&&N===pi&&et(19),O=cn(O,N),(O===null||!Yr(O))&&et(18,w.join("/"))}let F=Jn(O),b=E(C.value),T=w[w.length-1];switch(k){case r:switch(F){case 2:return O.set(T,b);case 3:et(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(C.value);default:return delete O[T]}default:et(17,k)}}),v}function E(v){if(!ct(v))return v;if(gi(v))return v.map(E);if(hi(v))return new Map(Array.from(v.entries()).map(([C,w])=>[C,E(w)]));if(Xr(v))return new Set(Array.from(v).map(E));let A=Object.create(Zn(v));for(let C in v)A[C]=E(v[C]);return Kr(v,ai)&&(A[ai]=v[ai]),A}function h(v){return ft(v)?E(v):v}xC(Os,{applyPatches_:y,generatePatches_:s,generateReplacementPatches_:g,getPath:t})}var MC=x.Iterator,tL=typeof MC?.from=="function";var fi=new DC,tr=fi.produce,km=fi.produceWithPatches.bind(fi);var Ol=fi.applyPatches.bind(fi);m();d();p();f();var LC=class{constructor(e){this.value=e}deref(){return this.value}},jC=()=>typeof WeakRef>"u"?LC:WeakRef,Om=jC(),qC=0,qs=1;function yi(){return{s:qC,v:void 0,o:null,p:null}}function UC(e){return e instanceof Om?e.deref():e}function Zr(e,t={}){let n=yi(),{resultEqualityCheck:r,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 s=null,a=0,u,c=0,g=!1;function y(){a>=o&&(s=n,n=yi(),a=0)}function E(){let h=n,{length:v}=arguments;for(let w=0,k=v;w<k;w++){let O=arguments[w];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=yi(),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=yi(),F.set(O,h),a++):h=b}}if(h.s===qs)return h.v;if(s!==null){let w=s;for(let k=0,O=v;k<O;k++){let F=arguments[k],b;if(typeof F=="function"||typeof F=="object"&&F!==null){let T=w.o;b=T!==null?T.get(F):void 0}else{let T=w.p;b=T!==null?T.get(F):void 0}if(b===void 0){w=null;break}w=b}if(w!==null&&w.s===qs){let k=h;return k.s=qs,k.v=w.v,y(),w.v}}let A=h,C=e.apply(null,arguments);if(c++,r){let w=UC(u);w!=null&&r(w,C)&&(C=w,c!==0&&c--),u=typeof C=="object"&&C!==null||typeof C=="function"?new Om(C):C}return A.s=qs,A.v=C,i&&y(),C}return E.clearCache=()=>{n=yi(),s=null,a=0,E.resetResultsCount()},E.resultsCount=()=>c,E.resetResultsCount=()=>{c=0},E}var Pl=Symbol("NOT_FOUND");function VC(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function GC(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){let n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var _m=e=>Array.isArray(e)?e:[e];function BC(e){let t=Array.isArray(e[0])?e[0]:e;return GC(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Us(e,...t){let n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let i=0,s=0,a,u={},c=o.pop();typeof c=="object"&&(u=c,c=o.pop()),VC(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);let g={...n,...u},{memoize:y,memoizeOptions:E=[],argsMemoize:h=Zr,argsMemoizeOptions:v=[]}=g,A=_m(E),C=_m(v),w=BC(o),k=y(function(){return i++,c.apply(null,arguments)},...A),O=!0,F=h(function(){s++;let{length:T}=w,_=new Array(T);for(let P=0;P<T;P++)_[P]=w[P].apply(null,arguments);return a=k.apply(null,_),a},...C);return Object.assign(F,{resultFunc:c,memoizedResultFunc:k,dependencies:w,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:y,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var Qe=Us(Zr);function $C(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Pl},put(n,r){t={key:n,value:r}},findMatchingEntry(n,r){let o=t;return o!==void 0&&r(o.value,n)?o:void 0},clear(){t=void 0}}}function HC(e,t){let n=[];function r(a){let u=n.findIndex(c=>t(c.key,a));if(u>-1){let c=n[u];return u>0&&(n.splice(u,1),n.unshift(c)),c.value}return Pl}function o(a,u){n.unshift({key:a,value:u}),n.length>e&&n.pop()}function i(a,u){let c=n,{length:g}=c;for(let y=0;y<g;y++){let E=c[y];if(u(E.value,a))return E}}function s(){n=[]}return{get:r,put:o,findMatchingEntry:i,clear:s}}var QC=(e,t)=>e===t;function zC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;let{length:o}=n;for(let i=0;i<o;i++)if(!e(n[i],r[i]))return!1;return!0}}function Nl(e,t){let n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=QC,maxSize:o=1,resultEqualityCheck:i}=n,s=zC(r),a=0,u=o<=1?$C(s):HC(o,s);function c(){let g=u.get(arguments);if(g===Pl){if(g=e.apply(null,arguments),a++,i){let y=u.findMatchingEntry(g,i);y&&(g=y.value,a!==0&&a--)}u.put(arguments,g)}return g}return c.clearCache=()=>{u.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}m();d();p();f();function Pm(e){return({dispatch:n,getState:r})=>o=>i=>typeof i=="function"?i(n,r,e):o(i)}var Nm=Pm(),Fm=Pm;var WC=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ii:ii.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var KC=e=>e&&typeof e.match=="function";function $(e,t){function n(...r){if(t){let o=t(...r);if(!o)throw new Error(ut(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>r!=null&&r.type===e&&si(r),n}var Gm=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 Dm(e){return ct(e)?tr(e,()=>{}):e}function Vs(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function YC(e){return typeof e=="boolean"}var XC=()=>function(t){let{thunk:n=!0,immutableCheck:r=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},s=new Gm;return n&&(YC(n)?s.push(Nm):s.push(Fm(n.extraArgument))),s},Si="RTK_autoBatch",to=()=>e=>({payload:e,meta:{[Si]:!0}}),Mm=e=>t=>{setTimeout(t,e)},ZC=(e,t,n)=>r=>{let o=!1,i,s,a=()=>{o||(o=!0,t?.(i),clearTimeout(s),r())};i=e(a),s=setTimeout(a,n)},JC=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),o=!0,i=!1,s=!1,a=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?ZC(window.requestAnimationFrame,window.cancelAnimationFrame,100):Mm(10):e.type==="callback"?e.queueNotification:Mm(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach(g=>g()))};return Object.assign({},r,{subscribe(g){let y=()=>o&&g(),E=r.subscribe(y);return a.add(g),()=>{E(),a.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Si],i=!o,i&&(s||(s=!0,u(c))),r.dispatch(g)}finally{o=!0}}})},eE=e=>function(n){let{autoBatch:r=!0}=n??{},o=new Gm(e);return r&&o.push(JC(typeof r=="object"?r:void 0)),o};function Bm(e){let t=XC(),{reducer:n=void 0,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{},u;if(typeof n=="function")u=n;else if($t(n))u=Yn(n);else throw new Error(ut(1));let c;typeof r=="function"?c=r(t):c=t();let g=ii;o&&(g=WC({trace:!1,...(typeof o=="object"&&o)}));let y=pm(...c),E=eE(y),h=typeof a=="function"?a(E):E(),v=g(...h);return Sl(u,s,v)}function $m(e){let t={},n=[],r,o={addCase(i,s){let a=typeof i=="string"?i:i.type;if(!a)throw new Error(ut(28));if(a in t)throw new Error(ut(29));return t[a]=s,o},addAsyncThunk(i,s){return s.pending&&(t[i.pending.type]=s.pending),s.rejected&&(t[i.rejected.type]=s.rejected),s.fulfilled&&(t[i.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:i.settled,reducer:s.settled}),o},addMatcher(i,s){return n.push({matcher:i,reducer:s}),o},addDefaultCase(i){return r=i,o}};return e(o),[t,n,r]}function tE(e){return typeof e=="function"}function Ke(e,t){let[n,r,o]=$m(t),i;if(tE(e))i=()=>Dm(e());else{let u=Dm(e);i=()=>u}function s(u,c,g){if(ft(u)){let y=c(u,g);return y===void 0?u:y}else{if(ct(u))return tr(u,y=>c(y,g));{let y=c(u,g);if(y===void 0){if(u===null)return u;throw new Error(ut(9))}return y}}}function a(u=i(),c){let g=n[c.type],y;for(let{matcher:E,reducer:h}of r)E(c)&&h&&(y??(y=[])).push(h);if(!g&&!y)return o?s(u,o,c):u;if(g&&(u=s(u,g,c)),y)for(let E of y)u=s(u,E,c);return u}return a.getInitialState=i,a}var Hm=(e,t)=>KC(e)?e.match(t):e(t);function Ht(...e){return t=>e.some(n=>Hm(n,t))}function eo(...e){return t=>e.every(n=>Hm(n,t))}function Hs(e,t){if(!e||!e.meta)return!1;let n=typeof e.meta.requestId=="string",r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function bi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Qs(...e){return e.length===0?t=>Hs(t,["pending"]):bi(e)?Ht(...e.map(t=>t.pending)):Qs()(e[0])}function rr(...e){return e.length===0?t=>Hs(t,["rejected"]):bi(e)?Ht(...e.map(t=>t.rejected)):rr()(e[0])}function no(...e){let t=n=>n&&n.meta&&n.meta.rejectedWithValue;return e.length===0?eo(rr(...e),t):bi(e)?eo(rr(...e),t):no()(e[0])}function ln(...e){return e.length===0?t=>Hs(t,["fulfilled"]):bi(e)?Ht(...e.map(t=>t.fulfilled)):ln()(e[0])}function zs(...e){return e.length===0?t=>Hs(t,["pending","fulfilled","rejected"]):bi(e)?Ht(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):zs()(e[0])}var nE="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ai=(e=21)=>{let t="",n=e;for(;n--;)t+=nE[Math.random()*64|0];return t},rE=["name","message","stack","code"],Fl=class{constructor(e,t){ce(this,"payload");ce(this,"meta");ce(this,"_type");this.payload=e,this.meta=t}},Lm=class{constructor(e,t){ce(this,"payload");ce(this,"meta");ce(this,"_type");this.payload=e,this.meta=t}},oE=e=>{if(typeof e=="object"&&e!==null){let t={};for(let n of rE)typeof e[n]=="string"&&(t[n]=e[n]);return t}return{message:String(e)}},jm="External signal was aborted",Te=(()=>{function e(t,n,r){let o=$(t+"/fulfilled",(u,c,g,y)=>({payload:u,meta:{...(y||{}),arg:g,requestId:c,requestStatus:"fulfilled"}})),i=$(t+"/pending",(u,c,g)=>({payload:void 0,meta:{...(g||{}),arg:c,requestId:u,requestStatus:"pending"}})),s=$(t+"/rejected",(u,c,g,y,E)=>({payload:y,error:(r&&r.serializeError||oE)(u||"Rejected"),meta:{...(E||{}),arg:g,requestId:c,rejectedWithValue:y!==void 0,requestStatus:"rejected",aborted:u?.name==="AbortError",condition:u?.name==="ConditionError"}}));function a(u,{signal:c}={}){return(g,y,E)=>{let h=r?.idGenerator?r.idGenerator(u):Ai(),v=new l.AbortController,A,C;function w(O){C=O,v.abort()}c&&(c.aborted?w(jm):c.addEventListener("abort",()=>w(jm),{once:!0}));let k=_asyncToGenerator(function*(){let O;try{let F=r?.condition?.(u,{getState:y,extra:E});if(sE(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:C||"Aborted"};let b=new Promise((T,_)=>{A=()=>{_({name:"AbortError",message:C||"Aborted"})},v.signal.addEventListener("abort",A,{once:!0})});g(i(h,u,r?.getPendingMeta?.({requestId:h,arg:u},{getState:y,extra:E}))),O=yield Promise.race([b,Promise.resolve(n(u,{dispatch:g,getState:y,extra:E,requestId:h,signal:v.signal,abort:w,rejectWithValue:(T,_)=>new Fl(T,_),fulfillWithValue:(T,_)=>new Lm(T,_)})).then(T=>{if(T instanceof Fl)throw T;return T instanceof Lm?o(T.payload,h,u,T.meta):o(T,h,u)})])}catch(F){O=F instanceof Fl?s(null,h,u,F.payload,F.meta):s(F,h,u)}finally{A&&v.signal.removeEventListener("abort",A)}return r&&!r.dispatchConditionRejection&&s.match(O)&&O.meta.condition||g(O),O})();return Object.assign(k,{abort:w,requestId:h,arg:u,unwrap(){return k.then(iE)}})}}return Object.assign(a,{pending:i,rejected:s,fulfilled:o,settled:Ht(s,o),typePrefix:t})}return e.withTypes=()=>e,e})();function iE(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function sE(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var aE=Symbol.for("rtk-slice-createasyncthunk");function cE(e,t){return`${e}/${t}`}function uE({creators:e}={}){let t=e?.asyncThunk?.[aE];return function(r){let{name:o,reducerPath:i=o}=r;if(!o)throw new Error(ut(11));typeof process<"u";let s=(typeof r.reducers=="function"?r.reducers(dE()):r.reducers)||{},a=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(O,F){let b=typeof O=="string"?O:O.type;if(!b)throw new Error(ut(12));if(b in u.sliceCaseReducersByType)throw new Error(ut(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}};a.forEach(O=>{let F=s[O],b={reducerName:O,type:cE(o,O),createNotation:typeof r.reducers=="function"};pE(F)?gE(b,F,c,t):fE(b,F,c)});function g(){let[O={},F=[],b=void 0]=typeof r.extraReducers=="function"?$m(r.extraReducers):[r.extraReducers],T={...O,...u.sliceCaseReducersByType};return Ke(r.initialState,_=>{for(let P in T)_.addCase(P,T[P]);for(let P of u.sliceMatchers)_.addMatcher(P.matcher,P.reducer);for(let P of F)_.addMatcher(P.matcher,P.reducer);b&&_.addDefaultCase(b)})}let y=O=>O,E=new Map,h=new WeakMap,v;function A(O,F){return v||(v=g()),v(O,F)}function C(){return v||(v=g()),v.getInitialState()}function w(O,F=!1){function b(_){let P=_[O];return typeof P>"u"&&F&&(P=Vs(h,b,C)),P}function T(_=y){return Vs(Vs(E,F,()=>new WeakMap),_,()=>{let P={};for(let[N,M]of Object.entries(r.selectors??{}))P[N]=lE(M,_,()=>Vs(h,_,C),F);return P})}return{reducerPath:O,getSelectors:T,get selectors(){return T(b)},selectSlice:b}}let k={name:o,reducer:A,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:C,...w(i),injectInto(O,{reducerPath:F,...b}={}){let T=F??i;return O.inject({reducerPath:T,reducer:A},b),{...k,...w(T,!0)}}};return k}}function lE(e,t,n,r){function o(i,...s){let a=t(i);return typeof a>"u"&&r&&(a=n()),e(a,...s)}return o.unwrapped=e,o}var or=uE();function dE(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function fE({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!mE(r))throw new Error(ut(17));i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?$(e,s):$(e))}function pE(e){return e._reducerDefinitionType==="asyncThunk"}function mE(e){return e._reducerDefinitionType==="reducerWithPrepare"}function gE({type:e,reducerName:t},n,r,o){if(!o)throw new Error(ut(18));let{payloadCreator:i,fulfilled:s,pending:a,rejected:u,settled:c,options:g}=n,y=o(e,i,g);r.exposeAction(t,y),s&&r.addCase(y.fulfilled,s),a&&r.addCase(y.pending,a),u&&r.addCase(y.rejected,u),c&&r.addMatcher(y.settled,c),r.exposeCaseReducer(t,{fulfilled:s||Gs,pending:a||Gs,rejected:u||Gs,settled:c||Gs})}function Gs(){}var hE="task",Qm="listener",zm="completed",Ll="cancelled",yE=`task-${Ll}`,vE=`task-${zm}`,Dl=`${Qm}-${Ll}`,SE=`${Qm}-${zm}`,Ws=class{constructor(e){ce(this,"code");ce(this,"name","TaskAbortError");ce(this,"message");this.code=e,this.message=`${hE} ${Ll} (reason: ${e})`}},jl=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Bs=()=>{},ql=(e,t=Bs)=>(e.catch(t),e),Wm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),nr=e=>{if(e.aborted)throw new Ws(e.reason)};function Km(e,t){let n=Bs;return new Promise((r,o)=>{let i=()=>o(new Ws(e.reason));if(e.aborted){i();return}n=Wm(e,i),t.finally(()=>n()).then(r,o)}).finally(()=>{n=Bs})}var bE=/*#__PURE__*/function(){var _bE=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(n){return{status:n instanceof Ws?"cancelled":"rejected",error:n}}finally{t?.()}});function bE(_x5,_x6){return _bE.apply(this,arguments)}return bE}(),$s=e=>t=>ql(Km(e,t).then(n=>(nr(e),n))),Ym=e=>{let t=$s(e);return n=>{let r;return ql(t(new Promise(o=>{r=setTimeout(o,n)})).finally(()=>clearTimeout(r)))}},{assign:Jr}=Object,qm={},Ks="listenerMiddleware",AE=(e,t)=>{let n=r=>Wm(e,()=>r.abort(e.reason));return(r,o)=>{jl(r,"taskExecutor");let i=new l.AbortController;n(i);let s=bE(/*#__PURE__*/_asyncToGenerator(function*(){nr(e),nr(i.signal);let a=yield r({pause:$s(i.signal),delay:Ym(i.signal),signal:i.signal});return nr(i.signal),a}),()=>i.abort(vE));return o?.autoJoin&&t.push(s.catch(Bs)),{result:$s(e)(s),cancel(){i.abort(yE)}}}},wE=(e,t)=>{let n=/*#__PURE__*/function(){var _n2=_asyncToGenerator(function*(r,o){nr(t);let i=()=>{},s=[new Promise((u,c)=>{let g=e({predicate:r,effect:(y,E)=>{E.unsubscribe(),u([y,E.getState(),E.getOriginalState()])}});i=()=>{g(),c()}})],a;o!=null&&s.push(new Promise(u=>{a=setTimeout(u,o,null)}));try{let u=yield Km(t,Promise.race(s));return nr(t),u}finally{clearTimeout(a),i()}});function n(_x7,_x8){return _n2.apply(this,arguments)}return n}();return(r,o)=>ql(n(r,o))},Xm=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:i}=e;if(t)o=$(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(ut(21));return jl(i,"options.listener"),{predicate:o,type:t,effect:i}},Zm=Jr(e=>{let{type:t,predicate:n,effect:r}=Xm(e);return{id:Ai(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Zm}),Um=(e,t)=>{let{type:n,effect:r,predicate:o}=Xm(t);return Array.from(e.values()).find(i=>(typeof n=="string"?i.type===n:i.predicate===o)&&i.effect===r)},Ml=e=>{e.pending.forEach(t=>{t.abort(Dl)})},CE=(e,t)=>()=>{for(let n of t.keys())Ml(n);e.clear()},Vm=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Jm=Jr($(`${Ks}/add`),{withTypes:()=>Jm}),EE=$(`${Ks}/removeAll`),eg=Jr($(`${Ks}/remove`),{withTypes:()=>eg}),xE=(...e)=>{console.error(`${Ks}/error`,...e)},tg=(e={})=>{let t=new Map,n=new Map,r=w=>{let k=n.get(w)??0;n.set(w,k+1)},o=w=>{let k=n.get(w)??1;k===1?n.delete(w):n.set(w,k-1)},{extra:i,onError:s=xE}=e;jl(s,"onError");let a,u=()=>{if(!a){let w=Array.from(t.values()),k=new Set,O=!1;for(let F of w)typeof F.type=="string"?k.add(F.type):O=!0;a={entries:w,types:k,anyType:O}}return a},c=w=>{t.has(w.id)||(t.set(w.id,w),a=void 0)},g=w=>(w.unsubscribe=()=>{t.delete(w.id)&&(a=void 0)},c(w),k=>{w.unsubscribe(),k?.cancelActive&&Ml(w)}),y=w=>{let k=Um(t,w)??Zm(w);return g(k)};Jr(y,{withTypes:()=>y});let E=w=>{let k=Um(t,w);return k&&(k.unsubscribe(),w.cancelActive&&Ml(k)),!!k};Jr(E,{withTypes:()=>E});let h=/*#__PURE__*/function(){var _h2=_asyncToGenerator(function*(w,k,O,F){let b=new l.AbortController,T=wE(y,b.signal),_=[];try{w.pending.add(b),r(w),yield Promise.resolve(w.effect(k,Jr({},O,{getOriginalState:F,condition:(P,N)=>T(P,N).then(Boolean),take:T,delay:Ym(b.signal),pause:$s(b.signal),extra:i,signal:b.signal,fork:AE(b.signal,_),unsubscribe:w.unsubscribe,subscribe:()=>{c(w)},cancelActiveListeners:()=>{w.pending.forEach((P,N,M)=>{P!==b&&(P.abort(Dl),M.delete(P))})},cancel:()=>{b.abort(Dl),w.pending.delete(b)},throwIfCancelled:()=>{nr(b.signal)}})))}catch(P){P instanceof Ws||Vm(s,P,{raisedBy:"effect"})}finally{yield Promise.all(_),b.abort(SE),o(w),w.pending.delete(b)}});function h(_x9,_x0,_x1,_x10){return _h2.apply(this,arguments)}return h}(),v=CE(t,n),A=()=>{v(),a=void 0};return{middleware:w=>k=>O=>{if(!si(O))return k(O);if(Jm.match(O))return y(O.payload);if(EE.match(O)){A();return}if(eg.match(O))return E(O.payload);let F=w.getState(),b=()=>{if(F===qm)throw new Error(ut(23));return F},T;try{T=k(O);let{entries:_,types:P,anyType:N}=u();if(N||P.has(O.type)){let M=w.getState();for(let B of _){if(typeof B.type=="string"&&B.type!==O.type)continue;let q=!1;try{q=B.predicate(O,M,F)}catch(L){q=!1,Vm(s,L,{raisedBy:"predicate"})}q&&h(B,O,w,b)}}}finally{F=qm}return T},startListening:y,stopListening:E,clearListeners:A}};function ut(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 J=new te({required:!0,emptyAllowed:!1}),Ye=new te({required:!1,emptyAllowed:!1}),jt=new te({required:!0,emptyAllowed:!0}),FL=new te({required:!1,emptyAllowed:!0}),ng=new Lt({each:J,required:!0}),rg=new te({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),og=new te({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),DL=new te({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),IE=({message:e,name:t,stack:n})=>({message:e,name:t,stack:n}),Ul=(e,t)=>{if("required"in t)return{payload:new Mt({value:t}).validate({value:e}).value};let o=new Re({options:{required:!0},values:t}).validate(e);if(o)throw new fl(o);return{payload:e}},K=(e,t)=>{try{return Ul(e,t)}catch(n){return{payload:e,error:IE(n)}}};var Ys=(e,t,n,r)=>{let o=`Check the options of ${r}`;return RE(e,t,n,o,"Controller initialization error")},RE=(e,t,n,r,o)=>{try{return t.validate(n,r)}catch(i){throw e.logger.error(i,o),i}};var Xs=$("caseAssistConfiguration/set",e=>K(e,{caseAssistId:J,locale:Ye,proxyBaseUrl:new te({required:!1,url:!0})}));m();d();p();f();m();d();p();f();var ig=()=>({caseAssistId:"",locale:"en-US"});var Cn=Ke(ig(),e=>{e.addCase(Xs,(t,n)=>{t.caseAssistId=n.payload.caseAssistId,t.locale=n.payload.locale,t.apiBaseUrl=n.payload.proxyBaseUrl})});m();d();p();f();m();d();p();f();m();d();p();f();var sg={q:new te,enableQuerySyntax:new Ve,aq:new te,cq:new te,firstResult:new qe({min:0}),numberOfResults:new qe({min:0}),sortCriteria:new te,f:new Re,fExcluded:new Re,cf:new Re,nf:new Re,mnf:new Re,df:new Re,debug:new Ve,sf:new Re,tab:new te,af:new Re};var Zs=$("searchParameters/restore",e=>K(e,sg)),ag=$("searchParameters/restoreTab",e=>K(e,J));m();d();p();f();var cg=$("debug/enable"),ug=$("debug/disable");m();d();p();f();var Js=()=>!1;var lg=Ke(Js(),e=>{e.addCase(cg,()=>!0).addCase(ug,()=>!1).addCase(Zs,(t,n)=>n.payload.debug??t)});m();d();p();f();var ea=$("searchHub/set",e=>K(e,new te({required:!0,emptyAllowed:!0})));m();d();p();f();m();d();p();f();m();d();p();f();var ro="3.59.0",dg=["@coveo/atomic","@coveo/quantic"];var Vl=()=>Ye,fg=()=>J,oo=$("configuration/updateBasicConfiguration",e=>K(e,{accessToken:Ye,environment:new te({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Ye})),ta=$("configuration/updateSearchConfiguration",e=>K(e,{proxyBaseUrl:new te({required:!1,url:!0}),pipeline:new te({required:!1,emptyAllowed:!0}),searchHub:Ye,timezone:Ye,locale:Ye,authenticationProviders:new Lt({required:!1,each:J})})),TE={enabled:new Ve({default:!0}),originContext:Vl(),originLevel2:Vl(),originLevel3:Vl(),proxyBaseUrl:new te({required:!1,url:!0}),runtimeEnvironment:new Kn,anonymous:new Ve({default:!1}),deviceId:Ye,userDisplayName:Ye,documentLocation:Ye,trackingId:og,analyticsMode:new te({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Re({options:{required:!1},values:dg.reduce((e,t)=>(e[t]=rg,e),{})})},na=$("configuration/updateAnalyticsConfiguration",e=>K(e,TE)),ra=$("configuration/analytics/disable"),oa=$("configuration/analytics/enable"),pg=$("configuration/analytics/originlevel2",e=>K(e,{originLevel2:fg()})),mg=$("configuration/analytics/originlevel3",e=>K(e,{originLevel3:fg()})),gg=$("knowledge/setAgentId",e=>K(e,new te({required:!0})));m();d();p();f();var kE=$("history/undo"),_E=$("history/redo"),Qt=$("history/snapshot"),dq=Te("history/back",/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,{dispatch:t}){t(kE()),yield t(ia())});return function(_x11,_x12){return _ref3.apply(this,arguments)}}()),fq=Te("history/forward",/*#__PURE__*/function(){var _ref4=_asyncToGenerator(function*(e,{dispatch:t}){t(_E()),yield t(ia())});return function(_x13,_x14){return _ref4.apply(this,arguments)}}()),ia=Te("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 io=()=>"default";var hg=Ke(io(),e=>{e.addCase(ea,(t,n)=>n.payload).addCase(ia.fulfilled,(t,n)=>n.payload?.searchHub??t).addCase(ta,(t,n)=>n.payload.searchHub||t)});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function yg(){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 vg=/^(?:[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 OE(e){return typeof e=="string"&&vg.test(e)}var Gl=OE;m();d();p();f();var tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));function Sg(e,t=0){return(tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]).toLowerCase()}m();d();p();f();var PE=new Uint8Array(16);function Bl(){return crypto.getRandomValues(PE)}m();d();p();f();function NE(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():FE(e,t,n)}function FE(e,t,n){e=e||{};let r=e.random??e.rng?.()??Bl();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Sg(r)}var $l=NE;function DE(_x17){return _DE.apply(this,arguments)}function _DE(){_DE=_asyncToGenerator(function*({config:e,environment:t,event:n,listenerManager:r}){let{url:o,token:i,mode:s}=e;if(s!=="disabled")return r.call(n),t.send(o,i,n)});return _DE.apply(this,arguments)}var xg="2.1.3",Hl=128,Ig=192,bg=224,Ag=240,ME=248;function LE(e){return(e&ME)===Ag?4:(e&Ag)===bg?3:(e&bg)===Ig?2:1}function jE(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&e.charAt(n-3)=="%";){let r=Number.parseInt(e.substring(n-2,n),16);if((r&Hl)!=Hl)break;if(n-=3,(r&Ig)!=Hl){t-n>=LE(r)*3&&(n=t);break}}return e.substring(0,n)}function qE(e){let{trackingId:t}=e;return{trackingId:t}}function UE(e){return(e.source||[]).concat([`relay@${xg}`])}function Rg(e,t,n){let{getReferrer:r,getLocation:o,getUserAgent:i}=n,s=qE(t),a=n.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:UE(t),clientId:a,userAgent:i(),referrer:wg(r()),location:wg(o())})}function wg(e){return e!==null?jE(e,1024):null}function VE(e,t,n,r){return{...t,meta:Rg(e,n,r)}}var GE="*";function BE(){let e=[];function t({type:u,callback:c}){return e.findIndex(g=>g.type===u&&g.callback===c)}function n(u,c){return u.type==="*"||c===u.type}function r(u){return t(u)<0&&e.push(u),()=>a(u.type,u.callback)}function o(u){e.forEach(c=>{if(n(c,u.meta.type))try{c.callback(u)}catch(g){console.error(g)}})}function i(u){if(u===GE)e.length=0;else for(let c=e.length-1;c>=0;c--)e[c].type===u&&e.splice(c,1)}function s(u){let c=t(u);c>=0&&e.splice(c,1)}function a(u,c){c?s({type:u,callback:c}):i(u)}return{add:r,call:o,remove:a}}function Cg({url:e,token:t,trackingId:n,...r}){return Object.freeze({url:e,token:t,trackingId:n,...(!!r.mode&&{mode:r.mode}),...(!!r.source&&{source:r.source}),...(!!r.environment&&{environment:r.environment})})}function $E(e){let t=Cg(e);return{get:()=>t,update:n=>{t=Cg({...t,...n})}}}var Ql=HE();function HE(){let e="coveo_",t=n=>{let r=n.split(".").slice(-2);return r.length==2?r.join("."):""};return{getItem(n){let r=`${e}${n}=`,o=document.cookie.split(";");for(let i of o){let s=i.replace(/^\s+/,"");if(s.lastIndexOf(r,0)===0)return s.substring(r.length,s.length)}return null},setItem(n,r,o){let i=t(window.location.hostname),s=`;expires=${new Date((new Date).getTime()+o).toUTCString()}`,a=i?`;domain=${i}`:"";document.cookie=`${e}${n}=${r}${s}${a};path=/;SameSite=Lax`},removeItem(n){this.setItem(n,"",-1)}}}function QE(){return{getItem(e){return Ql.getItem(e)||localStorage.getItem(e)},removeItem(e){Ql.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Ql.setItem(e,t,31556952e3)}}}var Eg="visitorId";function zE(){let e=document.referrer;return e===""?null:e}function zl(){let e=QE();return{runtime:"browser",send:function(){var _send=_asyncToGenerator(function*(t,n,r){let o=I(t,{method:"POST",body:JSON.stringify([r]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});yg().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:t,token:n});let s=yield o;if(s?.ok){let a;try{a=yield s.json()}catch{return}for(let u of a.events)if(!u.accepted)throw new Error(`Received event was rejected for processing: ${u.errorMessage}`)}else throw new Error(`Error ${s.status}: Failed to send the event(s).`)});function send(_x18,_x19,_x20){return _send.apply(this,arguments)}return send}(),getReferrer:()=>zE(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Eg);if(t&&Gl(t))return t;let n=$l();return e.setItem(Eg,n),n}}}function WE(){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 KE(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function YE(e){let t=e.get().mode!=="disabled",n=e.get().environment,r=KE();return t&&n?{...n,runtime:"custom"}:t&&XE()&&WE()?zl():r}function XE(){try{return typeof window=="object"}catch{return!1}}function ZE(e){return{get:()=>Object.freeze(YE(e))}}function Tg(e){let t=$E(e),n=BE(),r=ZE(t);return{emit:function(){var _emit=_asyncToGenerator(function*(o,i){let s=t.get(),a=r.get(),u=VE(o,i,s,a);return DE({config:s,environment:a,event:u,listenerManager:n})});function emit(_x21,_x22){return _emit.apply(this,arguments)}return emit}(),getMeta:o=>Rg(o,t.get(),r.get()),on:(o,i)=>n.add({type:o,callback:i}),off:(o,i)=>n.remove(o,i),updateConfig:o=>t.update(o),version:xg}}m();d();p();f();function kg(){return typeof window<"u"&&typeof document<"u"}m();d();p();f();var so=Qe(e=>e.source,e=>Object.entries(e).map(([t,n])=>`${t}@${n}`).concat(`@coveo/headless@${ro}`));var JE=50,ex=Us({memoize:Nl,memoizeOptions:{maxSize:JE}}),wi=ex(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>so(e.configuration.analytics),(e,t)=>t,(e,t,n,{trackingId:r,apiBaseUrl:o,enabled:i},s,a)=>{let u=nx(a);return Tg({mode:i?"emit":"disabled",url:o??ys(e,t),token:n,trackingId:r??null,source:s,environment:u})}),tx={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _send2=_asyncToGenerator(function*(){});function send(){return _send2.apply(this,arguments)}return send}()},nx=e=>{if(!e)return;let t=e();return{...(kg()?zl():tx),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();p();f();m();d();p();f();m();d();p();f();var _g=class extends Error{constructor(t){super(t[0].message);ce(this,"issues");this.name="SchemaError",this.issues=t}};var rd="uninitialized",Yl="pending",Xl="fulfilled",Zl="rejected";function Og(e){return{status:e,isUninitialized:e===rd,isLoading:e===Yl,isSuccess:e===Xl,isError:e===Zl}}var Pg=$t;function Kg(e,t){if(e===t||!(Pg(e)&&Pg(t)||Array.isArray(e)&&Array.isArray(t)))return t;let n=Object.keys(t),r=Object.keys(e),o=n.length===r.length,i=Array.isArray(t)?[]:{};for(let s of n)i[s]=Kg(e[s],t[s]),o&&(o=Object.is(e[s],i[s]));return o?e:i}function Jl(e,t,n){return e.reduce((r,o,i)=>(t(o,i)&&r.push(n(o,i)),r),[]).flat()}function rx(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ox(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function od(e){return e!=null}function Ng(e){return[...(e?.values()??[])].filter(od)}function ix(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var sx=e=>e.replace(/\/$/,""),ax=e=>e.replace(/^\//,"");function cx(e,t){if(!e)return t;if(!t)return e;if(rx(t))return t;let n=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=sx(e),t=ax(t),`${e}${n}${t}`}function la(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ed=()=>new Map,ux=e=>{let t=new l.AbortController,n=setTimeout(()=>{let r="signal timed out",o="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,o):Object.assign(new Error(r),{name:o}))},e);return{signal:t.signal,clear:()=>clearTimeout(n)}},lx=(...e)=>{for(let n of e)if(n.aborted)return l.AbortSignal.abort(n.reason);let t=new l.AbortController;for(let n of e)n.addEventListener("abort",()=>t.abort(n.reason),{signal:t.signal,once:!0});return t.signal},Fg=(...e)=>I(...e),dx=e=>e.status>=200&&e.status<=299,Dg=e=>/ion\/(vnd\.api\+)?json/i.test(e.get("content-type")||""),Mg=e=>(e instanceof Error||typeof DOMException<"u"&&e instanceof DOMException)&&e.name==="TimeoutError";function Lg(e){if(!$t(e))return e;let t={...e};for(let[n,r]of Object.entries(t))r===void 0&&delete t[n];return t}var jg=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`,fx=e=>jg(e,"FormData")||jg(e,"URLSearchParams"),px=e=>typeof e=="object"&&e!==null&&($t(e)||Array.isArray(e)||typeof e.toJSON=="function");function Yg({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:n=Fg,paramsSerializer:r,isJsonContentType:o=Dg,jsonContentType:i="application/json",jsonReplacer:s,timeout:a,responseHandler:u,validateStatus:c,...g}={}){return typeof I>"u"&&n===Fg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(function*(E,h,v){let{getState:A,extra:C,endpoint:w,forced:k,type:O}=h,F,{url:b,headers:T=new R(g.headers),params:_=void 0,responseHandler:P=u??"json",validateStatus:N=c??dx,timeout:M=a,...B}=typeof E=="string"?{url:E}:E,q=M?ux(M):void 0;try{let L={...g,signal:q?lx(h.signal,q.signal):h.signal,...B};T=new R(Lg(T)),L.headers=(yield t(T,{getState:A,arg:E,extra:C,endpoint:w,forced:k,type:O,extraOptions:v}))||T;let V=px(L.body);if(L.body!=null&&!V&&typeof L.body!="string"&&(fx(L.body)||Dg(L.headers)||o(L.headers))&&L.headers.delete("content-type"),!L.headers.has("content-type")&&V&&L.headers.set("content-type",i),V&&o(L.headers)&&(L.body=JSON.stringify(L.body,s)),L.headers.has("accept")||(P==="json"?L.headers.set("accept","application/json"):P==="text"&&L.headers.set("accept","text/plain, text/html, */*")),_){let re=~b.indexOf("?")?"&":"?",oe=r?r(_):new URLSearchParams(Lg(_));b+=re+oe}b=cx(e,b);let j=new Request(b,L);F={request:new Request(b,L)};let U;try{U=yield n(j)}catch(re){return{error:{status:Mg(re)?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(re)},meta:F}}let Q=U.clone();F.response=Q;let z,X="";try{let re,oe=!1;if(yield Promise.all([y(U,P).then(ae=>z=ae,ae=>{oe=!0,re=ae}),Q.text().then(ae=>X=ae,()=>{})]),oe)throw re}catch(re){return L.signal?.aborted&&Mg(L.signal.reason)?{error:{status:"TIMEOUT_ERROR",error:String(L.signal.reason)},meta:F}:{error:{status:"PARSING_ERROR",originalStatus:U.status,data:X,error:String(re)},meta:F}}return N(U,z)?{data:z,meta:F}:{error:{status:U.status,data:z},meta:F}}finally{q?.clear()}});return function(_x23,_x24,_x25){return _ref6.apply(this,arguments)}}());function y(_x26,_x27){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(E,h){if(typeof h=="function")return h(E);if(h==="content-type"&&(h=o(E.headers)?"json":"text"),h==="json"){let v=yield E.text();return v.length?JSON.parse(v):null}return E.text()});return _y2.apply(this,arguments)}}var ao=class{constructor(e,t=void 0){ce(this,"value");ce(this,"meta");this.value=e,this.meta=t}};function mx(){return _mx.apply(this,arguments)}function _mx(){_mx=_asyncToGenerator(function*(e=0,t=5,n){let r=Math.min(e,t),o=~~((Math.random()+.4)*(300<<r));yield new Promise((i,s)=>{let a=setTimeout(()=>i(),o);if(n){let u=()=>{clearTimeout(a),s(new Error("Aborted"))};n.aborted?(clearTimeout(a),s(new Error("Aborted"))):n.addEventListener("abort",u,{once:!0})}})});return _mx.apply(this,arguments)}function Xg(e,t){throw Object.assign(new ao({error:e,meta:t}),{throwImmediately:!0})}function Wl(e){e.aborted&&Xg({status:"CUSTOM_ERROR",error:"Aborted"})}var qg={},gx=(e,t)=>(/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,r,o){let[i]=[5,(t||qg).maxRetries,(o||qg).maxRetries].filter(c=>c!==void 0).slice(-1),a={maxRetries:i,backoff:mx,retryCondition:(c,g,{attempt:y})=>y<=i,...t,...o},u=0;for(;;){Wl(r.signal);try{let c=yield e(n,r,o);if(c.error)throw new ao(c);return c}catch(c){if(u++,c.throwImmediately){if(c instanceof ao)return c.value;throw c}if(c instanceof ao){if(!a.retryCondition(c.value.error,n,{attempt:u,baseQueryApi:r,extraOptions:o}))return c.value}else if(u>a.maxRetries)return{error:c};Wl(r.signal);try{yield a.backoff(u,a.maxRetries,r.signal)}catch(g){throw Wl(r.signal),g}}}});return function(_x28,_x29,_x30){return _ref7.apply(this,arguments)}}()),Zg=Object.assign(gx,{fail:Xg}),da="__rtkq/",Jg="online",eh="offline",hx="focus",th="focused",yx="visibilitychange",xi=$(`${da}${th}`),id=$(`${da}un${th}`),fa=$(`${da}${Jg}`),sd=$(`${da}${eh}`);var vx=new Map,Ci=e=>{for(let t of[...vx.keys()])t(e())},i1={[hx]:()=>Ci(xi),[yx]:()=>{window.document.visibilityState==="visible"?Ci(xi):Ci(id)},[Jg]:()=>Ci(fa),[eh]:()=>Ci(sd)};var ki="query",nh="mutation",rh="infinitequery";function pa(e){return e.type===ki}function Sx(e){return e.type===nh}function Ii(e){return e.type===rh}function Ri(e){return pa(e)||Ii(e)}function ad(e,t,n,r,o,i){let s=bx(e)?e(t,n,r,o):e;return s?Jl(s,od,a=>i(oh(a))):[]}function bx(e){return typeof e=="function"}function oh(e){return typeof e=="string"?{type:e}:e}var co=Symbol.for("RTKQ/skipToken");function Ax(e,t){return e.catch(t)}var _i=(e,t)=>e.endpointDefinitions[t],Ti=Symbol("forceQueryFn"),ca=e=>typeof e[Ti]=="function";function wx({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:n,mutationThunk:r,api:o,context:i,getInternalState:s}){let a=b=>s(b)?.runningQueries,u=b=>s(b)?.runningMutations,{unsubscribeQueryResult:c,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:k,buildInitiateInfiniteQuery:O,buildInitiateMutation:F,getRunningQueryThunk:E,getRunningMutationThunk:h,getRunningQueriesThunk:v,getRunningMutationsThunk:A};function E(b,T){return _=>{let P=e({queryArgs:T,endpointDefinition:_i(i,b),endpointName:b});return a(_)?.get(P)}}function h(b,T){return _=>u(_)?.get(T)}function v(){return b=>Ng(a(b))}function A(){return b=>Ng(u(b))}function C(b){}function w(b,T){let _=(P,{subscribe:N=!0,forceRefetch:M,subscriptionOptions:B,[Ti]:q,...L}={})=>(V,j)=>{let U=P===co?`${b}(skipToken)`:e({queryArgs:P,endpointDefinition:T,endpointName:b}),Q,z={...L,type:ki,subscribe:N,forceRefetch:M,subscriptionOptions:B,endpointName:b,originalArgs:P,queryCacheKey:U,[Ti]:q};if(pa(T))Q=t(z);else{let{direction:ye,initialPageParam:he,refetchCachedPages:we}=L;Q=n({...z,direction:ye,initialPageParam:he,refetchCachedPages:we})}let X=o.endpoints[b].select(P),re=V(Q),oe=X(j());let{requestId:ae,abort:Ie}=re,Pe=oe.requestId!==ae,xe=P===co?void 0:a(V)?.get(U),He=()=>X(j()),De=Object.assign(q?re.then(He):Pe&&!xe?Promise.resolve(oe):Promise.all([xe,re]).then(He),{arg:P,requestId:ae,subscriptionOptions:B,queryCacheKey:U,abort:Ie,unwrap(){return _asyncToGenerator(function*(){let ye=yield De;if(ye.isError)throw ye.error;return ye.data})()},refetch:ye=>V(_(P,{subscribe:!1,forceRefetch:!0,...ye})),unsubscribe(){N&&V(c({queryCacheKey:U,requestId:ae}))},updateSubscriptionOptions(ye){De.subscriptionOptions=ye,V(y({endpointName:b,requestId:ae,queryCacheKey:U,options:ye}))}});if(!Pe&&!q){let ye=a(V);ye.set(U,De);let he=()=>{ye.get(U)===De&&ye.delete(U)};De.then(he,he)}return De};return _}function k(b,T){return w(b,T)}function O(b,T){return w(b,T)}function F(b){return(T,{track:_=!0,fixedCacheKey:P}={})=>(N,M)=>{let B=N(r({type:"mutation",endpointName:b,originalArgs:T,track:_,fixedCacheKey:P}));let{requestId:q,abort:L,unwrap:V}=B,j=Ax(B.unwrap().then(X=>({data:X})),X=>({error:X})),U=()=>{N(g({requestId:q,fixedCacheKey:P}))},Q=Object.assign(j,{arg:B.arg,requestId:q,abort:L,unwrap:V,reset:U}),z=u(N);return z.set(q,Q),Q.then(()=>{z.delete(q)}),P&&(z.set(P,Q),Q.then(()=>{z.get(P)===Q&&z.delete(P)})),Q}}}var ih=class extends _g{constructor(t,n,r,o){super(t);ce(this,"value");ce(this,"schemaName");ce(this,"_bqMeta");this.value=n,this.schemaName=r,this._bqMeta=o}},ir=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function sr(_x31,_x32,_x33,_x34){return _sr.apply(this,arguments)}function _sr(){_sr=_asyncToGenerator(function*(e,t,n,r){let o=yield e["~standard"].validate(t);if(o.issues)throw new ih(o.issues,t,n,r);return o.value});return _sr.apply(this,arguments)}function Ug(e){return e}var Ei=(e={})=>({...e,[Si]:!0});function Cx({reducerPath:e,baseQuery:t,context:{endpointDefinitions:n},serializeQueryArgs:r,api:o,assertTagType:i,selectors:s,onSchemaFailure:a,catchSchemaFailure:u,skipSchemaValidation:c}){let g=new WeakMap,y=new Map;function E(j,U){let Q=(g.get(U)??0)+1;g.set(U,Q);let z={startedTimeStamp:Date.now(),seq:Q};return y.set(j,z),z}function h(j,U){let Q=y.get(j)??E(j,U);return y.delete(j),Q}let v=(j,U,Q,z)=>(X,re)=>{let oe=n[j],ae=r({queryArgs:U,endpointDefinition:oe,endpointName:j});if(X(o.internalActions.queryResultPatched({queryCacheKey:ae,patches:Q})),!z)return;let Ie=o.endpoints[j].select(U)(re()),Pe=ad(oe.providesTags,Ie.data,void 0,U,{},i);X(o.internalActions.updateProvidedBy([{queryCacheKey:ae,providedTags:Pe}]))};function A(j,U,Q=0){let z=[U,...j];return Q&&z.length>Q?z.slice(0,-1):z}function C(j,U,Q=0){let z=[...j,U];return Q&&z.length>Q?z.slice(1):z}let w=(j,U,Q,z=!0)=>(X,re)=>{let oe=o.endpoints[j].select(U)(re()),ae={patches:[],inversePatches:[],undo:()=>X(o.util.patchQueryData(j,U,ae.inversePatches,z))};if(oe.status==="uninitialized")return ae;let Ie;if("data"in oe)if(ct(oe.data)){let[Pe,xe,He]=km(oe.data,Q);ae.patches.push(...xe),ae.inversePatches.push(...He),Ie=Pe}else Ie=Q(oe.data),ae.patches.push({op:"replace",path:[],value:Ie}),ae.inversePatches.push({op:"replace",path:[],value:oe.data});return ae.patches.length===0||X(o.util.patchQueryData(j,U,ae.patches,z)),ae},k=(j,U,Q)=>z=>z(o.endpoints[j].initiate(U,{subscribe:!1,forceRefetch:!0,[Ti]:()=>({data:Q})})),O=(j,U)=>j.query&&j[U]?j[U]:Ug,F=/*#__PURE__*/function(){var _F=_asyncToGenerator(function*(j,{signal:U,abort:Q,rejectWithValue:z,fulfillWithValue:X,dispatch:re,getState:oe,extra:ae,requestId:Ie}){let Pe=h(Ie,oe),xe=n[j.endpointName],{metaSchema:He,skipSchemaValidation:De=c}=xe,ye=j.type===ki;try{let he=Ug,we={signal:U,abort:Q,dispatch:re,getState:oe,extra:ae,endpoint:j.endpointName,type:j.type,forced:ye?b(j,oe()):void 0,queryCacheKey:ye?j.queryCacheKey:void 0},$e=ye?j[Ti]:void 0,Ue,pt=/*#__PURE__*/function(){var _pt=_asyncToGenerator(function*(Fe,Oe,It,mt){if(Oe==null&&Fe.pages.length)return Promise.resolve({data:Fe});let Hn=yield Bt({queryArg:j.originalArgs,pageParam:Oe}),sn=mt?A:C;return{data:{pages:sn(Fe.pages,Hn.data,It),pageParams:sn(Fe.pageParams,Oe,It)},meta:Hn.meta}});function pt(_x37,_x38,_x39,_x40){return _pt.apply(this,arguments)}return pt}();function Bt(_x41){return _Bt.apply(this,arguments)}function _Bt(){_Bt=_asyncToGenerator(function*(Fe){let Oe,{extraOptions:It,argSchema:mt,rawResponseSchema:Hn,responseSchema:sn}=xe;if(mt&&!ir(De,"arg")&&(Fe=yield sr(mt,Fe,"argSchema",{})),$e?Oe=$e():xe.query?(he=O(xe,"transformResponse"),Oe=yield t(xe.query(Fe),we,It)):Oe=yield xe.queryFn(Fe,we,It,Xo=>t(Xo,we,It)),typeof process<"u",Oe.error)throw new ao(Oe.error,Oe.meta);let{data:Qn}=Oe;Hn&&!ir(De,"rawResponse")&&(Qn=yield sr(Hn,Oe.data,"rawResponseSchema",Oe.meta));let An=yield he(Qn,Oe.meta,Fe);return sn&&!ir(De,"response")&&(An=yield sr(sn,An,"responseSchema",Oe.meta)),{...Oe,data:An}});return _Bt.apply(this,arguments)}if(ye&&"infiniteQueryOptions"in xe){let{infiniteQueryOptions:Fe}=xe,{maxPages:Oe=1/0}=Fe,It=j.refetchCachedPages??Fe.refetchCachedPages??!0,mt,Hn={pages:[],pageParams:[]},sn=s.selectQueryEntry(oe(),j.queryCacheKey)?.data,Qn=b(j,oe())&&!j.direction||!sn?Hn:sn;if("direction"in j&&j.direction&&Qn.pages.length){let An=j.direction==="backward";mt=yield pt(Qn,(An?td:ua)(Fe,Qn,j.originalArgs),Oe,An)}else{let{initialPageParam:An=Fe.initialPageParam}=j,Xo=sn?.pageParams??[],Ap=Xo[0]??An,wp=Xo.length;if(mt=yield pt(Qn,Ap,Oe),$e&&(mt={data:mt.data.pages[0]}),It)for(let Cp=1;Cp<wp;Cp++){let YA=ua(Fe,mt.data,j.originalArgs);mt=yield pt(mt.data,YA,Oe)}}Ue=mt}else Ue=yield Bt(j.originalArgs);return He&&!ir(De,"meta")&&Ue.meta&&(Ue.meta=yield sr(He,Ue.meta,"metaSchema",Ue.meta)),X(Ue.data,Ei({...Pe,fulfilledTimeStamp:Date.now(),baseQueryMeta:Ue.meta}))}catch(he){let we=he;if(we instanceof ao){let $e=O(xe,"transformErrorResponse"),{rawErrorResponseSchema:Ue,errorResponseSchema:pt}=xe,{value:Bt,meta:Fe}=we;try{Ue&&!ir(De,"rawErrorResponse")&&(Bt=yield sr(Ue,Bt,"rawErrorResponseSchema",Fe)),He&&!ir(De,"meta")&&(Fe=yield sr(He,Fe,"metaSchema",Fe));let Oe=yield $e(Bt,Fe,j.originalArgs);return pt&&!ir(De,"errorResponse")&&(Oe=yield sr(pt,Oe,"errorResponseSchema",Fe)),z(Oe,Ei({...Pe,baseQueryMeta:Fe}))}catch(Oe){we=Oe}}try{if(we instanceof ih){let $e={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:ye?j.queryCacheKey:void 0};xe.onSchemaFailure?.(we,$e),a?.(we,$e);let{catchSchemaFailure:Ue=u}=xe;if(Ue)return z(Ue(we,$e),Ei({...Pe,baseQueryMeta:we._bqMeta}))}}catch($e){we=$e}throw typeof process<"u",console.error(we),we}});function F(_x35,_x36){return _F.apply(this,arguments)}return F}();function b(j,U){let Q=s.selectQueryEntry(U,j.queryCacheKey),z=s.selectConfig(U).refetchOnMountOrArgChange,X=Q?.fulfilledTimeStamp,re=j.forceRefetch??(j.subscribe&&z);return re?re===!0||(Number(new Date)-Number(X))/1e3>=re:!1}let T=()=>Te(`${e}/executeQuery`,F,{getPendingMeta({arg:j,requestId:U},{getState:Q}){let z=n[j.endpointName];return Ei({...E(U,Q),...(Ii(z)?{direction:j.direction}:{})})},condition(j,{getState:U}){let Q=U(),z=s.selectQueryEntry(Q,j.queryCacheKey),X=z?.fulfilledTimeStamp,re=j.originalArgs,oe=z?.originalArgs,ae=n[j.endpointName],Ie=j.direction;if(ca(j))return!0;if(j.originalArgs===co||z?.status==="pending")return!1;if(b(j,Q)||pa(ae)&&ae?.forceRefetch?.({currentArg:re,previousArg:oe,endpointState:z,state:Q}))return!0;if(X&&!Ie)return!1;if(Ie&&Ii(ae)){let Pe=z?.data;if(Pe?.pages.length){let{infiniteQueryOptions:xe}=ae;if((Ie==="forward"?ua:td)(xe,Pe,re)==null)return!1}}return!0},dispatchConditionRejection:!0}),_=T(),P=T(),N=Te(`${e}/executeMutation`,F,{getPendingMeta({requestId:j},{getState:U}){return Ei(E(j,U))}}),M=j=>"force"in j,B=j=>"ifOlderThan"in j,q=(j,U,Q={})=>(z,X)=>{let re=M(Q)&&Q.force,oe=B(Q)&&Q.ifOlderThan,ae=(Pe=!0)=>{let xe={forceRefetch:Pe,subscribe:!1};return o.endpoints[j].initiate(U,xe)},Ie=o.endpoints[j].select(U)(X());if(re)z(ae());else if(oe){let Pe=Ie?.fulfilledTimeStamp;if(!Pe){z(ae());return}(Number(new Date)-Number(new Date(Pe)))/1e3>=oe&&z(ae())}else z(ae(!1))};function L(j){return U=>U?.meta?.arg?.endpointName===j}function V(j,U){return{matchPending:eo(Qs(j),L(U)),matchFulfilled:eo(ln(j),L(U)),matchRejected:eo(rr(j),L(U))}}return{queryThunk:_,mutationThunk:N,infiniteQueryThunk:P,prefetch:q,updateQueryData:w,upsertQueryData:k,patchQueryData:v,buildMatchThunkActions:V}}function ua(e,{pages:t,pageParams:n},r){let o=t.length-1;return e.getNextPageParam(t[o],t,n[o],n,r)}function td(e,{pages:t,pageParams:n},r){return e.getPreviousPageParam?.(t[0],t,n[0],n,r)}function nd(e,t,n,r){return ad(n[e.meta.arg.endpointName][t],ln(e)?e.payload:void 0,no(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function Kl(e){return ft(e)?js(e):e}function sa(e,t,n){let r=e[t];r&&n(r)}function uo(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Vg(e,t,n){let r=e[uo(t)];r&&n(r)}function Ex(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n].type!==t[n].type||e[n].id!==t[n].id)return!1;return!0}var aa={};function xx({reducerPath:e,queryThunk:t,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:s,hasRehydrationInfo:a},assertTagType:u,config:c}){let g=$(`${e}/resetApiState`);function y(N,M,B,q){var L;N[L=M.queryCacheKey]??(N[L]={status:rd,endpointName:M.endpointName}),sa(N,M.queryCacheKey,V=>{B&&V.requestId||(V.status=Yl,V.requestId=q.requestId),M.originalArgs!==void 0&&(V.originalArgs=M.originalArgs),V.startedTimeStamp=q.startedTimeStamp;let j=o[q.arg.endpointName];Ii(j)&&"direction"in M&&(V.direction=M.direction)})}function E(N,M,B,q){sa(N,M.arg.queryCacheKey,L=>{if(L.requestId!==M.requestId&&!q)return;let{merge:V}=o[M.arg.endpointName];if(L.status=Xl,V){if(L.data!==void 0){let{fulfilledTimeStamp:j,arg:U,baseQueryMeta:Q,requestId:z}=M;L.data=tr(L.data,X=>V(X,B,{arg:U.originalArgs,baseQueryMeta:Q,fulfilledTimeStamp:j,requestId:z}))}else L.data=B;}else L.data=o[M.arg.endpointName].structuralSharing??!0?Kg(ft(L.data)?kl(L.data):L.data,B):B;delete L.error,L.fulfilledTimeStamp=M.fulfilledTimeStamp})}let h=or({name:`${e}/queries`,initialState:aa,reducers:{removeQueryResult:{reducer(N,{payload:{queryCacheKey:M}}){delete N[M]},prepare:to()},cacheEntriesUpserted:{reducer(N,M){for(let B of M.payload){let{queryDescription:q,value:L}=B;y(N,q,!0,{arg:q,requestId:M.meta.requestId,startedTimeStamp:M.meta.timestamp}),E(N,{arg:q,requestId:M.meta.requestId,fulfilledTimeStamp:M.meta.timestamp,baseQueryMeta:{}},L,!0)}},prepare:N=>{let M=[];for(let{endpointName:B,arg:q,value:L}of N){let V=o[B];if(!V||!Ri(V))continue;let j={type:ki,endpointName:B,originalArgs:q,queryCacheKey:r({queryArgs:q,endpointDefinition:V,endpointName:B})},U;try{U=nd({type:"UNKNOWN",payload:L,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}},"providesTags",o,u)}catch{continue}M.push({queryDescription:j,value:L,providedTags:U})}return{payload:M,meta:{[Si]:!0,requestId:Ai(),timestamp:Date.now()}}}},queryResultPatched:{reducer(N,{payload:{queryCacheKey:M,patches:B}}){sa(N,M,q=>{q.data=Ol(q.data,B.concat())})},prepare:to()}},extraReducers(N){N.addCase(t.pending,(M,{meta:B,meta:{arg:q}})=>{y(M,q,ca(q),B)}).addCase(t.fulfilled,(M,{meta:B,payload:q})=>{E(M,B,q,ca(B.arg))}).addCase(t.rejected,(M,{meta:{condition:B,arg:q,requestId:L},error:V,payload:j})=>{sa(M,q.queryCacheKey,U=>{if(!B){if(U.requestId!==L)return;U.status=Zl,U.error=j??V}})}).addMatcher(a,(M,B)=>{let{queries:q}=s(B);for(let[L,V]of Object.entries(q))(V?.status==="fulfilled"||V?.status==="rejected")&&(M[L]=V)})}}),v=or({name:`${e}/mutations`,initialState:aa,reducers:{removeMutationResult:{reducer(N,{payload:M}){let B=uo(M);B in N&&delete N[B]},prepare:to()}},extraReducers(N){N.addCase(n.pending,(M,{meta:B,meta:{requestId:q,arg:L,startedTimeStamp:V}})=>{L.track&&(M[uo(B)]={requestId:q,status:Yl,endpointName:L.endpointName,startedTimeStamp:V})}).addCase(n.fulfilled,(M,{payload:B,meta:q})=>{q.arg.track&&Vg(M,q,L=>{L.requestId===q.requestId&&(L.status=Xl,L.data=B,L.fulfilledTimeStamp=q.fulfilledTimeStamp)})}).addCase(n.rejected,(M,{payload:B,error:q,meta:L})=>{L.arg.track&&Vg(M,L,V=>{V.requestId===L.requestId&&(V.status=Zl,V.error=B??q)})}).addMatcher(a,(M,B)=>{let{mutations:q}=s(B);for(let[L,V]of Object.entries(q))(V?.status==="fulfilled"||V?.status==="rejected")&&L!==V?.requestId&&(M[L]=V)})}}),A=or({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(N,M){var L,V,j;let B=Kl(N.keys),q=new Set;for(let{queryCacheKey:U,providedTags:Q}of M.payload)if(!(!q.has(U)&&Ex(B[U],Q))){q.add(U),C(N,U);for(let{type:z,id:X}of Q){let re=(V=(L=N.tags)[z]??(L[z]={}))[j=X??"__internal_without_id"]??(V[j]=[]);re.includes(U)||re.push(U)}N.keys[U]=Q}},prepare:to()}},extraReducers(N){N.addCase(h.actions.removeQueryResult,(M,{payload:{queryCacheKey:B}})=>{C(M,B)}).addMatcher(a,(M,B)=>{var L,V,j;let{provided:q}=s(B);for(let[U,Q]of Object.entries(q.tags??{}))for(let[z,X]of Object.entries(Q)){let re=(V=(L=M.tags)[U]??(L[U]={}))[j=z??"__internal_without_id"]??(V[j]=[]);for(let oe of X)re.includes(oe)||re.push(oe),M.keys[oe]=q.keys[oe]}}).addMatcher(Ht(ln(t),no(t)),(M,B)=>{no(B)&&ca(B.meta.arg)||w(M,[B])}).addMatcher(h.actions.cacheEntriesUpserted.match,(M,B)=>{A.caseReducers.updateProvidedBy(M,A.actions.updateProvidedBy(B.payload.map(({queryDescription:q,providedTags:L})=>({queryCacheKey:q.queryCacheKey,providedTags:L}))))})}});function C(N,M){let B=Kl(N.keys[M]??[]);for(let q of B){let L=q.type,V=q.id??"__internal_without_id",j=N.tags[L]?.[V];j&&(N.tags[L][V]=Kl(j).filter(U=>U!==M))}delete N.keys[M]}function w(N,M){let B=M.map(q=>{let L=nd(q,"providesTags",o,u),{queryCacheKey:V}=q.meta.arg;return{queryCacheKey:V,providedTags:L}});A.caseReducers.updateProvidedBy(N,A.actions.updateProvidedBy(B))}let k=or({name:`${e}/subscriptions`,initialState:aa,reducers:{updateSubscriptionOptions(N,M){},unsubscribeQueryResult(N,M){},internal_getRTKQSubscriptions(){}}}),O=or({name:`${e}/internalSubscriptions`,initialState:aa,reducers:{subscriptionsUpdated:{reducer(N,M){return Ol(N,M.payload)},prepare:to()}}}),F=or({name:`${e}/config`,initialState:{online:ix(),focused:ox(),middlewareRegistered:!1,...c},reducers:{middlewareRegistered(N,{payload:M}){N.middlewareRegistered=N.middlewareRegistered==="conflict"||i!==M?"conflict":!0}},extraReducers:N=>{N.addCase(fa,M=>{M.online=!0}).addCase(sd,M=>{M.online=!1}).addCase(xi,M=>{M.focused=!0}).addCase(id,M=>{M.focused=!1}).addMatcher(a,M=>({...M}))}}),b=Yn({queries:h.reducer,mutations:v.reducer,provided:A.reducer,subscriptions:O.reducer,config:F.reducer}),T=`${e}/`;function _(N){let{type:M}=N;return typeof M!="string"||M.startsWith(T)||M.startsWith("__rtkq/")||M.startsWith("@@redux/")||a(N)}return{reducer:(N,M)=>N!==void 0&&!_(M)?N:b(g.match(M)?void 0:N,M),actions:{...F.actions,...h.actions,...k.actions,...O.actions,...v.actions,...A.actions,resetApiState:g}}}var sh={status:rd},Gg=tr(sh,()=>{}),Bg=tr(sh,()=>{});function Ix({serializeQueryArgs:e,reducerPath:t,createSelector:n}){let r=T=>Gg,o=T=>Bg,i=new WeakMap,s=new Map,a=n(g,T=>{let _=[];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)),_.push(M)}return _});return{buildQuerySelector:A,buildInfiniteQuerySelector:C,buildMutationSelector:w,selectInvalidatedBy:k,selectCachedArgsForQuery:O,selectAllQueryEntries:a,selectEntriesForEndpoint:n(a,(T,_)=>_,(T,_)=>{let P=T.filter(M=>M.endpointName===_),N=s.get(_);return N&&N.length===P.length&&N.every((M,B)=>M===P[B])?N:(s.set(_,P),P)}),selectApiState:c,selectQueries:g,selectMutations:E,selectQueryEntry:y,selectConfig:h};function u(T){return{...T,...Og(T.status)}}function c(T){return T[t]}function g(T){return c(T)?.queries}function y(T,_){return g(T)?.[_]}function E(T){return c(T)?.mutations}function h(T){return c(T)?.config}function v(T,_,P){return N=>{if(N===co)return n(r,P);let M=e({queryArgs:N,endpointDefinition:_,endpointName:T});return n(q=>y(q,M)??Gg,P)}}function A(T,_){return v(T,_,u)}function C(T,_){let{infiniteQueryOptions:P}=_;function N(M){let B={...M,...Og(M.status)},{isLoading:q,isError:L,direction:V}=B,j=V==="forward",U=V==="backward";return{...B,hasNextPage:F(P,B.data,B.originalArgs),hasPreviousPage:b(P,B.data,B.originalArgs),isFetchingNextPage:q&&j,isFetchingPreviousPage:q&&U,isFetchNextPageError:L&&j,isFetchPreviousPageError:L&&U}}return v(T,_,N)}function w(){return T=>{let _;return typeof T=="object"?_=uo(T)??co:_=T,n(_===co?o:N=>c(N)?.mutations?.[_]??Bg,u)}}function k(T,_){let P=T[t],N=new Set,M=Jl(_,od,oh);for(let B of M){let q=P.provided.tags[B.type];if(!q)continue;let L=(B.id!==void 0?q[B.id]:Object.values(q).flat())??[];for(let V of L)N.add(V)}return Array.from(N.values()).flatMap(B=>{let q=P.queries[B];return q?{queryCacheKey:B,endpointName:q.endpointName,originalArgs:q.originalArgs}:[]})}function O(T,_){return Jl(Object.values(g(T)),P=>P?.endpointName===_&&P.status!=="uninitialized",P=>P.originalArgs)}function F(T,_,P){return _?ua(T,_,P)!=null:!1}function b(T,_,P){return!_||!T.getPreviousPageParam?!1:td(T,_,P)!=null}}var $g=WeakMap?new WeakMap:void 0,Hg=({endpointName:e,queryArgs:t})=>{let n="",r=$g?.get(t);if(typeof r=="string")n=r;else{let o=JSON.stringify(t,(i,s)=>(s=typeof s=="bigint"?{$bigint:s.toString()}:s,s=$t(s)?Object.keys(s).sort().reduce((a,u)=>(a[u]=s[u],a),{}):s,s));$t(t)&&$g?.set(t,o),n=o}return`${e}(${n})`};function Rx(...e){return function(n){let r=Zr(c=>n.extractRehydrationInfo?.(c,{reducerPath:n.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...n,extractRehydrationInfo:r,serializeQueryArgs(c){let g=Hg;if(c.endpointDefinition&&"serializeQueryArgs"in c.endpointDefinition){let y=c.endpointDefinition.serializeQueryArgs;g=E=>{let h=y(E);return typeof h=="string"?h:Hg({...E,queryArgs:h})}}else n.serializeQueryArgs&&(g=n.serializeQueryArgs);return g(c)},tagTypes:[...(n.tagTypes||[])]},i={endpointDefinitions:{},batch(c){c()},apiUid:Ai(),extractRehydrationInfo:r,hasRehydrationInfo:Zr(c=>r(c)!=null)},s={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,E]of Object.entries(g)){let h=_i(i,y);!h&&typeof process<"u",typeof E=="function"?E(h):Object.assign(h||{},E)}return s}},a=e.map(c=>c.init(s,o,i));function u(c){let g=c.endpoints({query:y=>({...y,type:ki}),mutation:y=>({...y,type:nh}),infiniteQuery:y=>({...y,type:rh})});for(let[y,E]of Object.entries(g)){if(c.overrideExisting!==!0&&y in i.endpointDefinitions){if(c.overrideExisting==="throw")throw new Error(ut(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[y]=E;for(let h of a)h.injectEndpoint(y,E)}return s}return s.injectEndpoints({endpoints:n.endpoints})}}function dn(e,...t){return Object.assign(e,...t)}var Tx=({api:e,queryThunk:t,internalState:n,mwApi:r})=>{let o=`${e.reducerPath}/subscriptions`,i=new Set,s=new Set,a=null,{updateSubscriptionOptions:u,unsubscribeQueryResult:c}=e.internalActions,g=()=>{let w=[];for(let k of i){let O=n.currentSubscriptions.get(k);O?(s.add(k),w.push({op:"add",path:[k],value:Object.fromEntries(O)})):(s.delete(k),w.push({op:"remove",path:[k]}))}return i.clear(),w},y=(w,k,O,F)=>{let b=la(w,k,ed),T=F??b.get(O)??{};b.set(O,T),i.add(k)},E=(w,k)=>{if(u.match(k)){let{queryCacheKey:O,requestId:F,options:b}=k.payload,T=w.get(O);return T?.has(F)?(T.set(F,b),i.add(O),!0):!1}if(c.match(k)){let{queryCacheKey:O,requestId:F}=k.payload;return w.get(O)?.delete(F)?(i.add(O),!0):!1}if(e.internalActions.removeQueryResult.match(k)){let{queryCacheKey:O}=k.payload;return w.delete(O),s.has(O)||i.has(O)?(i.add(O),!0):!1}if(t.pending.match(k)){let{meta:{arg:O,requestId:F}}=k;return O.subscribe?(y(w,O.queryCacheKey,F,O.subscriptionOptions),!0):(la(w,O.queryCacheKey,ed),!1)}if(t.rejected.match(k)){let{meta:{condition:O,arg:F,requestId:b}}=k;if(O&&F.subscribe)return y(w,F.queryCacheKey,b,F.subscriptionOptions),!0}return!1},h=()=>n.currentSubscriptions,C={getSubscriptions:h,getSubscriptionCount:w=>h().get(w)?.size??0,isRequestSubscribed:(w,k)=>!!h()?.get(w)?.get(k)};return(w,k)=>{if(e.util.resetApiState.match(w))return i.clear(),s.clear(),n.currentSubscriptions.clear(),a&&(clearTimeout(a),a=null),[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(w))return[!1,C];E(n.currentSubscriptions,w)&&!a&&(a=setTimeout(()=>{let T=g();a=null,T.length&&k.next(e.internalActions.subscriptionsUpdated(T))},500));let F=typeof w.type=="string"&&w.type.startsWith(o),b=t.rejected.match(w)&&w.meta.condition&&!!w.meta.arg.subscribe;return[!F&&!b,!1]}},Qg=2147483647,kx=2147483647/1e3-1,_x=({reducerPath:e,api:t,queryThunk:n,context:r,internalState:o,selectors:{selectQueryEntry:i,selectConfig:s},getRunningQueryThunk:a,mwApi:u})=>{let{removeQueryResult:c,unsubscribeQueryResult:g,cacheEntriesUpserted:y}=t.internalActions,E=b=>n.rejected.match(b)&&!b.meta.condition,h=Ht(g.match,n.fulfilled,E,y.match);function v(b){let T=o.currentSubscriptions.get(b);return T?T.size>0:!1}let A={};function C(b){for(let T of b.values())T?.abort?.()}function w(b){let T=A[b];T&&(clearTimeout(T),delete A[b])}let k=(b,T)=>{let _=s(T.getState());if((n.pending.match(b)||n.rejected.match(b)&&b.meta.condition)&&b.meta.arg.subscribe&&w(b.meta.arg.queryCacheKey),c.match(b)&&w(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,_)}if(t.util.resetApiState.match(b)){for(let[P,N]of Object.entries(A))N&&clearTimeout(N),delete A[P];C(o.runningQueries),C(o.runningMutations)}if(r.hasRehydrationInfo(b)){let{queries:P}=r.extractRehydrationInfo(b);O(Object.keys(P),T,_)}};function O(b,T,_){let P=T.getState();for(let N of b){let M=i(P,N);M?.endpointName&&F(N,M.endpointName,T,_)}}function F(b,T,_,P){let N=_i(r,T)?.keepUnusedDataFor??P.keepUnusedDataFor;if(N===1/0)return;let M=Math.max(0,Math.min(N,kx));if(!v(b)){let B=A[b];B&&clearTimeout(B),A[b]=setTimeout(()=>{if(delete A[b],!v(b)){let q=i(_.getState(),b);q?.endpointName&&_.dispatch(a(q.endpointName,q.originalArgs))?.abort(),_.dispatch(c({queryCacheKey:b}))}},M*1e3)}}return k},zg=new Error("Promise never resolved before cacheEntryRemoved.");function ah(e,t,n){try{return e()}catch(r){console.error(r);return}}var Ox=({api:e,reducerPath:t,context:n,queryThunk:r,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:s,selectApiState:a}})=>{let u=zs(r),c=zs(o),g=ln(r,o),y={},{removeQueryResult:E,removeMutationResult:h,cacheEntriesUpserted:v}=e.internalActions;function A(b,T,_,P){let N=y[b];N?.valueResolved&&(P===void 0||N.requestIds?.has(P))&&(N.valueResolved({data:T,meta:_}),delete N.valueResolved,delete N.requestIds)}function C(b){let T=y[b];T&&(delete y[b],T.cacheEntryRemoved())}function w(b){let{arg:T,requestId:_}=b.meta,{endpointName:P,originalArgs:N}=T;return[P,N,_]}let k=(b,T,_)=>{let P=O(b);function N(M,B,q,L){let V=s(_,B),j=s(T.getState(),B);!V&&j&&F(M,L,B,T,q)}if(r.pending.match(b)){let[M,B,q]=w(b);N(M,P,q,B),y[P]?.requestIds?.add(q)}else if(v.match(b))for(let{queryDescription:M,value:B}of b.payload){let{endpointName:q,originalArgs:L,queryCacheKey:V}=M;N(q,V,b.meta.requestId,L),A(V,B,{})}else if(o.pending.match(b)){if(T.getState()[t].mutations[P]){let[M,B,q]=w(b);C(P),F(M,B,P,T,q)}}else if(g(b))A(P,b.payload,b.meta.baseQueryMeta,b.meta.requestId);else if(E.match(b)||h.match(b))C(P);else if(e.util.resetApiState.match(b))for(let M of Object.keys(y))C(M)};function O(b){return u(b)?b.meta.arg.queryCacheKey:c(b)?b.meta.arg.fixedCacheKey??b.meta.requestId:E.match(b)?b.payload.queryCacheKey:h.match(b)?uo(b.payload):""}function F(b,T,_,P,N){let M=_i(n,b),B=M?.onCacheEntryAdded;if(!B)return;let q={requestIds:new Set([N])},L=new Promise(X=>{q.cacheEntryRemoved=X}),V=Promise.race([new Promise(X=>{q.valueResolved=X}),L.then(()=>{throw zg})]);V.catch(()=>{}),y[_]=q;let j=e.endpoints[b].select(Ri(M)?T:_),U=P.dispatch((X,re,oe)=>oe),Q={...P,getCacheEntry:()=>j(P.getState()),requestId:N,extra:U,updateCachedData:Ri(M)?X=>P.dispatch(e.util.updateQueryData(b,T,X)):void 0,cacheDataLoaded:V,cacheEntryRemoved:L},z=ah(()=>B(T,Q),b,"onCacheEntryAdded");Promise.resolve(z).catch(X=>{if(X!==zg)throw X})}return k};function ch(e,t,n,r){t.next(e.internalActions.middlewareRegistered(n)),typeof process<"u"}var Px=({api:e,context:{apiUid:t},reducerPath:n})=>(r,o)=>{e.util.resetApiState.match(r)&&ch(e,o,t,n)},Nx=({reducerPath:e,context:t,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:o,api:i,assertTagType:s,refetchQuery:a,internalState:u})=>{let{removeQueryResult:c}=i.internalActions,g=Ht(ln(r),no(r)),y=Ht(ln(o,r),rr(o,r)),E=[],h=new Set,v=(w,k)=>{if(i.util.resetApiState.match(w)){h.clear(),E=[];return}(o.pending.match(w)||r.pending.match(w))&&h.add(w.meta.requestId),y(w)&&h.delete(w.meta.requestId),g(w)?C(nd(w,"invalidatesTags",n,s),k):y(w)?C([],k):i.util.invalidateTags.match(w)&&C(ad(w.payload,void 0,void 0,void 0,void 0,s),k)};function A(){return h.size>0}function C(w,k){let O=k.getState(),F=O[e];if(E.push(...w),F.config.invalidationBehavior==="delayed"&&A())return;let b=E;if(E=[],b.length===0)return;let T=i.util.selectInvalidatedBy(O,b);t.batch(()=>{let _=Array.from(T.values());for(let{queryCacheKey:P}of _){let N=F.queries[P],M=la(u.currentSubscriptions,P,ed);N&&(M.size===0?k.dispatch(c({queryCacheKey:P})):N.status!=="uninitialized"&&k.dispatch(a(N)))}})}return v},Fx=({reducerPath:e,queryThunk:t,api:n,refetchQuery:r,internalState:o})=>{let{currentPolls:i,currentSubscriptions:s}=o,a=new Set,u=null,c=(C,w)=>{(n.internalActions.updateSubscriptionOptions.match(C)||n.internalActions.unsubscribeQueryResult.match(C))&&g(C.payload.queryCacheKey,w),(t.pending.match(C)||t.rejected.match(C)&&C.meta.condition)&&g(C.meta.arg.queryCacheKey,w),(t.fulfilled.match(C)||t.rejected.match(C)&&!C.meta.condition)&&y(C.meta.arg,w),n.internalActions.removeQueryResult.match(C)&&h(C.payload.queryCacheKey),n.util.resetApiState.match(C)&&(v(),u&&(clearTimeout(u),u=null),a.clear())};function g(C,w){!i.has(C)&&!Number.isFinite(A(s.get(C)).lowestPollingInterval)||(a.add(C),u||(u=setTimeout(()=>{for(let k of a)E({queryCacheKey:k},w);a.clear(),u=null},0)))}function y({queryCacheKey:C},w,k){let O=w.getState()[e].queries[C],{lowestPollingInterval:F}=A(s.get(C));if(!O||O.status==="uninitialized"||!Number.isFinite(F)){h(C);return}let b=i.get(C);b?.timeout&&(clearTimeout(b.timeout),b.timeout=void 0);let T=Math.min(F,Qg),_=k??T,P=Date.now()+_;i.set(C,{nextPollTimestamp:P,pollingInterval:T,timeout:setTimeout(()=>{let N=w.getState()[e],M=N.queries[C],{lowestPollingInterval:B,skipPollingIfUnfocused:q}=A(s.get(C));if(!M||M.status==="uninitialized"||!Number.isFinite(B)){h(C);return}if(M.status==="pending"){h(C);return}(N.config.focused||!q)&&w.dispatch(r(M)),y({queryCacheKey:C},w)},_)})}function E({queryCacheKey:C},w){let k=w.getState()[e].queries[C],O=s.get(C);if(!k||k.status==="uninitialized")return;let{lowestPollingInterval:F}=A(O);if(!Number.isFinite(F)){h(C);return}let b=i.get(C);if(!b){y({queryCacheKey:C},w);return}let T=Math.min(F,Qg);if(T>b.pollingInterval){let _=b.nextPollTimestamp-b.pollingInterval;y({queryCacheKey:C},w,_+T-Date.now())}else Date.now()+T<b.nextPollTimestamp&&y({queryCacheKey:C},w)}function h(C){let w=i.get(C);w?.timeout&&clearTimeout(w.timeout),i.delete(C)}function v(){for(let C of i.keys())h(C)}function A(C=new Map){let w=!1,k=Number.POSITIVE_INFINITY;for(let O of C.values())O.pollingInterval&&(k=Math.min(O.pollingInterval,k),w=O.skipPollingIfUnfocused||w);return{lowestPollingInterval:k,skipPollingIfUnfocused:w}}return c},Dx=({api:e,context:t,queryThunk:n,mutationThunk:r})=>{let o=Qs(n,r),i=rr(n,r),s=ln(n,r),a={};return(c,g)=>{if(o(c)){let{requestId:y,arg:{endpointName:E,originalArgs:h}}=c.meta,v=_i(t,E),A=v?.onQueryStarted;if(A){let C={},w=new Promise((b,T)=>{C.resolve=b,C.reject=T});w.catch(()=>{}),a[y]=C;let k=e.endpoints[E].select(Ri(v)?h:uo(c.meta)),O=g.dispatch((b,T,_)=>_),F={...g,getCacheEntry:()=>k(g.getState()),requestId:y,extra:O,updateCachedData:Ri(v)?b=>g.dispatch(e.util.updateQueryData(E,h,b)):void 0,queryFulfilled:w};ah(()=>A(h,F),E,"onQueryStarted")}}else if(s(c)){let{requestId:y,baseQueryMeta:E}=c.meta;a[y]?.resolve({data:c.payload,meta:E}),delete a[y]}else if(i(c)){let{requestId:y,rejectedWithValue:E,baseQueryMeta:h}=c.meta;a[y]?.reject({error:c.payload??c.error,isUnhandledError:!E,meta:h}),delete a[y]}}},Mx=({reducerPath:e,context:t,api:n,refetchQuery:r,internalState:o})=>{let{removeQueryResult:i}=n.internalActions,s=(u,c)=>{xi.match(u)&&a(c,"refetchOnFocus"),fa.match(u)&&a(c,"refetchOnReconnect")};function a(u,c){let g=u.getState()[e],y=g.queries,E=o.currentSubscriptions;t.batch(()=>{for(let h of E.keys()){let v=y[h],A=E.get(h);if(!A||!v)continue;let C=[...A.values()];(C.some(w=>w[c]===!0)||C.every(w=>w[c]===void 0)&&g.config[c])&&(A.size===0?u.dispatch(i({queryCacheKey:h})):v.status!=="uninitialized"&&u.dispatch(r(v)))}})}return s};function Lx(e){let{reducerPath:t,queryThunk:n,api:r,context:o,getInternalState:i}=e,{apiUid:s}=o,a={invalidateTags:$(`${t}/invalidateTags`)},u=E=>E.type.startsWith(`${t}/`),c=[Px,_x,Nx,Fx,Ox,Dx];return{middleware:E=>{let h=!1,v=i(E.dispatch),A={...e,internalState:v,refetchQuery:y,isThisApiSliceAction:u,mwApi:E},C=c.map(O=>O(A)),w=Tx(A),k=Mx(A);return O=>F=>{if(!si(F))return O(F);let b={...E,next:O};h||(h=!0,ch(r,b,s,t));let T=E.getState(),[_,P]=w(F,b,T),N;if(_?N=O(F):N=P,E.getState()[t]&&(k(F,b,T),u(F)||o.hasRehydrationInfo(F)))for(let M of C)M(F,b,T);return N}},actions:a};function y(E){return e.api.endpoints[E.endpointName].initiate(E.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Wg=Symbol(),jx=({createSelector:e=Qe}={})=>({name:Wg,init(t,{baseQuery:n,tagTypes:r,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:s,refetchOnMountOrArgChange:a,refetchOnFocus:u,refetchOnReconnect:c,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:E,skipSchemaValidation:h},v){Tm();let A=he=>(typeof process<"u",he);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:fa,onOffline:sd,onFocus:xi,onFocusLost:id},util:{}});let C=Ix({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:w,selectCachedArgsForQuery:k,selectEntriesForEndpoint:O,selectAllQueryEntries:F,buildQuerySelector:b,buildInfiniteQuerySelector:T,buildMutationSelector:_}=C;dn(t.util,{selectInvalidatedBy:w,selectCachedArgsForQuery:k,selectEntriesForEndpoint:O,selectAllQueryEntries:F});let{queryThunk:P,infiniteQueryThunk:N,mutationThunk:M,patchQueryData:B,updateQueryData:q,upsertQueryData:L,prefetch:V,buildMatchThunkActions:j}=Cx({baseQuery:n,reducerPath:o,context:v,api:t,serializeQueryArgs:i,assertTagType:A,selectors:C,onSchemaFailure:y,catchSchemaFailure:E,skipSchemaValidation:h}),{reducer:U,actions:Q}=xx({context:v,queryThunk:P,infiniteQueryThunk:N,mutationThunk:M,serializeQueryArgs:i,reducerPath:o,assertTagType:A,config:{refetchOnFocus:u,refetchOnReconnect:c,refetchOnMountOrArgChange:a,keepUnusedDataFor:s,reducerPath:o,invalidationBehavior:g}});dn(t.util,{patchQueryData:B,updateQueryData:q,upsertQueryData:L,prefetch:V,resetApiState:Q.resetApiState,upsertQueryEntries:Q.cacheEntriesUpserted}),dn(t.internalActions,Q);let z=new WeakMap,X=he=>la(z,he,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:re,buildInitiateInfiniteQuery:oe,buildInitiateMutation:ae,getRunningMutationThunk:Ie,getRunningMutationsThunk:Pe,getRunningQueriesThunk:xe,getRunningQueryThunk:He}=wx({queryThunk:P,mutationThunk:M,infiniteQueryThunk:N,api:t,serializeQueryArgs:i,context:v,getInternalState:X});dn(t.util,{getRunningMutationThunk:Ie,getRunningMutationsThunk:Pe,getRunningQueryThunk:He,getRunningQueriesThunk:xe});let{middleware:De,actions:ye}=Lx({reducerPath:o,context:v,queryThunk:P,mutationThunk:M,infiniteQueryThunk:N,api:t,assertTagType:A,selectors:C,getRunningQueryThunk:He,getInternalState:X});return dn(t.util,ye),dn(t,{reducer:U,middleware:De}),{name:Wg,injectEndpoint(he,we){var pt;let Ue=(pt=t.endpoints)[he]??(pt[he]={});pa(we)&&dn(Ue,{name:he,select:b(he,we),initiate:re(he,we)},j(P,he)),Sx(we)&&dn(Ue,{name:he,select:_(),initiate:ae(he)},j(M,he)),Ii(we)&&dn(Ue,{name:he,select:T(he,we),initiate:oe(he,we)},j(P,he))}}}}),uh=Rx(jx());m();d();p();f();m();d();p();f();var ar=e=>e.query,lh=e=>e.query?.enableQuerySyntax;var A1=Qe(e=>ar(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,n,r,o)=>({q:e,requestId:t,cannotAnswer:n,analyticsMode:r,actionCause:o})),qx=Qe(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function fn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function G(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(y){s(y)}}function u(g){try{c(r.throw(g))}catch(y){s(y)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})}var Se;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Se||(Se={}));function ld(){return typeof window<"u"}function Ed(){return typeof navigator<"u"}function lo(){return typeof document<"u"}function dd(){try{return typeof localStorage<"u"}catch{return!1}}function Ux(){try{return typeof sessionStorage<"u"}catch{return!1}}function wh(){return Ed()&&navigator.cookieEnabled}var Vx=[Se.click,Se.custom,Se.search,Se.view],Gx=(e,t)=>Vx.indexOf(e)!==-1?Object.assign({language:lo()?document.documentElement.lang:"unknown",userAgent:Ed()?navigator.userAgent:"unknown"},t):t,fo=class e{static set(t,n,r){let o;r&&(o=new Date,o.setTime(o.getTime()+r)),fd(t,n,o,Bx(window.location.hostname))}static get(t){for(var n=t+"=",r=document.cookie.split(";"),o=0;o<r.length;o++){var i=r[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Bx(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let n=2;n<=t.length;n++){let r=t.slice(-n).join(".");if($x(r))return r}}function $x(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return fd(t,"1",void 0,e),fo.get(t)==="1"}catch{return!1}finally{try{fd(t,"",new Date(0),e)}catch{}}}function fd(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Hx(){return dd()?localStorage:wh()?new Pi:Ux()?sessionStorage:new mo}var Pi=class e{getItem(t){return fo.get(`${e.prefix}${t}`)}removeItem(t){fo.erase(`${e.prefix}${t}`)}setItem(t,n,r){fo.set(`${e.prefix}${t}`,n,r)}};Pi.prefix="coveo_";var pd=class{constructor(){this.cookieStorage=new Pi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,n){localStorage.setItem(t,n),this.cookieStorage.setItem(t,n,31556926e3)}},mo=class{getItem(t){return null}removeItem(t){}setItem(t,n){}},ma="__coveo.analytics.history",Qx=20,zx=1e3*60,Wx=75,ha=class{constructor(t){this.store=t||Hx()}addElement(t){t.internalTime=(new Date).getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let n=this.getHistoryWithInternalTime();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):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 n=yield this.getHistoryWithInternalTimeAsync();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):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(ma);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(ma);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ma,JSON.stringify(t.slice(0,Qx)))}catch{}}clear(){try{this.store.removeItem(ma)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((r,o)=>(o.internalTime||0)-(r.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Wx)),t}isValidEntry(t){let n=this.getMostRecentElement();return n&&n.value==t.value?(t.internalTime||0)-(n.internalTime||0)>zx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(n=>{let{name:r,time:o,value:i}=n;return{name:r,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:n,time:r,value:o}=t;return n&&typeof o=="string"&&n.toLowerCase()==="query"&&o.trim()===""?{name:n,time:r}:t}stripEmptyQueries(t){return t.map(n=>this.stripEmptyQuery(n))}};var Kx=(e,t)=>G(void 0,void 0,void 0,function*(){return e===Se.view?(yield Yx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Yx=e=>G(void 0,void 0,void 0,function*(){let t=new ha,n={name:"PageView",value:e,time:(new Date).toISOString()};yield t.addElementAsync(n)}),Xx=/^(?:[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 ya(e){return typeof e=="string"&&Xx.test(e)}function dh(e){if(!ya(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 nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function Ch(e,t=0){return(nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]).toLowerCase()}var Zx=new Uint8Array(16);function Jx(){return crypto.getRandomValues(Zx)}function eI(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var tI="6ba7b810-9dad-11d1-80b4-00c04fd430c8",nI="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function rI(e,t,n,r,o,i){let s=typeof n=="string"?eI(n):n,a=typeof r=="string"?dh(r):r;if(typeof r=="string"&&(r=dh(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+s.length);return u.set(a),u.set(s,a.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,Ch(u)}function cr(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():oI(e,t,n)}function oI(e,t,n){e=e||{};let r=e.random??e.rng?.()??Jx();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Ch(r)}function iI(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function cd(e,t){return e<<t|e>>>32-t}function sI(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let o=e.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let u=new Uint32Array(16);for(let c=0;c<16;++c)u[c]=e[a*64+c*4]<<24|e[a*64+c*4+1]<<16|e[a*64+c*4+2]<<8|e[a*64+c*4+3];s[a]=u}s[i-1][14]=(e.length-1)*8/2**32,s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let u=new Uint32Array(80);for(let v=0;v<16;++v)u[v]=s[a][v];for(let v=16;v<80;++v)u[v]=cd(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);let c=n[0],g=n[1],y=n[2],E=n[3],h=n[4];for(let v=0;v<80;++v){let A=Math.floor(v/20),C=cd(c,5)+iI(A,g,y,E)+h+t[A]+u[v]>>>0;h=E,E=y,y=cd(g,30)>>>0,g=c,c=C}n[0]=n[0]+c>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+E>>>0,n[4]=n[4]+h>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function va(e,t,n,r){return rI(80,sI,e,t)}va.DNS=tI;va.URL=nI;var Eh="2.33.1",fh=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Oi={pageview:"pageview",event:"event"},Sa=class{constructor({client:t,uuidGenerator:n=cr}){this.client=t,this.uuidGenerator=n}},md=class extends Sa{constructor({client:t,uuidGenerator:n=cr}){super({client:t,uuidGenerator:n}),this.actionData={},this.pageViewId=n(),this.nextPageViewId=this.pageViewId,this.currentLocation=fh(window.location),this.lastReferrer=lo()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,n){this.action=t,this.actionData=n}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,n){return Object.assign({hitType:t},this.getNextValues(t,n))}updateLocationInformation(t,n){this.updateLocationForNextPageView(t,n)}getDefaultContextInformation(t){let n={title:lo()?document.title:"",encoding:lo()?document.characterSet:"UTF-8"},r={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),r),o),n)}updateLocationForNextPageView(t,n){let{pageViewId:r,referrer:o,location:i}=this.getNextValues(t,n);this.lastReferrer=o,this.pageViewId=r,this.currentLocation=i,t===Oi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,n){return{pageViewId:t===Oi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Oi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Oi.pageview?this.getCurrentLocationFromPayload(n):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let n=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${n(t.page)}`}else return fh(window.location)}},En=class e{constructor(t,n){if(!ya(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(n/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,n){return!this.expired&&this.matchReferrer(t,n)}matchReferrer(t,n){try{let r=new URL(t);return n.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(r.host))}catch{return!1}}static fromString(t){let n=t.split(".");if(n.length!==2)return null;let[r,o]=n;if(r.length!==32||isNaN(parseInt(o)))return null;let i=r.substring(0,8)+"-"+r.substring(8,12)+"-"+r.substring(12,16)+"-"+r.substring(16,20)+"-"+r.substring(20,32);return ya(i)?new e(i,Number.parseInt(o)*1e3):null}};En.cvo_cid="cvo_cid";En.expirationTime=120;var gd=class extends Sa{constructor({client:t,uuidGenerator:n=cr}){super({client:t,uuidGenerator:n})}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 n=new URL(t),r=yield this.client.getCurrentVisitorId();return n.searchParams.set(En.cvo_cid,new En(r,Date.now()).toString()),n.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};gd.Id="link";var kt=Object.keys;function ga(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ud=128,xh=192,ph=224,mh=240;function aI(e){return(e&248)===mh?4:(e&mh)===ph?3:(e&ph)===xh?2:1}function cI(e,t){if(t<0||e.length<=t)return e;let n=e.indexOf("%",t-2);for(n<0||n>t?n=t:t=n;n>2&&e.charAt(n-3)=="%";){let r=Number.parseInt(e.substring(n-2,n),16);if((r&ud)!=ud)break;if(n-=3,(r&xh)!=ud){t-n>=aI(r)*3&&(n=t);break}}return e.substring(0,n)}var hd={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"},uI=kt(hd).map(e=>hd[e]),lI=[...uI].join("|"),dI=new RegExp(`^(${lI}$)`),fI={svcAction:"svc_action",svcActionData:"svc_action_data"},pI=e=>kt(e).filter(t=>e[t]!==void 0).reduce((t,n)=>{let r=hd[n]||n;return Object.assign(Object.assign({},t),{[r]:e[n]})},{}),mI=e=>dI.test(e),gI=[mI],gh={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},hh={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},lt={action:"pa",list:"pal",listSource:"pls"},ba={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},hI=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],yd={id:"quoteId",affiliation:"quoteAffiliation"},vd={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},yI={add:lt,bookmark_add:lt,bookmark_remove:lt,click:lt,checkout:lt,checkout_option:lt,detail:lt,impression:lt,remove:lt,refund:Object.assign(Object.assign({},lt),ba),purchase:Object.assign(Object.assign({},lt),ba),quickview:lt,quote:Object.assign(Object.assign({},lt),yd),review:Object.assign(Object.assign({},lt),vd)},vI=kt(gh).map(e=>gh[e]),SI=kt(hh).map(e=>hh[e]),bI=kt(lt).map(e=>lt[e]),AI=kt(ba).map(e=>ba[e]),wI=kt(vd).map(e=>vd[e]),CI=kt(yd).map(e=>yd[e]),EI=[...vI,"custom"].join("|"),xI=[...SI,"custom"].join("|"),Ih="(pr[0-9]+)",Rh="(il[0-9]+pi[0-9]+)",II=new RegExp(`^${Ih}(${EI})$`),RI=new RegExp(`^(${Rh}(${xI}))|(il[0-9]+nm)$`),TI=new RegExp(`^(${bI.join("|")})$`),kI=new RegExp(`^(${AI.join("|")})$`),_I=new RegExp(`^${Ih}custom$`),OI=new RegExp(`^${Rh}custom$`),PI=new RegExp(`^(${[...hI,...wI,...CI].join("|")})$`),NI=e=>II.test(e),FI=e=>RI.test(e),DI=e=>TI.test(e),MI=e=>kI.test(e),LI=e=>PI.test(e),jI=[FI,NI,DI,MI,LI],qI=[_I,OI],UI={anonymizeIp:"aip"},VI={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},GI={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},BI=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],$I=Object.assign(Object.assign(Object.assign(Object.assign({},UI),VI),GI),BI.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Sd=Object.assign(Object.assign({},$I),fI),HI=e=>{let t=!!e.action&&yI[e.action]||{};return kt(e).reduce((n,r)=>{let o=t[r]||Sd[r]||r;return Object.assign(Object.assign({},n),{[o]:e[r]})},{})},QI=kt(Sd).map(e=>Sd[e]),zI=e=>QI.indexOf(e)!==-1,WI=e=>e==="custom",KI=e=>[...jI,...gI,zI,WI].some(t=>t(e)),YI=e=>kt(e).reduce((t,n)=>{let r=XI(n);return r?Object.assign(Object.assign({},t),ZI(r,e[n])):Object.assign(Object.assign({},t),{[n]:e[n]})},{}),XI=e=>{let t;return[...qI].every(n=>{var r;return t=(r=n.exec(e))===null||r===void 0?void 0:r[1],!t}),t},ZI=(e,t)=>kt(t).reduce((n,r)=>Object.assign(Object.assign({},n),{[`${e}${r}`]:t[r]}),{}),bd=class{constructor(t){this.opts=t}sendEvent(t,n){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:r,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:s,payload:a}=yield this.preProcessRequestAsPotentialJSONString(`${r}/analytics/${t}?${i}`,n,o),u=this.encodeForEventType(t,a),c=new Blob([u],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(s,c)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,n,r){return G(this,void 0,void 0,function*(){let o=t,i=n;if(r){let s=yield r({url:t,body:JSON.stringify(n)},"analyticsBeacon"),{url:a,body:u}=s;o=a||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,n){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,n):this.encodeEventToJson(t,n,this.opts.token)}getQueryParamsForEventType(t){return G(this,void 0,void 0,function*(){let{token:n,visitorIdProvider:r}=this.opts,o=yield r.getCurrentVisitorId();return[n&&this.isEventTypeLegacy(t)?`access_token=${n}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[Se.click,Se.custom,Se.search,Se.view].indexOf(t)!==-1}encodeEventToJson(t,n,r){let o=`${t}Event=${encodeURIComponent(JSON.stringify(n))}`;return r&&(o=`access_token=${encodeURIComponent(r)}&${o}`),o}},Ad=class{sendEvent(t,n){return G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},yh=x.fetch,Aa=class{constructor(t){this.opts=t}sendEvent(t,n){return G(this,void 0,void 0,function*(){let{baseUrl:r,visitorIdProvider:o,preprocessRequest:i}=this.opts,s=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",a={url:`${r}/analytics/${t}${s}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(n)},u=Object.assign(Object.assign({},a),i?yield i(a,"analyticsFetch"):{}),{url:c}=u,g=fn(u,["url"]),y;try{y=yield yh(c,g)}catch(E){console.error("An error has occurred when sending the event.",E);return}if(y.ok){let E=yield y.json();return E.visitorId&&o.setCurrentVisitorId(E.visitorId),E}else{try{y.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,y,n),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,n=`${t}/analytics/visit`;yield yh(n,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Se.click,Se.custom,Se.search,Se.view].indexOf(t)!==-1}getVisitorIdParam(){return G(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,n=yield t.getCurrentVisitorId();return n?`?visitor=${n}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},wd=class{constructor(t,n){dd()&&wh()?this.storage=new pd:dd()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new mo),this.client=new Aa(t),this.beaconClient=new bd(t),window.addEventListener("beforeunload",()=>{let r=n();for(let{eventType:o,payload:i}of r)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Cd=class{constructor(t,n){this.storage=n||new mo,this.client=new Aa(t)}getClientDependingOnEventType(t){return this.client}},wa=class{constructor(){this.storage=new mo,this.client=new Ad}getClientDependingOnEventType(t){return this.client}},JI="xx",eR=e=>e?.startsWith(JI)||!1,tR=`
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 TI(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var kI=["1",1,"yes",!0];function _I(){let e=[];return Xl()&&e.push(window.doNotTrack),dd()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>kI.indexOf(t)!==-1)}function la(e){return e===!0?!1:_I()}var lh="v15",dh={default:"https://analytics.cloud.coveo.com/rest/ua"};function OI(e=dh.default,t=lh,n=!1){if(e=e.replace(/\/$/,""),n)return`${e}/${t}`;let r=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${r?"":"/rest"}/${t}`}var PI="38824e1f-37f5-42d3-8372-a4b8fa9df946",Ht=class{get defaultOptions(){return{endpoint:dh.default,isCustomEndpoint:!1,token:"",version:lh,beforeSendHooks:[],afterSendHooks:[]}}get version(){return sh}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=[Ax,mx].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let n={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};la(this.options.disableBrowserPrivacySignals)?this.runtime=new ua:this.runtime=this.options.runtimeEnvironment||this.initRuntime(n),this.addEventTypeMapping(be.view,{newEventType:be.view,addClientIdParameter:!0}),this.addEventTypeMapping(be.click,{newEventType:be.click,addClientIdParameter:!0}),this.addEventTypeMapping(be.custom,{newEventType:be.custom,addClientIdParameter:!0}),this.addEventTypeMapping(be.search,{newEventType:be.search,addClientIdParameter:!0})}initRuntime(t){return Xl()&&no()?new ud(t,()=>{let n=[...this.bufferedRequests];return this.bufferedRequests=[],n}):(TI()&&console.warn(RI),new ld(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Xl()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||rr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),rr()}})}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,n){return U(this,void 0,void 0,function*(){if(oa(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!n)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ia(t,ia(n,PI)))}})}getParameters(t,...n){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...n)})}getPayload(t,...n){return U(this,void 0,void 0,function*(){let r=yield this.resolveParameters(t,...n);return yield this.resolvePayloadForParameters(t,r)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(rr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(la(this.options.disableBrowserPrivacySignals))return null;try{let n=new URL(t).searchParams.get(An.cvo_cid);if(n==null)return null;let r=An.fromString(n);return!r||!no()||!r.validate(document.referrer,this.acceptedLinkReferrers)?null:r.clientId}catch{}return null}resolveParameters(t,...n){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:r=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>r.length>0?this.parseVariableArgumentsPayload(r,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 s?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 w=yield y;return yield b(t,w)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(n))})}resolvePayloadForParameters(t,n){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:r=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>r?yI(v):v,v=>r?this.removeUnknownParameters(v):v,v=>r?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,x)=>U(this,void 0,void 0,function*(){let h=yield v;return yield x(h)}),Promise.resolve(n))})}makeEvent(t,...n){return U(this,void 0,void 0,function*(){let{newEventType:r=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...n),i=yield this.resolvePayloadForParameters(t,o);return{eventType:r,payload:i,log:s=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:r,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...n){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...n)).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:n,payload:r}=t;return this.runtime.getClientDependingOnEventType(n).sendEvent(n,r)}})}clear(){this.storage.removeItem("visitorId"),new ra().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(be.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:n}=t,r=ln(t,["searchQueryUid"]);return(yield this.makeSearchEvent(r)).log({searchQueryUid:n})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(be.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:n}=t,r=ln(t,["searchQueryUid"]);return(yield this.makeClickEvent(r)).log({searchQueryUid:n})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(be.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:n}=t,r=ln(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(r)).log({lastSearchQueryUid:n})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(be.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 n=yield(yield E(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=n.visitorId,n})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield E(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,n){this.eventTypeMapping[t]=n}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(n=>typeof n=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,n){let r={};for(let o=0,i=n.length;o<i;o++){let s=n[o];if(typeof s=="string")r[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},r),s)}return r}isKeyAllowedEmpty(t,n){return({[be.search]:["queryText"]}[t]||[]).indexOf(n)!==-1}removeEmptyPayloadValues(t,n){let r=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(n,o)||r(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(r=>{if(AI(r))return!0;console.log(r,"is not processed by coveoua")}).reduce((r,o)=>Object.assign(Object.assign({},r),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:n}=t,r=ln(t,["custom"]),o={};n&&na(n)&&(o=this.lowercaseKeys(n));let i=wI(r);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:n}=t,r=ln(t,["custom"]);if(n&&na(n)){let o=this.lowercaseKeys(n);return Object.assign(Object.assign({},r),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let n=Object.keys(t),r={};return n.forEach(o=>{r[o.toLowerCase()]=t[o]}),r}validateParams(t,n){let{anonymizeIp:r}=t,o=ln(t,["anonymizeIp"]);return r!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${r}`.toLowerCase())==-1&&(o.anonymizeIp=1),(n==be.view||n==be.click||n==be.search||n==be.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),n==be.view&&(o.location=this.limit(o.location,1024)),(n=="pageview"||n=="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:n}=t,r=ln(t,["userId"]);return II(this.options.token)&&!n?(r.userId="anonymous",r):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:n}=t,r=ln(t,["trackingId"]);return n?t:(r.hasOwnProperty("custom")&&na(r.custom)&&(r.custom.hasOwnProperty("context_website")||r.custom.hasOwnProperty("siteName"))&&(r.trackingId=r.custom.context_website||r.custom.siteName),r.hasOwnProperty("customData")&&na(r.customData)&&(r.customData.hasOwnProperty("context_website")||r.customData.hasOwnProperty("siteName"))&&(r.trackingId=r.customData.context_website||r.customData.siteName),r)}limit(t,n){return typeof t=="string"?Fx(t,n):t}get baseUrl(){return OI(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},dn;(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"})(dn||(dn={}));var B;(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"})(B||(B={}));var eh={[B.triggerNotify]:"queryPipelineTriggers",[B.triggerExecute]:"queryPipelineTriggers",[B.triggerQuery]:"queryPipelineTriggers",[B.triggerRedirect]:"queryPipelineTriggers",[B.queryErrorBack]:"errors",[B.queryErrorClear]:"errors",[B.queryErrorRetry]:"errors",[B.pagerNext]:"getMoreResults",[B.pagerPrevious]:"getMoreResults",[B.pagerNumber]:"getMoreResults",[B.pagerResize]:"getMoreResults",[B.pagerScrolling]:"getMoreResults",[B.facetSearch]:"facet",[B.facetShowLess]:"facet",[B.facetShowMore]:"facet",[B.recommendation]:"recommendation",[B.likeSmartSnippet]:"smartSnippet",[B.dislikeSmartSnippet]:"smartSnippet",[B.expandSmartSnippet]:"smartSnippet",[B.collapseSmartSnippet]:"smartSnippet",[B.openSmartSnippetFeedbackModal]:"smartSnippet",[B.closeSmartSnippetFeedbackModal]:"smartSnippet",[B.sendSmartSnippetReason]:"smartSnippet",[B.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[B.clearRecentQueries]:"recentQueries",[B.recentResultClick]:"recentlyClickedDocuments",[B.clearRecentResults]:"recentlyClickedDocuments",[B.showLessFoldedResults]:"folding",[B.caseDetach]:"case",[B.likeGeneratedAnswer]:"generatedAnswer",[B.dislikeGeneratedAnswer]:"generatedAnswer",[B.openGeneratedAnswerSource]:"generatedAnswer",[B.generatedAnswerOpenInlineLink]:"generatedAnswer",[B.generatedAnswerFollowupOpenSource]:"generatedAnswer",[B.generatedAnswerStreamEnd]:"generatedAnswer",[B.generatedAnswerSourceHover]:"generatedAnswer",[B.generatedAnswerCopyToClipboard]:"generatedAnswer",[B.generatedAnswerHideAnswers]:"generatedAnswer",[B.generatedAnswerShowAnswers]:"generatedAnswer",[B.generatedAnswerExpand]:"generatedAnswer",[B.generatedAnswerCollapse]:"generatedAnswer",[B.generatedAnswerFeedbackSubmit]:"generatedAnswer",[B.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[dn.expandToFullUI]:"interface",[dn.openUserActions]:"User Actions",[dn.showPrecedingSessions]:"User Actions",[dn.showFollowingSessions]:"User Actions",[dn.clickViewedDocument]:"User Actions",[dn.clickPageView]:"User Actions",[dn.createArticle]:"createArticle"},so=class{constructor(){this.runtime=new ua,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(be.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(be.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(be.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(be.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return sh}};function NI(e){let t="";return e.filter(n=>{let r=n!==t;return t=n,r})}function FI(e){return e.map(t=>t.replace(/;/g,""))}function ph(e){let n=e.join(";");return n.length<=256?n:ph(e.slice(1))}var th=e=>{let t=FI(e),n=NI(t);return ph(n)};function nh(e){let t=typeof e.partialQueries=="string"?e.partialQueries:th(e.partialQueries),n=typeof e.suggestions=="string"?e.suggestions:th(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:n})}var da=class{constructor(t,n){this.opts=t,this.provider=n;let r=t.enableAnalytics===!1||la(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=r?new so:new Ht(t)}disable(){this.coveoAnalyticsClient=new so}enable(){this.coveoAnalyticsClient=new Ht(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(B.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(B.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(B.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,n){return this.makeClickEvent(B.recommendationOpen,t,n)}logRecommendationOpen(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.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(B.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(B.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(B.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(B.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(B.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(B.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(B.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(B.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,n){return this.makeClickEvent(B.documentQuickview,t,n)}logDocumentQuickview(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,n){return this.makeClickEvent(B.documentOpen,t,n)}logDocumentOpen(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(B.omniboxAnalytics,nh(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(B.omniboxFromLink,nh(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(B.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.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(B.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(B.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(B.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(B.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(B.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(B.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(B.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,n){return this.makeCustomEvent(B.sendSmartSnippetReason,{reason:t,details:n})}logSmartSnippetFeedbackReason(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(B.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(B.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(B.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(B.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,n){return this.makeClickEvent(B.openSmartSnippetSource,t,n)}logOpenSmartSnippetSource(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,n){return this.makeClickEvent(B.openSmartSnippetSuggestionSource,t,{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}makeCopyToClipboard(t,n){return this.makeClickEvent(B.copyToClipboard,t,n)}logCopyToClipboard(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,n)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,n){return this.makeClickEvent(B.openSmartSnippetInlineLink,t,{contentIDKey:n.contentIDKey,contentIDValue:n.contentIDValue},n)}logOpenSmartSnippetInlineLink(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,n){return this.makeClickEvent(B.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}logOpenSmartSnippetSuggestionInlineLink(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(B.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(B.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,n){return this.makeCustomEvent(B.recentResultClick,{info:t,identifier:n})}logRecentResultClick(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(B.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(B.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,n){return this.makeClickEvent(B.showMoreFoldedResults,t,n)}logShowMoreFoldedResults(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(B.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,n){var r;return{actionCause:n,customData:(r=t.payload)===null||r===void 0?void 0:r.customData}}makeCustomEvent(t,n){return U(this,arguments,void 0,function*(r,o,i=eh[r]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:r}),u=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(u,r),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,n){return U(this,arguments,void 0,function*(r,o,i=eh[r]){return(yield this.makeCustomEvent(r,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,n,r){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:n,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,n,r){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,n,r)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,n){return U(this,void 0,void 0,function*(){let r=yield this.getBaseSearchEventRequest(t,n),o=yield this.coveoAnalyticsClient.makeSearchEvent(r);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,n,r,o){return U(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},n),yield this.getBaseEventRequest(Object.assign(Object.assign({},r),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,n,r,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,n,r,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,n){return U(this,void 0,void 0,function*(){var r,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},n),(o=(r=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(r)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:n,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,n;return{originContext:(n=(t=this.provider).getOriginContext)===null||n===void 0?void 0:n.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Ht?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",n=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),n&&{splitTestRunVersion:n})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(B.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(B.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(B.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(B.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,n){return this.makeClickEvent(B.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}logGeneratedAnswerCitationClick(t,n){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.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(B.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(B.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},pa=Object.assign({},Si),rh=Object.keys(pa).map(e=>pa[e]),oo=class extends td{constructor({client:t,uuidGenerator:n=rr}){super({client:t,uuidGenerator:n}),this.ticket={}}getApi(t){let n=super.getApi(t);return n!==null?n: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,...[n])=>rh.indexOf(t)!==-1?this.addSVCDataToPayload(t,n):n),this.client.registerAfterSendEventHook((t,...[n])=>(rh.indexOf(t)!==-1&&this.updateLocationInformation(t,n),n))}addHooksForPageView(){this.client.addEventTypeMapping(pa.pageview,{newEventType:be.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(pa.event,{newEventType:be.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,n){var r;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,n)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((r=this.actionData)!==null&&r!==void 0?r:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),n)}getTicketPayload(){return Ux(this.ticket)}};oo.Id="svc";var fa;(function(e){e.click="click",e.flowStart="flowStart"})(fa||(fa={}));var It;(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"})(It||(It={}));var ma;(function(e){e.quit="Quit",e.solved="Solved"})(ma||(ma={}));var ga=class{constructor(t,n){var r;this.options=t,this.provider=n;let o=((r=t.enableAnalytics)!==null&&r!==void 0?r:!0)&&!la(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Ht(t):new so,this.svc=new oo({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new so,this.svc=new oo({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Ht(this.options),this.svc=new oo({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(It.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(It.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(It.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(It.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(It.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(It.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(It.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(It.caseCancelled,{reason:ma.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(It.caseSolved,{reason:ma.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(It.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",fa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",fa.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var n,r;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(n=this.provider)===null||n===void 0?void 0:n.getLanguage(),anonymous:(r=this.provider)===null||r===void 0?void 0:r.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Ht?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,n,r,o,i;return{originContext:(n=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||n===void 0?void 0:n.call(t),originLevel1:(r=this.provider)===null||r===void 0?void 0:r.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,n,r,o){return U(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},n),yield this.getBaseEventRequest(Object.assign(Object.assign({},r),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();f();p();var DI=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},or=class{constructor(t){se(this,"getState",t);se(this,"state");this.state=t()}getLanguage(){return DI(this.state)}getBaseMetadata(){let{context:t,configuration:n}=this.state,r=t?.contextValues||{},o={};for(let[i,s]of Object.entries(r)){let a=`context_${i}`;o[a]=s}return n.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Yr),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Zr()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();f();p();var ao=e=>new Ht(e).getCurrentVisitorId(),Ai=(e,t)=>typeof t=="function"?(...n)=>{let r=Wo(n[0]);try{return t.apply(t,n)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),r}}:void 0,wi=(e,t)=>(...n)=>{let r=Wo(n[1]);try{return t.apply(t,n)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),r}};var Ci=class extends or{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},fh=({logger:e,getState:t,analyticsClientMiddleware:n=(s,a)=>a,preprocessRequest:r,provider:o=new Ci(t),disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,u=s.configuration.analytics.apiBaseUrl??it(s.configuration.organizationId,s.configuration.environment,"analytics"),c=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new ga({enableAnalytics:g,token:a,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ai(e,r),beforeSendHooks:[wi(e,n),(x,h)=>(e.info({...h,type:x,endpoint:u,token:a},"Analytics request"),h)]},o);return g||v.disable(),v};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function ha(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function mh(e){let{activeValue:t,ancestryMap:n}=jI(e);return t?UI(t,n):[]}function jI(e){let t=[...e],n=new Map;for(;t.length>0;){let r=t.shift();if(r.state==="selected")return{activeValue:r,ancestryMap:n};if(n)for(let o of r.children)n.set(o,r);t.unshift(...r.children)}return{}}function UI(e,t){let n=[];if(!e)return[];let r=e;do n.unshift(r),r=t.get(r);while(r);return n}var qI=(e,t)=>e.categoryFacetSet[t]?.request;var pd=(e,t)=>{let n=qI(e,t);return mh(n?.currentValues??[])};m();d();f();p();function ya(){return{}}m();d();f();p();function va(){return{}}m();d();f();p();function Sa(){return{}}m();d();f();p();function ba(){return{}}function fd(e){return{facetSet:e.facetSet??ba(),categoryFacetSet:e.categoryFacetSet??ya(),dateFacetSet:e.dateFacetSet??va(),numericFacetSet:e.numericFacetSet??Sa(),automaticFacetSet:e.automaticFacetSet??ha()}}var md=e=>{let t=[];return BI(e).forEach((n,r)=>{let o=XI(e,n.facetId),i=KI(n,r+1);if(GI(n)){if(!!!pd(e,n.facetId).length)return;t.push({...i,...zI(e,n.facetId),facetType:o,state:"selected"});return}n.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let u=gh(s,a+1,o),c=VI(n)?hh(s):HI(s);t.push({...i,...u,...c})})}),$I(e).forEach((n,r)=>{let o=WI(n,r+1);n.values.forEach((i,s)=>{if(i.state==="idle")return;let a=gh(i,s+1,"specific"),u=hh(i);t.push({...o,...a,...u})})}),t},VI=e=>e.type==="specific",GI=e=>e.type==="hierarchical",BI=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),$I=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),gh=(e,t,n)=>({state:e.state,valuePosition:t,facetType:n}),HI=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),hh=e=>({displayValue:e.value,value:e.value}),QI=(e,t)=>pd(e,t).map(r=>r.value).join(";"),zI=(e,t)=>{let r=QI(e,t);return{value:r,valuePosition:1,displayValue:r}},WI=(e,t)=>({title:yh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),KI=(e,t)=>({title:yh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),yh=(e,t)=>`${e}_${t}`,YI=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,XI=(e,t)=>{let n=YI(e,t);return n?n.type:"specific"};m();d();f();p();m();d();f();p();var gd=e=>e.configuration.search.locale,vh=e=>e.configuration.search.timezone,Sh=e=>e.configuration.accessToken,bh=e=>e.configuration.organizationId,Ah=e=>e.configuration.environment,Aa=e=>e.configuration?.knowledge?.agentId,wh=e=>e.configuration.knowledge.debugAgentSession;var Fe=e=>{if(ZI(e)||hd(e))return e.generatedAnswer?.answerId;if(JI(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},ZI=e=>"answer"in e&&"generatedAnswer"in e&&!ae(e.generatedAnswer?.answerConfigurationId),hd=e=>{let t=Aa(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},JI=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",yd=e=>e.generatedAnswer?.fieldsToIncludeInCitations,wn=e=>e.followUpAnswers?.conversationId,eR=e=>e.generatedAnswer?.citations,tR=e=>e.followUpAnswers?.followUpAnswers,nR=Be(tR,e=>e?.flatMap(t=>t.citations)),rR=(e,t)=>t,co=Be(eR,nR,rR,(e,t,n)=>e?.find(r=>r.id===n)??t?.find(r=>r.id===n));m();d();f();p();var jt=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();function vd(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Qt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:vd(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:vd(),extendedResults:{},searchAction:void 0}}m();d();f();p();m();d();f();p();m();d();f();p();var Ch=(n=>(n.Ascending="ascending",n.Descending="descending",n))(Ch||{}),Eh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Eh||{}),Sd=e=>{if(Qf(e))return e.map(t=>Sd(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""}},xh=()=>({by:"relevancy"});var s2=new Re({values:{by:new el({enum:Eh,required:!0}),order:new el({enum:Ch}),field:new te}});function wa(){return Sd(xh())}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function oR(){return typeof navigator<"u"}function Ih(){try{return typeof localStorage<"u"}catch{return!1}}function Rh(){try{return typeof sessionStorage<"u"}catch{return!1}}function Th(){return oR()&&navigator.cookieEnabled}m();d();f();p();var ir=class e{static set(t,n,r){let o;r&&(o=new Date,o.setTime(o.getTime()+r)),bd(t,n,o,iR(window.location.hostname))}static get(t){for(var n=t+"=",r=document.cookie.split(";"),o=0;o<r.length;o++){var i=r[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function iR(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let n=2;n<=t.length;n++){let r=t.slice(-n).join(".");if(sR(r))return r}}function sR(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return bd(t,"1",void 0,e),ir.get(t)==="1"}catch{return!1}finally{try{bd(t,"",new Date(0),e)}catch{}}}function bd(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function kh(){return Ih()?localStorage:Th()?new Ca:Rh()?sessionStorage:new Ad}var Ca=class e{getItem(t){return ir.get(`${e.prefix}${t}`)}removeItem(t){ir.erase(`${e.prefix}${t}`)}setItem(t,n,r){ir.set(`${e.prefix}${t}`,n,r)}};Ca.prefix="coveo_";var Ad=class{getItem(t){return null}removeItem(t){}setItem(t,n){}};var Ea="__coveo.analytics.history",aR=20,cR=1e3*60,uR=75,xa=class{constructor(t){this.store=t||kh()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let n=this.getHistoryWithInternalTime();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let n=yield _this4.getHistoryWithInternalTimeAsync();n!=null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(n)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ea);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(Ea);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ea,JSON.stringify(t.slice(0,aR)))}catch{}}clear(){try{this.store.removeItem(Ea)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((r,o)=>(o.internalTime||0)-(r.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,uR)),t}isValidEntry(t){let n=this.getMostRecentElement();return n&&n.value==t.value?(t.internalTime||0)-(n.internalTime||0)>cR:!0}stripInternalTime(t){return Array.isArray(t)?t.map(n=>{let{name:r,time:o,value:i}=n;return{name:r,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:n,time:r,value:o}=t;return n&&typeof o=="string"&&n.toLowerCase()==="query"&&o.trim()===""?{name:n,time:r}:t}stripEmptyQueries(t){return t.map(n=>this.stripEmptyQuery(n))}};var sr=class sr extends xa{static getInstance(t){return sr.instance||(sr.instance=new sr(t)),sr.instance}constructor(t){super(t)}};se(sr,"instance",null);var vt=sr;var Ei=class Ei extends or{constructor(){super(...arguments);se(this,"getFacetRequest",n=>this.state.facetSet?.[n]?.request||this.state.categoryFacetSet?.[n]?.request||this.state.dateFacetSet?.[n]?.request||this.state.numericFacetSet?.[n]?.request||this.state.automaticFacetSet?.set[n]?.response)}getFacetState(){return md(fd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Ei.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let n=this.getState();return n.search?.searchResponseId||n.search?.response.searchUid||Qt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let n=!!this.getSplitTestRunName(),r=this.state.search?.response.pipeline||this.state.pipeline||Ei.fallbackPipelineName;return n?r:void 0}getBaseMetadata(){let n=this.getState(),r=super.getBaseMetadata(),o=Fe(n);return o&&(r.generativeQuestionAnsweringId=o),r}getFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,facetValue:r,facetTitle:`${i}_${n}`}}getFacetClearAllMetadata(n){let o=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:o,facetTitle:`${o}_${n}`}}getFacetUpdateSortMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,criteria:r,facetTitle:`${i}_${n}`}}getRangeBreadcrumbFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,facetRangeEnd:r.end,facetRangeEndInclusive:r.endInclusive,facetRangeStart:r.start,facetTitle:`${i}_${n}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??wa()}}getStaticFilterToggleMetadata(n,r){return{...this.getBaseMetadata(),staticFilterId:n,staticFilterValue:r}}getStaticFilterClearAllMetadata(n){return{...this.getBaseMetadata(),staticFilterId:n}}getUndoTriggerQueryMetadata(n){return{...this.getBaseMetadata(),undoneQuery:n}}getCategoryBreadcrumbFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:n,categoryFacetField:i,categoryFacetPath:r,categoryFacetTitle:`${i}_${n}`}}getOmniboxAnalyticsMetadata(n,r){let o=this.state.querySuggest?.[n],i=o.completions.map(c=>c.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(r),partialQuery:a,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(n){return{...this.getBaseMetadata(),...n}}getGeneratedAnswerMetadata(){let n=this.getState(),r={};return n.generatedAnswer?.isVisible!==void 0&&(r.showGeneratedAnswer=n.generatedAnswer.isVisible),r}get resultURIs(){return this.results?.map(n=>({documentUri:n.uri,documentUriHash:n.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||jt().q}get responseTime(){return this.state.search?.duration||Qt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Qt().response.totalCountFiltered}};se(Ei,"fallbackPipelineName","default");var Cn=Ei,_h=({logger:e,getState:t,analyticsClientMiddleware:n=(s,a)=>a,preprocessRequest:r,provider:o,disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,u=s.configuration.analytics.apiBaseUrl??it(s.configuration.organizationId,s.configuration.environment,"analytics"),c=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,v=new da({token:a,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ai(e,r),beforeSendHooks:[wi(e,n),(x,h)=>(e.info({...h,type:x,endpoint:u,token:a},"Analytics request"),h)]},o);return g||v.disable(),v},wd=()=>{let t=vt.getInstance().getHistory().reverse().find(n=>n.name==="PageView"&&n.value);return t?t.value:""};m();d();f();p();function Oh(e){let t=Ph(e),n=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return Mf([e,...t,...n],o=>o.uniqueId)}function Ph(e){return e.childResults?e.childResults.flatMap(t=>[t,...Ph(t)]):[]}m();d();f();p();var uo=()=>"";function Fh(e,t){return{...new Cn(t).getBaseMetadata(),actionCause:e,type:e}}function lR(e){return Object.assign(e,{instantlyCallable:!0})}function dR(e,t){let n=i=>{let s=Ie(e,i);return lR(Object.assign(s,{type:s.typePrefix}))},r=n(/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}=a;return yield(yield t({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref8.apply(this,arguments)}}());return Object.assign(r,{prepare:function(){var _prepare=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:v}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:n(/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(x,{getState:h,extra:y}){return yield v({state:h(),extra:y})});return function(_x45,_x46){return _ref9.apply(this,arguments)}}())}});function prepare(_x44){return _prepare.apply(this,arguments)}return prepare}()}),r}var Dh=(e,t,n)=>{function r(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:n}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:n};return mR(i)}return r},pR=e=>e.configuration.analytics.analyticsMode==="legacy",fR=e=>e.configuration.analytics.analyticsMode==="next",mR=({prefix:e,__legacy__getBuilder:t,__legacy__provider:n,analyticsPayloadBuilder:r,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(n??(n=a=>new s(a)),dR(e,/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:v}){let x=[],h={log:function(){var _log=_asyncToGenerator(function*({state:N}){for(let k of x)yield k(N)});function log(_x48){return _log.apply(this,arguments)}return log}()},y=a(),b=i({getState:a,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:v,provider:n(a)}),w=yield t(b,a());h.description=w?.description,x.push(/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(N){pR(N)&&(yield gR(w,n,N,g,b.coveoAnalyticsClient))});return function(_x49){return _ref1.apply(this,arguments)}}());let{emit:R}=fi(y);return x.push(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(N){if(fR(N)&&o&&r){let k=r(N);yield CR(R,o,k)}});return function(_x50){return _ref10.apply(this,arguments)}}()),h});return function(_x47){return _ref0.apply(this,arguments)}}()));function gR(_x51,_x52,_x53,_x54,_x55){return _gR.apply(this,arguments)}function _gR(){_gR=_asyncToGenerator(function*(e,t,n,r,o){t(()=>n);let i=yield e?.log({searchUID:t(()=>n).getSearchUID()});r.info({client:o,response:i},"Analytics response")});return _gR.apply(this,arguments)}var hR=e=>n=>(r,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _log2=_asyncToGenerator(function*(i){n(r,o)});function log(_x56){return _log2.apply(this,arguments)}return log}()}),Oe=Dh(e=>_h({...e,provider:e.provider||new Cn(e.getState)}),e=>e,Cn),St=Dh(fh,hR("caseAssist"),Ci);var Cd=(e,t)=>{let n=i=>i+(t.pagination?.firstResult??0),r=-1,o=t.search?.results;return r=Gh(e,o),r<0&&(r=wR(e,o)),r<0&&(r=0),yR(e,n(r),t)};var Mh=(e,t)=>({sourceName:jh(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||uo()}),Lh=(e,t)=>({sourceName:jh(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||uo()});function jh(e){let t=e.source;return ae(t)?"unknown":t}var Uh=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function yR(e,t,n){let r=e.raw.collection;return{collectionName:typeof r=="string"?r:"default",documentAuthor:bR(e),...(Nh(e)?{documentCategory:Nh(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:AR(e),queryPipeline:n.pipeline||uo()}}function Nh(e){return e.raw?.objecttype||void 0}var Ed=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||""}),qh={urihash:new te,sourcetype:new te,permanentid:new te},Vh={uniqueId:J,raw:new Re({values:qh}),title:J,uri:J,clickUri:J,rankingModifier:new te({required:!1,emptyAllowed:!0})};function vR(e){return Object.assign({},...Object.keys(qh).map(t=>({[t]:e[t]})))}function SR(e){return Object.assign({},...Object.keys(Vh).map(t=>({[t]:e[t]})),{raw:vR(e.raw)})}function bR(e){let t=e.raw.author;return ae(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function AR(e){let t=e.raw.source;return ae(t)?"unknown":t}var xd=e=>new Dt(Vh).validate(SR(e));function wR(e,t){for(let[n,r]of t.entries()){let o=Oh(r);if(Gh(e,o)!==-1)return n}return-1}function Gh(e,t=[]){return t.findIndex(({uniqueId:n})=>n===e.uniqueId)}function CR(_x57,_x58,_x59){return _CR.apply(this,arguments)}function _CR(){_CR=_asyncToGenerator(function*(e,t,n){yield e(t,n)});return _CR.apply(this,arguments)}m();d();f();p();var Ia=e=>{if(e==="yes")return!0;if(e==="no")return!1},ER=()=>Oe("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function xR(e,t){return Oe({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(n,r)=>{let o=t??Fe(r),i=co(r,e);if(!o||!i)return null;let s=wn(r);return n.makeGeneratedAnswerCitationClick(Mh(i,r),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:Uh(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:n=>{let r=co(n,e);return{answerId:t??Fe(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}})}function IR(e,t,n){return Oe({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,o)=>{let i=n??Fe(o),s=co(o,e);if(!i||!s)return null;let a=wn(o);return r.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:s.permanentid,citationId:s.id,citationHoverTimeMs:t,...(a&&{conversationId:a})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let o=co(r,e);return{answerId:n??Fe(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function RR(e,t){return Oe({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:n=>n.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function TR(e){return Oe({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,n)=>{let r=e??Fe(n);if(!r)return null;let o=wn(n);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Fe(t)??"",action:"like"})})}function kR(e){return Oe({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,n)=>{let r=e??Fe(n);if(!r)return null;let o=wn(n);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Fe(t)??"",action:"dislike"})})}var _R=e=>Oe({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,n)=>{let r=Fe(n);return r?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:r,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let n=Fe(t),{helpful:r,readable:o,documented:i,hallucinationFree:s,correctTopic:a,documentUrl:u,details:c}=e;return{answerId:n??"",helpful:r,details:{readable:Ia(o),documented:Ia(i),correctTopic:Ia(a),hallucinationFree:Ia(s)},additionalNotes:c,correctAnswerUrl:u}}}),Id=(e,t,n)=>Oe({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(r,o)=>{let i=t??Fe(o);if(!i)return null;let s=wn(o);return r.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:n,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:r=>({answerId:t??Fe(r)??"",answerGenerated:e??!1})}),lo=e=>Oe({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Fe(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),OR=()=>Oe({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let n=Fe(t);return n?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Fe(e)??"",action:"show"})}),PR=()=>Oe({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let n=Fe(t);return n?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Fe(e)??"",action:"hide"})}),NR=()=>Oe({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let n=Fe(t);return n?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Fe(e)??"",action:"expand"})}),FR=()=>Oe({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let n=Fe(t);return n?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Fe(e)??"",action:"collapse"})});function DR(e){return Oe({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,n)=>{let r=e??Fe(n);if(!r)return null;let o=wn(n);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Fe(t)??"",action:"copyToClipboard"})})}function MR(e,t){return Oe({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(n,r)=>{let o=co(r,e);if(!o)return null;let i=wn(r);return i?n.makeGeneratedAnswerFollowupOpenSource({...Lh(o,r),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var Ra={logCopyGeneratedAnswer:DR,logGeneratedAnswerHideAnswers:PR,logGeneratedAnswerShowAnswers:OR,logGeneratedAnswerStreamEnd:Id,logGeneratedAnswerFeedback:_R,logDislikeGeneratedAnswer:kR,logLikeGeneratedAnswer:TR,logGeneratedAnswerOpenInlineLink:RR,logHoverCitation:IR,logOpenGeneratedAnswerSource:xR,logOpenGeneratedAnswerFollowUpSource:MR,logRetryGeneratedAnswer:ER,logGeneratedAnswerExpand:NR,logGeneratedAnswerCollapse:FR};m();d();f();p();m();d();f();p();var Bh=Be(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:n,dq:r,lq:o}=e;return{...(t&&{aq:t}),...(n&&{cq:n}),...(r&&{dq:r}),...(o&&{lq:o})}});m();d();f();p();var ar=(e,t,n)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(n&&{actionCause:n.actionCause}),...(n&&{customData:n.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:Jr(e)}});m();d();f();p();var Rd=e=>e.context;m();d();f();p();var Td=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ii=Ft(Ta(),1),Kh=Ft($h(),1);m();d();f();p();var Qh=Ft(Ta(),1),zh=Ft(Hh(),1);Qh.default.extend(zh.default);var LR="YYYY/MM/DD@HH:mm:ss";function Wh(e){return e.format(LR)}Ii.default.extend(Kh.default);var jR=["past","now","next"],UR=["minute","hour","day","week","month","quarter","year"];function qR(e){let{period:t,amount:n,unit:r}=e;switch(t){case"past":return(0,Ii.default)().subtract(n,r);case"next":return(0,Ii.default)().add(n,r);case"now":return(0,Ii.default)()}}function Dd(e){return Wh(qR(VR(e)))}function Yh(e){return e.toLocaleLowerCase().split("-")}function Md(e){let[t,n,r]=Yh(e);if(t==="now")return!0;if(!jR.includes(t)||!UR.includes(r))return!1;let o=parseInt(n,10);return!(Number.isNaN(o)||o<=0)}function VR(e){let[t,n,r]=Yh(e);return t==="now"?{period:"now"}:{period:t,amount:n?parseInt(n,10):void 0,unit:r||void 0}}m();d();f();p();function Xh(e){return e.type==="dateRange"}function Zh(e){return`start${e}`}function Jh(e){return`end${e}`}var Ld=()=>({dateFacetValueMap:{}});function GR(e,t,n){let r=e.start,o=e.end;return Md(r)&&(r=Dd(r),n.dateFacetValueMap[t][Zh(r)]=e.start),Md(o)&&(o=Dd(o),n.dateFacetValueMap[t][Jh(o)]=e.end),{...e,start:r,end:o}}function jd(e,t){if(Xh(e)){let{facetId:n,currentValues:r}=e;return t.dateFacetValueMap[n]={},{...e,currentValues:r.map(o=>GR(o,n,t))}}return e}function En(e){let t=Ld();return{request:{...e,facets:e.facets?.map(r=>jd(r,t))},mappings:t}}function BR(e,t,n){return{...e,start:n.dateFacetValueMap[t][Zh(e.start)]||e.start,end:n.dateFacetValueMap[t][Jh(e.end)]||e.end}}function $R(e,t){return e.facetId in t.dateFacetValueMap}function HR(e,t){return $R(e,t)?{...e,values:e.values.map(n=>BR(n,e.facetId,t))}:e}function ka(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(r=>HR(r,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function xn(e){return Object.values(e).map(t=>t.request)}function Ud(e,t){let n={};e.forEach(i=>{n[i.facetId]=i});let r=[];t.forEach(i=>{i in n&&(r.push(n[i]),delete n[i])});let o=Object.values(n);return[...r,...o]}function ey(e){return xn(e).map(t=>{let r=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!r?{...t,currentValues:[]}:t})}var qd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function QR(e){return xn(e).map(t=>{let n=qd[t.sortCriteria];return n?{...t,sortCriteria:n}:t})}function zR(e){return[...QR(e.facetSet??{}),...ey(e.numericFacetSet??{}),...ey(e.dateFacetSet??{}),...xn(e.categoryFacetSet??{})]}function WR(e){return zR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function _a(e){return Ud(WR(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();m();d();f();p();var ty=/*#__PURE__*/function(){var _ty=_asyncToGenerator(function*(e,t){let n=e.analyticsMode==="next";return{analytics:{clientId:yield ao(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!n&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(wd()&&{pageId:wd()}),...(n&&e.trackingId&&{trackingId:e.trackingId}),capture:n,...(n&&{source:Jr(e)})}}});function ty(_x60,_x61){return _ty.apply(this,arguments)}return ty}();var po=/*#__PURE__*/function(){var _po=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??qr(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 ty(e.configuration.analytics,t))),...(e.excerptLength&&!ae(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});function po(_x62,_x63){return _po.apply(this,arguments)}return po}();m();d();f();p();var Oa=(e,t,n)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??qr(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&&ar(e.configuration.analytics,t,n)),...(e.excerptLength&&!ae(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var ny=Be(e=>e.staticFilterSet,e=>Object.values(e||{}).map(n=>{let r=n.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=r.map(i=>i.expression).join(" OR ");return r.length>1?`(${o})`:o}));var In=/*#__PURE__*/function(){var _In=_asyncToGenerator(function*(e,t,n){let r=Gd(e),o=KR(e),i=YR(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield po(e,n):Oa(e,t,n);return En({...s,...(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}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Vd(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 In(_x64,_x65,_x66){return _In.apply(this,arguments)}return In}();function Vd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function KR(e){return Ud(ZR(e),e.facetOrder??[])}function YR(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(n=>n.response).map(XR).filter(n=>n.currentValues.length>0):void 0}function XR(e){let{field:t,label:n,values:r}=e,o=r.filter(i=>i.state==="selected");return{field:t,label:n,currentValues:o}}function ZR(e){return JR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function JR(e){return[...eT(e.facetSet??{}),...ry(e.numericFacetSet??{}),...ry(e.dateFacetSet??{}),...xn(e.categoryFacetSet??{})]}function eT(e){return xn(e).map(t=>{let n=qd[t.sortCriteria];return n?{...t,sortCriteria:n}:t})}function ry(e){return xn(e).map(t=>{let n=t.currentValues,r=n.some(({state:i})=>i!=="idle"),o=n.some(i=>i.previousState);return t.generateAutomaticRanges&&!r&&!o?{...t,currentValues:[]}:t})}function Gd(e){let t=e.advancedSearchQueries?.cq.trim()||"",r=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=ny(e);return[t,r,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var Ti=(e,t)=>{let n=e;return ae(n[t])?ae(e.raw[t])?null:e.raw[t]:n[t]},tT=e=>t=>e.every(n=>!ae(Ti(t,n))),nT=e=>t=>e.every(n=>ae(Ti(t,n))),rT=(e,t)=>n=>{let r=oy(e,n);return t.some(o=>r.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},oT=(e,t)=>n=>{let r=oy(e,n);return t.every(o=>r.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},oy=(e,t)=>{let n=Ti(t,e);return Df(n)?n:[n]},iy={getResultProperty:Ti,fieldsMustBeDefined:tT,fieldsMustNotBeDefined:nT,fieldMustMatch:rT,fieldMustNotMatch:oT};var Bd=Be(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var $d=e=>e.searchHub;m();d();f();p();var Pa=Be(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),I$=Be(e=>e,e=>{let t=Pa(e);return t&&e?e[t].expression:""});m();d();f();p();var sy=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var ay=e=>e.excerptLength?.length;m();d();f();p();var cy=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var uy=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 ly=e=>e.sortCriteria;var dy=/*#__PURE__*/function(){var _dy=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Ur(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});function dy(_x67){return _dy.apply(this,arguments)}return dy}(),py=(e,t)=>{let n=nr(e)?.q,{aq:r,cq:o,dq:i,lq:s}=gy(e),a=Rd(e),u=ar(e.configuration.analytics,t,{actionCause:Bd(e)}),c=$d(e),g=Td(e),v=yd(e)??[],x=my(e),h=Pa(e.tabSet)||"default",y=gd(e),b=vh(e),w=t.referrer||"",R=cy(e),N=ly(e),k=iT(e),P=ay(e),A=uy(e),O=sy(e);return{q:n,...(r&&{aq:r}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:Qg(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(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:Vd(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...k,...(A??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:N,...(R&&{facetOptions:R}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},fy=(e,t)=>{let n=nr(e)?.q,r=my(e),o=ar(e.configuration.analytics,t,{actionCause:Bd(e)}),i=gd(e),s=Pa(e.tabSet)||"default",a=t.referrer,{aq:u,cq:c}=gy(e),g=$d(e),v=Td(e),x=Rd(e),h=yd(e)??[];return{q:n||"",...(r.length&&{facets:r}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(v?.length&&{pipeline:v}),...(x?.contextValues&&{context:x.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:s,referrer:a,...o,locale:i}},my=e=>_a(e)?.map(t=>jd(t,Ld())).sort((t,n)=>t.facetId>n.facetId?1:n.facetId>t.facetId?-1:0),iT=e=>({actionsHistory:e.configuration.analytics.enabled?vt.getInstance().getHistory():[]}),gy=e=>{let t=Bh(e),n=Gd(e);return{...t,...(n&&{cq:n})}};m();d();f();p();var Na=["searching","thinking","answering"];function Fa(e){return e.toLowerCase()}var Da=["search","generic"];m();d();f();p();var hy=["text/plain","text/markdown"];var fo=new te({required:!0}),yy=new te,mo=new Ue({required:!0}),Hd={id:fo,title:fo,uri:fo,permanentid:fo,clickUri:yy},Ma=new te({required:!0,constrainTo:hy}),vy=new te({required:!0,constrainTo:Na}),Sy=e=>({...e,name:Fa(e.name)}),QH=V("generatedAnswer/setIsVisible",e=>W(e,mo)),La=V("generatedAnswer/setAnswerId",e=>W(e,J)),zH=V("generatedAnswer/setAnswerGenerationMode",e=>W(e,new te({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),WH=V("generatedAnswer/setIsEnabled",e=>W(e,mo)),_i=V("generatedAnswer/updateMessage",e=>W(e,{textDelta:fo})),Oi=V("generatedAnswer/updateCitations",e=>W(e,{citations:new Mt({required:!0,each:new Re({values:Hd})})})),Pi=V("generatedAnswer/updateError",e=>W(e,{message:yy,code:new Le({min:0})})),ja=V("generatedAnswer/resetAnswer"),KH=V("generatedAnswer/like"),YH=V("generatedAnswer/dislike"),XH=V("generatedAnswer/feedbackModal/open"),ZH=V("generatedAnswer/expand"),JH=V("generatedAnswer/collapse"),eQ=V("generatedAnswer/setId",e=>W(e,{id:new te({required:!0})})),tQ=V("generatedAnswer/feedbackModal/close"),nQ=V("generatedAnswer/sendFeedback"),Rn=V("generatedAnswer/setIsLoading",e=>W(e,mo)),ki=V("generatedAnswer/setIsStreaming",e=>W(e,mo)),Ni=V("generatedAnswer/setAnswerContentFormat",e=>W(e,Ma)),rQ=V("generatedAnswer/updateResponseFormat",e=>W(e,{contentFormat:new Mt({each:Ma,default:["text/plain"]})})),oQ=V("knowledge/updateAnswerConfigurationId",e=>W(e,fo)),iQ=V("generatedAnswer/registerFieldsToIncludeInCitations",e=>W(e,Gm)),Qd=V("generatedAnswer/setIsAnswerGenerated",e=>W(e,mo)),Fi=V("generatedAnswer/setCannotAnswer",e=>W(e,mo)),sT=V("generatedAnswer/setAnswerApiQueryParams",e=>W(e,new Re({}))),by=V("generatedAnswer/startStep",e=>W(Sy(e),{name:vy,startedAt:new Le({min:0,required:!0})})),Ay=V("generatedAnswer/finishStep",e=>W(Sy(e),{name:vy,finishedAt:new Le({min:0,required:!0})})),wy=V("generatedAnswer/startToolCall",e=>W(e,{toolCallName:J,startedAt:new Le({min:0,required:!0}),toolCallId:J})),Cy=V("generatedAnswer/finishToolCall",e=>W(e,{finishedAt:new Le({min:0,required:!0}),toolCallId:J})),Ua=V("generatedAnswer/toolCallArgs",e=>W(e,{toolCallId:J,args:new Re({options:{required:!0}}),type:new te({required:!0,constrainTo:Da})})),sQ=Ie("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(e,t){let n=t.getState(),{dispatch:r,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:s}=o,{search:a}=i(),{queryExecuted:u}=a,{setAbortControllerRef:c}=e,g=yield dy(n),v=(y,b)=>{switch(y){case"genqa.headerMessageType":{let w=JSON.parse(b);r(Ni(w.contentFormat));break}case"genqa.messageType":r(_i(JSON.parse(b)));break;case"genqa.citationsType":r(Oi(JSON.parse(b)));break;case"genqa.endOfStreamType":{let w=JSON.parse(b).answerGenerated,{answerId:R,answer:N}=i().generatedAnswer,P=u.length!==0&&!w,A=!N?.trim();r(Fi(P)),r(ki(!1)),r(Qd(w)),r((s??Ra).logGeneratedAnswerStreamEnd(w,R,w?A:void 0)),r(lo());break}default:n.debug&&o.logger.warn(`Unknown payloadType: "${y}"`)}};r(Rn(!0));let x=y=>y.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:y=>{x(g)&&(r(Rn(!1)),y.payload&&y.payloadType&&v(y.payloadType,y.payload))},abort:y=>{x(g)&&r(Pi(y))},close:()=>{x(g)&&r(ki(!1))},resetAnswer:()=>{x(g)&&r(ja())}});h?c(h):r(Rn(!1))});return function(_x68,_x69){return _ref11.apply(this,arguments)}}()),aQ=Ie("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(e,{getState:t,dispatch:n,extra:{navigatorContext:r,logger:o}}){n(ja());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 s=py(i,r);n(sT(s)),yield n(Ey(s))}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(_x70,_x71){return _ref12.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function Iy(_x72,_x73){return _Iy.apply(this,arguments)}function _Iy(){_Iy=_asyncToGenerator(function*(e,t){let n=e.getReader(),r;for(;!(r=yield n.read()).done;)t(r.value)});return _Iy.apply(this,arguments)}function Ry(e){let t,n,r,o=!1;return function(s){t===void 0?(t=s,n=0,r=-1):t=cT(t,s);let a=t.length,u=0;for(;n<a;){o&&(t[n]===10&&(u=++n),o=!1);let c=-1;for(;n<a&&c===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-u);break;case 13:o=!0,c=n;break;case 10:c=n;break}if(c===-1)break;e(t.subarray(u,c),r),u=n,r=-1}u===a?t=void 0:u!==0&&(t=t.subarray(u),n-=u)}}function Ty(e,t,n){let r=xy(),o=new TextDecoder;return function(s,a){if(s.length===0)n?.(r),r=xy();else if(a>0){let u=o.decode(s.subarray(0,a)),c=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(c));switch(u){case"data":r.data=r.data?`${r.data}
32
- ${g}`:g;break;case"event":r.event=g;break;case"id":e(r.id=g);break;case"retry":aT(g,r,t);break}}}}function aT(e,t,n){let r=parseInt(e,10);Number.isNaN(r)||n(t.retry=r)}function cT(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function xy(){return{data:"",event:"",id:"",retry:void 0}}var zd="text/event-stream",uT=1e3,ky="last-event-id";function _y(){return typeof window<"u"}function Oy(e,{signal:t,headers:n,onopen:r,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:u,...c}){return new Promise((g,v)=>{let x={...n};x.accept||(x.accept=zd);let h;function y(){h?.abort(),document.hidden||P()}!a&&_y()&&document.addEventListener("visibilitychange",y);let b=uT,w;function R(){_y()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{R(),g()});let N=u??E,k=r??lT;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let A=yield N(e,{...c,headers:x,signal:h?.signal});yield k(A),yield Iy(A.body,Ry(Ty(O=>{O?x[ky]=O:delete x[ky]},O=>{b=O},o))),i?.(),R(),g()}catch(A){if(!h?.signal?.aborted)try{let O=s?.(A)??b;clearTimeout(w),w=setTimeout(P,O)}catch(O){R(),v(O)}}});return _P2.apply(this,arguments)}P()})}function lT(e){let t=e.headers.get("content-type");if(!t?.startsWith(zd))throw new Error(`Expected content-type to be ${zd}, Actual: ${t}`)}m();d();f();p();var dT=/*#__PURE__*/function(){var _dT=_asyncToGenerator(function*(e,t,n){let r=t.getState(),{accessToken:o,environment:i,organizationId:s}=r.configuration,a=r.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Ur(r.configuration.search?.apiBaseUrl,s,i);return Ng({baseUrl:`${c}/rest/organizations/${s}/answer/v1/configs/${a}`,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,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),E(v,x)});function fetchFn(_x77){return _fetchFn.apply(this,arguments)}return fetchFn}()})(u,{...t,signal:null},n)}catch(c){return{error:c}}});function dT(_x74,_x75,_x76){return _dT.apply(this,arguments)}return dT}(),Py=Hg({reducerPath:"answer",baseQuery:Dg(dT,{maxRetries:3}),endpoints:()=>({})});var pT=(e,t)=>{let{contentFormat:n}=t;e.contentFormat=n,e.isStreaming=!0,e.isLoading=!1},fT=(e,t)=>{let{textDelta:n}=t;if(typeof n!="string")return;let r=e.answer;!r?.trim()&&!n.trim()||(delete e.error,e.answer=r?.trim()?r.concat(n):n)},mT=(e,t)=>{delete e.error,e.citations=t.citations},gT=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},hT=(e,t)=>{let n=t.errorMessage||"Unknown error occurred";e.error={message:n,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${n} (code: ${t.code})`)},yT=(e,t,n,r)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&hT(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(pT(t,i),n(Ni(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(fT(t,i),n(_i({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(mT(t,i),n(Oi({citations:i.citations})));break;case"genqa.endOfStreamType":{gT(t,i);let s=t.answerId,a=i.answerGenerated??!1,u=a?!t.answer?.trim():void 0;n(r.logGeneratedAnswerStreamEnd(a,s,u)),n(lo());break}}},vT=(e,t,n,r)=>{if(!e||!t||!n)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=r?`insight/v1/configs/${r}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${n}/generate`},Wd=Py.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:n})=>{let{analytics:r,...o}=n;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:n,cacheDataLoaded:r,updateCachedData:o,dispatch:i,extra:s}){yield r;let{configuration:a,generatedAnswer:u,insightConfiguration:c}=n(),{generatedAnswerAnalyticsClient:g}=s,{organizationId:v,environment:x,accessToken:h}=a,y=Ur(a.search.apiBaseUrl,v,x),b=vT(y,v,u.answerConfigurationId,c?.insightId);yield Oy(b,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:E,onopen:function(){var _onopen=_asyncToGenerator(function*(w){let R=w.headers.get("x-answer-id");R&&o(N=>{N.answerId=R,i(La(R))})});function onopen(_x80){return _onopen.apply(this,arguments)}return onopen}(),onmessage:w=>{o(R=>{yT(w,R,i,g??Ra)})},onerror:w=>{throw w},onclose:()=>{o(w=>{i(Fi(!w.generated))})}})}).apply(this,arguments)}})})}),Ey=e=>Wd.endpoints.getAnswer.initiate(e);m();d();f();p();var Ny=Qe(Yr,e=>e);m();d();f();p();function ST(e){let t=e.payload?.analyticsAction;return Fy(e)&&!ae(t)}function Fy(e){return"type"in e}var Dy=e=>t=>n=>{let r;ST(n)&&(r=n.payload.analyticsAction,delete n.payload.analyticsAction);let o=t(n);return Fy(n)&&(n.type==="search/executeSearch/fullfilled"&&r===void 0&&console.error("No analytics action associated with search:",n),n.type==="recommendation/get/fullfilled"&&r===void 0&&console.error("No analytics action associated with recommendation:",n),n.type==="productRecommendations/get/fullfilled"&&r===void 0&&console.error("No analytics action associated with product recommendation:",n)),r!==void 0&&e.dispatch(r),o};m();d();f();p();m();d();f();p();m();d();f();p();var o4=V("tab/register",e=>{let t=new Re({values:{id:J,expression:Lt}});return W(e,t)}),My=V("tab/updateActiveTab",e=>W(e,J));m();d();f();p();var qa=Ft(Ta(),1),Uy=Ft(Ly(),1),qy=Ft(jy(),1);qa.default.extend(qy.default);qa.default.extend(Uy.default);var Vy=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:qa.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 bT=/(^|; )Coveo-Pendragon=([^;]*)/,AT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function Gy(){return typeof window>"u"?!1:bT.exec(document.cookie)?.pop()||null}function By(){return typeof window>"u"?!1:AT.test(document.cookie)}var $y=Qe(Vy(),e=>e.addCase(Xr,(t,n)=>{wT(t,n.payload)}).addCase(Bs,(t,n)=>{CT(t,n.payload)}).addCase($s,(t,n)=>{ET(t,n.payload)}).addCase(Hs,t=>{t.analytics.enabled=!1}).addCase(Qs,t=>{t.analytics.enabled=!0}).addCase(Jm,(t,n)=>{t.analytics.originLevel2=n.payload.originLevel2}).addCase(eg,(t,n)=>{t.analytics.originLevel3=n.payload.originLevel3}).addCase(My,(t,n)=>{t.analytics.originLevel2=n.payload}).addCase(zm,(t,n)=>{t.analytics.originLevel2=n.payload}).addCase(qs,(t,n)=>{ae(n.payload.tab)||(t.analytics.originLevel2=n.payload.tab)}).addCase(tg,(t,{payload:n})=>{xT(t,n)}));function wT(e,t){ae(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ae(t.organizationId)||(e.organizationId=t.organizationId)}function CT(e,t){ae(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ae(t.locale)||(e.search.locale=t.locale),ae(t.timezone)||(e.search.timezone=t.timezone),ae(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function ET(e,t){ae(t.enabled)||(e.analytics.enabled=t.enabled),ae(t.originContext)||(e.analytics.originContext=t.originContext),ae(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ae(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ae(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ae(t.trackingId)||(e.analytics.trackingId=t.trackingId),ae(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ae(t.source)||(e.analytics.source=t.source);try{let n=Gy();n&&(e.analytics.analyticsMode="next",e.analytics.trackingId=n)}catch{}ae(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ae(t.anonymous)||(e.analytics.anonymous=t.anonymous),ae(t.deviceId)||(e.analytics.deviceId=t.deviceId),ae(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ae(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function xT(e,t){e.knowledge.agentId=t;try{By()&&(e.knowledge.debugAgentSession=!0)}catch{}}var bt=$y;m();d();f();p();function IT(e){return e.instantlyCallable}var Hy=()=>e=>t=>e(IT(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 tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));function Qy(e,t=0){return(tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]).toLowerCase()}m();d();f();p();var Jd,RT=new Uint8Array(16);function ep(){if(!Jd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Jd=crypto.getRandomValues.bind(crypto)}return Jd(RT)}m();d();f();p();m();d();f();p();var TT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tp={randomUUID:TT};function kT(e,t,n){if(tp.randomUUID&&!t&&!e)return tp.randomUUID();e=e||{};let r=e.random??e.rng?.()??ep();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Qy(r)}var Tn=kT;m();d();f();p();m();d();f();p();var S={};Zi(S,{BRAND:()=>t0,DIRTY:()=>cr,EMPTY_PATH:()=>NT,INVALID:()=>ue,NEVER:()=>U0,OK:()=>ut,ParseStatus:()=>nt,Schema:()=>Se,ZodAny:()=>On,ZodArray:()=>gn,ZodBigInt:()=>lr,ZodBoolean:()=>dr,ZodBranded:()=>Mi,ZodCatch:()=>wr,ZodDate:()=>pr,ZodDefault:()=>Ar,ZodDiscriminatedUnion:()=>Ba,ZodEffects:()=>_t,ZodEnum:()=>Sr,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>le,ZodFunction:()=>Ha,ZodIntersection:()=>hr,ZodIssueCode:()=>z,ZodLazy:()=>yr,ZodLiteral:()=>vr,ZodMap:()=>bo,ZodNaN:()=>wo,ZodNativeEnum:()=>br,ZodNever:()=>Ut,ZodNull:()=>mr,ZodNullable:()=>Kt,ZodNumber:()=>ur,ZodObject:()=>pt,ZodOptional:()=>Tt,ZodParsedType:()=>ee,ZodPipeline:()=>Li,ZodPromise:()=>Pn,ZodReadonly:()=>Cr,ZodRecord:()=>$a,ZodSchema:()=>Se,ZodSet:()=>Ao,ZodString:()=>_n,ZodSymbol:()=>vo,ZodTransformer:()=>_t,ZodTuple:()=>Wt,ZodType:()=>Se,ZodUndefined:()=>fr,ZodUnion:()=>gr,ZodUnknown:()=>mn,ZodVoid:()=>So,addIssueToContext:()=>Z,any:()=>l0,array:()=>m0,bigint:()=>i0,boolean:()=>rv,coerce:()=>j0,custom:()=>ev,date:()=>s0,datetimeRegex:()=>Zy,defaultErrorMap:()=>pn,discriminatedUnion:()=>v0,effect:()=>_0,enum:()=>R0,function:()=>E0,getErrorMap:()=>go,getParsedType:()=>zt,instanceof:()=>r0,intersection:()=>S0,isAborted:()=>Va,isAsync:()=>ho,isDirty:()=>Ga,isValid:()=>kn,late:()=>n0,lazy:()=>x0,literal:()=>I0,makeIssue:()=>Di,map:()=>w0,nan:()=>o0,nativeEnum:()=>T0,never:()=>p0,null:()=>u0,nullable:()=>P0,number:()=>nv,object:()=>g0,objectUtil:()=>np,oboolean:()=>L0,onumber:()=>M0,optional:()=>O0,ostring:()=>D0,pipeline:()=>F0,preprocess:()=>N0,promise:()=>k0,quotelessJson:()=>_T,record:()=>A0,set:()=>C0,setErrorMap:()=>PT,strictObject:()=>h0,string:()=>tv,symbol:()=>a0,transformer:()=>_0,tuple:()=>b0,undefined:()=>c0,union:()=>y0,unknown:()=>d0,util:()=>we,void:()=>f0});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var we;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},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 s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(we||(we={}));var np;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(np||(np={}));var ee=we.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 ee.undefined;case"string":return ee.string;case"number":return Number.isNaN(e)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"symbol":return ee.symbol;case"object":return Array.isArray(e)?ee.array:e===null?ee.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ee.promise:typeof Map<"u"&&e instanceof Map?ee.map:typeof Set<"u"&&e instanceof Set?ee.set:typeof Date<"u"&&e instanceof Date?ee.date:ee.object;default:return ee.unknown}};var z=we.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),_T=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),dt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(this),r}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,we.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};dt.create=e=>new dt(e);var OT=(e,t)=>{let n;switch(e.code){case z.invalid_type:e.received===ee.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,we.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:n=`Unrecognized key(s) in object: ${we.joinValues(e.keys,", ")}`;break;case z.invalid_union:n="Invalid input";break;case z.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${we.joinValues(e.options)}`;break;case z.invalid_enum_value:n=`Invalid enum value. Expected ${we.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:n="Invalid function arguments";break;case z.invalid_return_type:n="Invalid function return type";break;case z.invalid_date:n="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:we.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case z.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case z.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case z.custom:n="Invalid input";break;case z.invalid_intersection_types:n="Intersection results could not be merged";break;case z.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:n="Number must be finite";break;default:n=t.defaultError,we.assertNever(e)}return{message:n}},pn=OT;var zy=pn;function PT(e){zy=e}function go(){return zy}m();d();f();p();var Di=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=r.filter(c=>!!c).slice().reverse();for(let c of u)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},NT=[];function Z(e,t){let n=go(),r=Di({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pn?void 0:pn].filter(o=>!!o)});e.common.issues.push(r)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return ue;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static mergeObjectAsync(t,n){return _asyncToGenerator(function*(){let r=[];for(let o of n){let i=yield o.key,s=yield o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)})()}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ue;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},ue=Object.freeze({status:"aborted"}),cr=e=>({status:"dirty",value:e}),ut=e=>({status:"valid",value:e}),Va=e=>e.status==="aborted",Ga=e=>e.status==="dirty",kn=e=>e.status==="valid",ho=e=>typeof Promise<"u"&&e instanceof Promise;m();d();f();p();m();d();f();p();var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));var kt=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,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}},Wy=(e,t)=>{if(kn(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 n=new dt(e.common.issues);return this._error=n,this._error}}};function ye(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))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:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??n??a.defaultError}},description:o}}var Se=class{get description(){return this._def.description}_getType(t){return zt(t.data)}_getOrReturnCtx(t,n){return n||{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 nt,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 n=this._parse(t);if(ho(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return Wy(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return kn(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>kn(r)?{value:r.value}:{issues:n.common.issues})}parseAsync(t,n){var _this7=this;return _asyncToGenerator(function*(){let r=yield _this7.safeParseAsync(t,n);if(r.success)return r.data;throw r.error})()}safeParseAsync(t,n){var _this8=this;return _asyncToGenerator(function*(){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=_this8._parse({data:t,path:r.path,parent:r}),i=yield ho(o)?o:Promise.resolve(o);return Wy(r,i)})()}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:z.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new _t({schema:this,typeName:le.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:n=>this["~validate"](n)}}optional(){return Tt.create(this,this._def)}nullable(){return Kt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gn.create(this)}promise(){return Pn.create(this,this._def)}or(t){return gr.create([this,t],this._def)}and(t){return hr.create(this,t,this._def)}transform(t){return new _t({...ye(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Ar({...ye(this._def),innerType:this,defaultValue:n,typeName:le.ZodDefault})}brand(){return new Mi({typeName:le.ZodBranded,type:this,...ye(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new wr({...ye(this._def),innerType:this,catchValue:n,typeName:le.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Li.create(this,t)}readonly(){return Cr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},FT=/^c[^\s-]{8,}$/i,DT=/^[0-9a-z]+$/,MT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,LT=/^[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,jT=/^[a-z0-9_-]{21}$/i,UT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qT=/^[-+]?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)?)??$/,VT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,GT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",rp,BT=/^(?:(?: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])$/,$T=/^(?:(?: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])$/,HT=/^(([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]))$/,QT=/^(([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])$/,zT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yy="((\\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])))",KT=new RegExp(`^${Yy}$`);function Xy(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function YT(e){return new RegExp(`^${Xy(e)}$`)}function Zy(e){let t=`${Yy}T${Xy(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function XT(e,t){return!!((t==="v4"||!t)&&BT.test(e)||(t==="v6"||!t)&&HT.test(e))}function ZT(e,t){if(!UT.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function JT(e,t){return!!((t==="v4"||!t)&&$T.test(e)||(t==="v6"||!t)&&QT.test(e))}var _n=class e extends Se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ee.string){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:ee.string,received:i.parsedType}),ue}let r=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")VT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")rp||(rp=new RegExp(GT,"u")),rp.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")LT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")jT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")FT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")DT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")MT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:z.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"regex",code:z.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.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),Z(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Zy(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?KT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?YT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:z.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?qT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?XT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?ZT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?JT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?zT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?WT.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:z.invalid_string,message:i.message}),r.dirty()):we.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:z.invalid_string,...re.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.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,...re.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,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...re.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...re.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...re.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...re.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...re.errToObj(n)})}nonempty(t){return this.min(1,re.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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};_n.create=e=>new _n({checks:[],typeName:le.ZodString,coerce:e?.coerce??!1,...ye(e)});function e0(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var ur=class e extends Se{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)!==ee.number){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:ee.number,received:i.parsedType}),ue}let r,o=new nt;for(let i of this._def.checks)i.kind==="int"?we.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.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)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?e0(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:z.not_finite,message:i.message}),o.dirty()):we.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,re.toString(n))}gt(t,n){return this.setLimit("min",t,!1,re.toString(n))}lte(t,n){return this.setLimit("max",t,!0,re.toString(n))}lt(t,n){return this.setLimit("max",t,!1,re.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:re.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&we.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ur.create=e=>new ur({checks:[],typeName:le.ZodNumber,coerce:e?.coerce||!1,...ye(e)});var lr=class e extends Se{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)!==ee.bigint)return this._getInvalidInput(t);let r,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.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)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):we.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:ee.bigint,received:n.parsedType}),ue}gte(t,n){return this.setLimit("min",t,!0,re.toString(n))}gt(t,n){return this.setLimit("min",t,!1,re.toString(n))}lte(t,n){return this.setLimit("max",t,!0,re.toString(n))}lt(t,n){return this.setLimit("max",t,!1,re.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:re.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:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};lr.create=e=>new lr({checks:[],typeName:le.ZodBigInt,coerce:e?.coerce??!1,...ye(e)});var dr=class extends Se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ee.boolean){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.boolean,received:r.parsedType}),ue}return ut(t.data)}};dr.create=e=>new dr({typeName:le.ZodBoolean,coerce:e?.coerce||!1,...ye(e)});var pr=class e extends Se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ee.date){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_type,expected:ee.date,received:i.parsedType}),ue}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:z.invalid_date}),ue}let r=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):we.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};pr.create=e=>new pr({checks:[],coerce:e?.coerce||!1,typeName:le.ZodDate,...ye(e)});var vo=class extends Se{_parse(t){if(this._getType(t)!==ee.symbol){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.symbol,received:r.parsedType}),ue}return ut(t.data)}};vo.create=e=>new vo({typeName:le.ZodSymbol,...ye(e)});var fr=class extends Se{_parse(t){if(this._getType(t)!==ee.undefined){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.undefined,received:r.parsedType}),ue}return ut(t.data)}};fr.create=e=>new fr({typeName:le.ZodUndefined,...ye(e)});var mr=class extends Se{_parse(t){if(this._getType(t)!==ee.null){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.null,received:r.parsedType}),ue}return ut(t.data)}};mr.create=e=>new mr({typeName:le.ZodNull,...ye(e)});var On=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(t){return ut(t.data)}};On.create=e=>new On({typeName:le.ZodAny,...ye(e)});var mn=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ut(t.data)}};mn.create=e=>new mn({typeName:le.ZodUnknown,...ye(e)});var Ut=class extends Se{_parse(t){let n=this._getOrReturnCtx(t);return Z(n,{code:z.invalid_type,expected:ee.never,received:n.parsedType}),ue}};Ut.create=e=>new Ut({typeName:le.ZodNever,...ye(e)});var So=class extends Se{_parse(t){if(this._getType(t)!==ee.undefined){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.void,received:r.parsedType}),ue}return ut(t.data)}};So.create=e=>new So({typeName:le.ZodVoid,...ye(e)});var gn=class e extends Se{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ee.array)return Z(n,{code:z.invalid_type,expected:ee.array,received:n.parsedType}),ue;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(Z(n,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(Z(n,{code:z.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(Z(n,{code:z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new kt(n,s,n.path,a)))).then(s=>nt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new kt(n,s,n.path,a)));return nt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:re.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:re.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:re.toString(n)}})}nonempty(t){return this.min(1,t)}};gn.create=(e,t)=>new gn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:le.ZodArray,...ye(t)});function yo(e){if(e instanceof pt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Tt.create(yo(r))}return new pt({...e._def,shape:()=>t})}else return e instanceof gn?new gn({...e._def,type:yo(e.element)}):e instanceof Tt?Tt.create(yo(e.unwrap())):e instanceof Kt?Kt.create(yo(e.unwrap())):e instanceof Wt?Wt.create(e.items.map(t=>yo(t))):e}var pt=class e extends Se{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(),n=we.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ee.object){let c=this._getOrReturnCtx(t);return Z(c,{code:z.invalid_type,expected:ee.object,received:c.parsedType}),ue}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ut&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let u=[];for(let c of s){let g=i[c],v=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new kt(o,v,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Ut){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of a)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")a.length>0&&(Z(o,{code:z.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of a){let v=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new kt(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,x=yield g.value;c.push({key:v,value:x,alwaysSet:g.alwaysSet})}return c})).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:re.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:le.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of we.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of we.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return yo(this)}partial(t){let n={};for(let r of we.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of we.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Tt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return Jy(we.objectKeys(this.shape))}};pt.create=(e,t)=>new pt({shape:()=>e,unknownKeys:"strip",catchall:Ut.create(),typeName:le.ZodObject,...ye(t)});pt.strictCreate=(e,t)=>new pt({shape:()=>e,unknownKeys:"strict",catchall:Ut.create(),typeName:le.ZodObject,...ye(t)});pt.lazycreate=(e,t)=>new pt({shape:e,unknownKeys:"strip",catchall:Ut.create(),typeName:le.ZodObject,...ye(t)});var gr=class extends Se{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new dt(a.ctx.common.issues));return Z(n,{code:z.invalid_union,unionErrors:s}),ue}if(n.common.async)return Promise.all(r.map(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i){let s={...n,common:{...n.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}});return function(_x81){return _ref14.apply(this,arguments)}}())).then(o);{let i,s=[];for(let u of r){let c={...n,common:{...n.common,issues:[]},parent:null},g=u._parseSync({data:n.data,path:n.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new dt(u));return Z(n,{code:z.invalid_union,unionErrors:a}),ue}}get options(){return this._def.options}};gr.create=(e,t)=>new gr({options:e,typeName:le.ZodUnion,...ye(t)});var fn=e=>e instanceof yr?fn(e.schema):e instanceof _t?fn(e.innerType()):e instanceof vr?[e.value]:e instanceof Sr?e.options:e instanceof br?we.objectValues(e.enum):e instanceof Ar?fn(e._def.innerType):e instanceof fr?[void 0]:e instanceof mr?[null]:e instanceof Tt?[void 0,...fn(e.unwrap())]:e instanceof Kt?[null,...fn(e.unwrap())]:e instanceof Mi||e instanceof Cr?fn(e.unwrap()):e instanceof wr?fn(e._def.innerType):[],Ba=class e extends Se{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.object)return Z(n,{code:z.invalid_type,expected:ee.object,received:n.parsedType}),ue;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Z(n,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ue)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=fn(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:le.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ye(r)})}};function op(e,t){let n=zt(e),r=zt(t);if(e===t)return{valid:!0,data:e};if(n===ee.object&&r===ee.object){let o=we.objectKeys(t),i=we.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=op(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(n===ee.array&&r===ee.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=op(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return n===ee.date&&r===ee.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var hr=class extends Se{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(Va(i)||Va(s))return ue;let a=op(i.value,s.value);return a.valid?((Ga(i)||Ga(s))&&n.dirty(),{status:n.value,value:a.data}):(Z(r,{code:z.invalid_intersection_types}),ue)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};hr.create=(e,t,n)=>new hr({left:e,right:t,typeName:le.ZodIntersection,...ye(n)});var Wt=class e extends Se{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.array)return Z(r,{code:z.invalid_type,expected:ee.array,received:r.parsedType}),ue;if(r.data.length<this._def.items.length)return Z(r,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ue;!this._def.rest&&r.data.length>this._def.items.length&&(Z(r,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new kt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>nt.mergeArray(n,s)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Wt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wt({items:e,typeName:le.ZodTuple,rest:null,...ye(t)})};var $a=class e extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.object)return Z(r,{code:z.invalid_type,expected:ee.object,received:r.parsedType}),ue;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new kt(r,a,r.path,a)),value:s._parse(new kt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?nt.mergeObjectAsync(n,o):nt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Se?new e({keyType:t,valueType:n,typeName:le.ZodRecord,...ye(r)}):new e({keyType:_n.create(),valueType:t,typeName:le.ZodRecord,...ye(n)})}},bo=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.map)return Z(r,{code:z.invalid_type,expected:ee.map,received:r.parsedType}),ue;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,u],c)=>({key:o._parse(new kt(r,a,r.path,[c,"key"])),value:i._parse(new kt(r,u,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of s){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return ue;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),a.set(c.value,g.value)}return{status:n.value,value:a}}))}else{let a=new Map;for(let u of s){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return ue;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),a.set(c.value,g.value)}return{status:n.value,value:a}}}};bo.create=(e,t,n)=>new bo({valueType:t,keyType:e,typeName:le.ZodMap,...ye(n)});var Ao=class e extends Se{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.set)return Z(r,{code:z.invalid_type,expected:ee.set,received:r.parsedType}),ue;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(Z(r,{code:z.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(Z(r,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(u){let c=new Set;for(let g of u){if(g.status==="aborted")return ue;g.status==="dirty"&&n.dirty(),c.add(g.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((u,c)=>i._parse(new kt(r,u,r.path,c)));return r.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:re.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:re.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Ao.create=(e,t)=>new Ao({valueType:e,minSize:null,maxSize:null,typeName:le.ZodSet,...ye(t)});var Ha=class e extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.function)return Z(n,{code:z.invalid_type,expected:ee.function,received:n.parsedType}),ue;function r(a,u){return Di({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,go(),pn].filter(c=>!!c),issueData:{code:z.invalid_arguments,argumentsError:u}})}function o(a,u){return Di({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,go(),pn].filter(c=>!!c),issueData:{code:z.invalid_return_type,returnTypeError:u}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Pn){let a=this;return ut(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new dt([]),g=yield a._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(r(u,h)),c}),v=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(v,i).catch(h=>{throw c.addIssue(o(v,h)),c})}))}else{let a=this;return ut(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new dt([r(u,c.error)]);let g=Reflect.apply(s,this,c.data),v=a._def.returns.safeParse(g,i);if(!v.success)throw new dt([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:Wt.create(t).rest(mn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||Wt.create([]).rest(mn.create()),returns:n||mn.create(),typeName:le.ZodFunction,...ye(r)})}},yr=class extends Se{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};yr.create=(e,t)=>new yr({getter:e,typeName:le.ZodLazy,...ye(t)});var vr=class extends Se{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return Z(n,{received:n.data,code:z.invalid_literal,expected:this._def.value}),ue}return{status:"valid",value:t.data}}get value(){return this._def.value}};vr.create=(e,t)=>new vr({value:e,typeName:le.ZodLiteral,...ye(t)});function Jy(e,t){return new Sr({values:e,typeName:le.ZodEnum,...ye(t)})}var Sr=class e extends Se{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{expected:we.joinValues(r),received:n.parsedType,code:z.invalid_type}),ue}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{received:n.data,code:z.invalid_enum_value,options:r}),ue}return ut(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};Sr.create=Jy;var br=class extends Se{_parse(t){let n=we.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ee.string&&r.parsedType!==ee.number){let o=we.objectValues(n);return Z(r,{expected:we.joinValues(o),received:r.parsedType,code:z.invalid_type}),ue}if(this._cache||(this._cache=new Set(we.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=we.objectValues(n);return Z(r,{received:r.data,code:z.invalid_enum_value,options:o}),ue}return ut(t.data)}get enum(){return this._def.values}};br.create=(e,t)=>new br({values:e,typeName:le.ZodNativeEnum,...ye(t)});var Pn=class extends Se{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.promise&&n.common.async===!1)return Z(n,{code:z.invalid_type,expected:ee.promise,received:n.parsedType}),ue;let r=n.parsedType===ee.promise?n.data:Promise.resolve(n.data);return ut(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Pn.create=(e,t)=>new Pn({type:e,typeName:le.ZodPromise,...ye(t)});var _t=class extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(a){if(n.value==="aborted")return ue;let u=yield _this9._def.schema._parseAsync({data:a,path:r.path,parent:r});return u.status==="aborted"?ue:u.status==="dirty"?cr(u.value):n.value==="dirty"?cr(u.value):u});return function(_x82){return _ref17.apply(this,arguments)}}());{if(n.value==="aborted")return ue;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?ue:a.status==="dirty"?cr(a.value):n.value==="dirty"?cr(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ue:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ue:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!kn(s))return ue;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>kn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):ue);we.assertNever(o)}};_t.create=(e,t,n)=>new _t({schema:e,typeName:le.ZodEffects,effect:t,...ye(n)});_t.createWithPreprocess=(e,t,n)=>new _t({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...ye(n)});var Tt=class extends Se{_parse(t){return this._getType(t)===ee.undefined?ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tt.create=(e,t)=>new Tt({innerType:e,typeName:le.ZodOptional,...ye(t)});var Kt=class extends Se{_parse(t){return this._getType(t)===ee.null?ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kt.create=(e,t)=>new Kt({innerType:e,typeName:le.ZodNullable,...ye(t)});var Ar=class extends Se{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===ee.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});var wr=class extends Se{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ho(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};wr.create=(e,t)=>new wr({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});var wo=class extends Se{_parse(t){if(this._getType(t)!==ee.nan){let r=this._getOrReturnCtx(t);return Z(r,{code:z.invalid_type,expected:ee.nan,received:r.parsedType}),ue}return{status:"valid",value:t.data}}};wo.create=e=>new wo({typeName:le.ZodNaN,...ye(e)});var t0=Symbol("zod_brand"),Mi=class extends Se{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Li=class e extends Se{_parse(t){var _this0=this;let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ue:i.status==="dirty"?(n.dirty(),cr(i.value)):_this0._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?ue:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:le.ZodPipeline})}},Cr=class extends Se{_parse(t){let n=this._def.innerType._parse(t),r=o=>(kn(o)&&(o.value=Object.freeze(o.value)),o);return ho(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Cr.create=(e,t)=>new Cr({innerType:e,typeName:le.ZodReadonly,...ye(t)});function Ky(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function ev(e,t={},n){return e?On.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Ky(t,r),u=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=Ky(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):On.create()}var n0={object:pt.lazycreate},le;(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"})(le||(le={}));var r0=(e,t={message:`Input not instance of ${e.name}`})=>ev(n=>n instanceof e,t),tv=_n.create,nv=ur.create,o0=wo.create,i0=lr.create,rv=dr.create,s0=pr.create,a0=vo.create,c0=fr.create,u0=mr.create,l0=On.create,d0=mn.create,p0=Ut.create,f0=So.create,m0=gn.create,g0=pt.create,h0=pt.strictCreate,y0=gr.create,v0=Ba.create,S0=hr.create,b0=Wt.create,A0=$a.create,w0=bo.create,C0=Ao.create,E0=Ha.create,x0=yr.create,I0=vr.create,R0=Sr.create,T0=br.create,k0=Pn.create,_0=_t.create,O0=Tt.create,P0=Kt.create,N0=_t.createWithPreprocess,F0=Li.create,D0=()=>tv().optional(),M0=()=>nv().optional(),L0=()=>rv().optional(),j0={string:e=>_n.create({...e,coerce:!0}),number:e=>ur.create({...e,coerce:!0}),boolean:e=>dr.create({...e,coerce:!0}),bigint:e=>lr.create({...e,coerce:!0}),date:e=>pr.create({...e,coerce:!0})};var U0=ue;var q0=S.record(S.any()),Er=q0.optional();function ov(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var V0=S.object({name:S.string(),arguments:S.string()}),G0=S.object({id:S.string(),type:S.literal("function"),function:V0,encryptedValue:S.string().optional(),metadata:Er}),Qa=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:Er}),B0=S.object({type:S.literal("text"),text:S.string()}),$0=S.object({type:S.literal("data"),value:S.string(),mimeType:S.string()}),H0=S.object({type:S.literal("url"),value:S.string(),mimeType:S.string().optional()}),za=S.discriminatedUnion("type",[$0,H0]),Q0=S.object({type:S.literal("image"),source:za,metadata:S.unknown().optional()}),z0=S.object({type:S.literal("audio"),source:za,metadata:S.unknown().optional()}),W0=S.object({type:S.literal("video"),source:za,metadata:S.unknown().optional()}),K0=S.object({type:S.literal("document"),source:za,metadata:S.unknown().optional()});var iv=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()}),sv=(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"]})},DW=iv.superRefine((e,t)=>{sv(e,t)}),Y0=S.discriminatedUnion("type",[B0,Q0,z0,W0,K0,iv]),X0=Y0.superRefine((e,t)=>{e.type==="binary"&&sv(e,t)}),Z0=Qa.extend({role:S.literal("developer"),content:S.string()}),J0=Qa.extend({role:S.literal("system"),content:S.string()}),ek=Qa.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(G0).optional()}),tk=Qa.extend({role:S.literal("user"),content:S.union([S.string(),S.array(X0)])}),nk=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:Er}),rk=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:Er}),ok=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:Er}),av=S.discriminatedUnion("role",[Z0,J0,ek,tk,nk,rk,ok]),MW=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),ik=S.object({description:S.string(),value:S.string()}),cv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),sk=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()}),ak=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:Er}),ck=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(av),tools:S.array(cv),context:S.array(ik),forwardedProps:S.any(),resume:S.array(ak).optional()}),uk=S.any(),pe=class extends Error{constructor(e){super(e)}},ip=class extends pe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},lk=S.object({name:S.string(),description:S.string().optional()}),dk=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()}),pk=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),fk=S.object({supported:S.boolean().optional(),items:S.array(cv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),mk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),gk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),hk=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(lk).optional()}),yk=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),vk=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()}),bk=S.object({input:vk.optional(),output:Sk.optional()}),Ak=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),wk=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()}),LW=S.object({identity:dk.optional(),transport:pk.optional(),tools:fk.optional(),output:mk.optional(),state:gk.optional(),multiAgent:hk.optional(),reasoning:yk.optional(),multimodal:bk.optional(),execution:Ak.optional(),humanInTheLoop:wk.optional(),custom:S.record(S.unknown()).optional()}),uv=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}({}),Ce=S.object({type:S.nativeEnum(F),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:Er}).passthrough(),Ck=Ce.extend({type:S.literal(F.TEXT_MESSAGE_START),messageId:S.string(),role:uv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),lv=Ce.extend({type:S.literal(F.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Ek=Ce.extend({type:S.literal(F.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),xk=Ce.extend({type:S.literal(F.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:uv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),Ik=Ce.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_START)}),Rk=lv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),Tk=Ce.extend({type:S.literal(F.THINKING_TEXT_MESSAGE_END)}),kk=Ce.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()}),_k=Ce.extend({type:S.literal(F.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Ok=Ce.extend({type:S.literal(F.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),Pk=Ce.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()}),Nk=Ce.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()}),Fk=Ce.extend({type:S.literal(F.THINKING_START),title:S.string().optional()}),Dk=Ce.extend({type:S.literal(F.THINKING_END)}),Mk=Ce.extend({type:S.literal(F.STATE_SNAPSHOT),snapshot:uk,subagentRunId:S.string().optional()}),Lk=Ce.extend({type:S.literal(F.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),jk=Ce.extend({type:S.literal(F.MESSAGES_SNAPSHOT),messages:S.array(av)}),Uk=Ce.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()}),qk=Ce.extend({type:S.literal(F.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),Vk=Ce.extend({type:S.literal(F.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),Gk=Ce.extend({type:S.literal(F.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),Bk=Ce.extend({type:S.literal(F.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:ck.optional()}),$k=S.object({type:S.literal("success")}).strict(),Hk=S.object({type:S.literal("interrupt"),interrupts:S.array(sk).min(1)}).strict(),Qk=S.discriminatedUnion("type",[$k,Hk]),dv=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()}),zk=Ce.extend({type:S.literal(F.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:Qk.nullable().optional().transform(e=>e??void 0),usage:S.array(dv).optional()}),Wk=Ce.extend({type:S.literal(F.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(dv).optional()}),Kk=Ce.extend({type:S.literal(F.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),Yk=Ce.extend({type:S.literal(F.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),Xk=S.union([S.literal("tool-call"),S.literal("message")]),Zk=Ce.extend({type:S.literal(F.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),Jk=Ce.extend({type:S.literal(F.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),e_=Ce.extend({type:S.literal(F.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),t_=Ce.extend({type:S.literal(F.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),n_=Ce.extend({type:S.literal(F.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),r_=Ce.extend({type:S.literal(F.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),o_=Ce.extend({type:S.literal(F.REASONING_ENCRYPTED_VALUE),subtype:Xk,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),i_=Ce.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()}),s_=S.object({type:S.literal("success")}).strict(),a_=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),c_=S.discriminatedUnion("type",[s_,a_]),u_=Ce.extend({type:S.literal(F.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:c_.optional()}),l_=Ce.extend({type:S.literal(F.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),Wa=S.discriminatedUnion("type",[Ck,lv,Ek,xk,Fk,Dk,Ik,Rk,Tk,kk,_k,Ok,Nk,Pk,Mk,Lk,jk,Uk,qk,Vk,Gk,Bk,zk,Wk,Kk,Yk,Zk,Jk,e_,t_,n_,r_,o_,i_,u_,l_]);m();d();f();p();var sp={};Zi(sp,{JsonPatchError:()=>qe,_areEquals:()=>qi,applyOperation:()=>xr,applyPatch:()=>tc,applyReducer:()=>g_,deepClone:()=>f_,getValueByPointer:()=>Ja,validate:()=>fv,validator:()=>ec});m();d();f();p();m();d();f();p();var d_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),p_=Object.prototype.hasOwnProperty;function Ya(e,t){return p_.call(e,t)}function Xa(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var o in e)Ya(e,o)&&r.push(o);return r}function rt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Za(e){for(var t=0,n=e.length,r;t<n;){if(r=e.charCodeAt(t),r>=48&&r<=57){t++;continue}return!1}return!0}function Yt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ji(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ka(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(Ka(e[t]))return!0}else if(typeof e=="object"){for(var r=Xa(e),o=r.length,i=0;i<o;i++)if(Ka(e[r[i]]))return!0}}return!1}function pv(e,t){var n=[e];for(var r in t){var o=typeof t[r]=="object"?JSON.stringify(t[r],null,2):t[r];typeof o<"u"&&n.push(r+": "+o)}return n.join(`
33
- `)}var Ui=function(e){d_(t,e);function t(n,r,o,i,s){var a=this.constructor,u=e.call(this,pv(n,{name:r,index:o,operation:i,tree:s}))||this;return u.name=r,u.index=o,u.operation=i,u.tree=s,Object.setPrototypeOf(u,a.prototype),u.message=pv(n,{name:r,index:o,operation:i,tree:s}),u}return t}(Error);var qe=Ui,f_=rt,Co={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=Ja(n,this.path);r&&(r=rt(r));var o=xr(n,{op:"remove",path:this.from}).removed;return xr(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=Ja(n,this.from);return xr(n,{op:"add",path:this.path,value:rt(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:qi(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},m_={add:function(e,t,n){return Za(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){var r=e.splice(t,1);return{newDocument:n,removed:r[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:Co.move,copy:Co.copy,test:Co.test,_get:Co._get};function Ja(e,t){if(t=="")return e;var n={op:"_get",path:t};return xr(e,n),n.value}function xr(e,t,n,r,o,i){if(n===void 0&&(n=!1),r===void 0&&(r=!0),o===void 0&&(o=!0),i===void 0&&(i=0),n&&(typeof n=="function"?n(t,0,e,t.path):ec(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=Ja(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=qi(e,t.value),s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(n)throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{r||(e=rt(e));var a=t.path||"",u=a.split("/"),c=e,g=1,v=u.length,x=void 0,h=void 0,y=void 0;for(typeof n=="function"?y=n:y=ec;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=ji(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(n&&x===void 0&&(c[h]===void 0?x=u.slice(0,g).join("/"):g==v-1&&(x=t.path),x!==void 0&&y(t,0,e,x)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(n&&!Za(h))throw new qe("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Za(h)&&(h=~~h)}if(g>=v){if(n&&t.op==="add"&&h>c.length)throw new qe("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=m_[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=v){var s=Co[t.op].call(t,c,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(c=c[h],n&&g<v&&(!c||typeof c!="object"))throw new qe("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function tc(e,t,n,r,o){if(r===void 0&&(r=!0),o===void 0&&(o=!0),n&&!Array.isArray(t))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=rt(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=xr(e,t[s],n,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function g_(e,t,n){var r=xr(e,t);if(r.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument}function ec(e,t,n,r){if(typeof e!="object"||e===null||Array.isArray(e))throw new qe("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(Co[e.op]){if(typeof e.path!="string")throw new qe("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new qe("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new qe("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ka(e.value))throw new qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var o=e.path.split("/").length,i=r.split("/").length;if(o!==i+1&&o!==i)throw new qe("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==r)throw new qe("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=fv([s],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new qe("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function fv(e,t,n){try{if(!Array.isArray(e))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)tc(rt(t),rt(e),n||!0);else{n=n||ec;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(o){if(o instanceof qe)return o;throw o}}function qi(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=Array.isArray(e),r=Array.isArray(t),o,i,s;if(n&&r){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!qi(e[o],t[o]))return!1;return!0}if(n!=r)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!qi(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var lp={};Zi(lp,{compare:()=>C_,generate:()=>ap,observe:()=>w_,unobserve:()=>A_});m();d();f();p();var cp=new WeakMap,h_=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),y_=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function v_(e){return cp.get(e)}function S_(e,t){return e.observers.get(t)}function b_(e,t){e.observers.delete(t.callback)}function A_(e,t){t.unobserve()}function w_(e,t){var n=[],r,o=v_(e);if(!o)o=new h_(e),cp.set(e,o);else{var i=S_(o,t);r=i&&i.observer}if(r)return r;if(r={},o.value=rt(e),t){r.callback=t,r.next=null;var s=function(){ap(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=n,r.object=e,r.unobserve=function(){ap(r),clearTimeout(r.next),b_(o,r),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new y_(t,r)),r}function ap(e,t){t===void 0&&(t=!1);var n=cp.get(e.object);up(n.value,e.object,e.patches,"",t),e.patches.length&&tc(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function up(e,t,n,r,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Xa(t),s=Xa(e),a=!1,u=!1,c=s.length-1;c>=0;c--){var g=s[c],v=e[g];if(Ya(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof v=="object"&&v!=null&&typeof x=="object"&&x!=null&&Array.isArray(v)===Array.isArray(x)?up(v,x,n,r+"/"+Yt(g),o):v!==x&&(a=!0,o&&n.push({op:"test",path:r+"/"+Yt(g),value:rt(v)}),n.push({op:"replace",path:r+"/"+Yt(g),value:rt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&n.push({op:"test",path:r+"/"+Yt(g),value:rt(v)}),n.push({op:"remove",path:r+"/"+Yt(g)}),u=!0):(o&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),a=!0)}if(!(!u&&i.length==s.length))for(var c=0;c<i.length;c++){var g=i[c];!Ya(e,g)&&t[g]!==void 0&&n.push({op:"add",path:r+"/"+Yt(g),value:rt(t[g])})}}}function C_(e,t,n){n===void 0&&(n=!1);var r=[];return up(e,t,r,"",n),r}var nc=Object.assign({},sp,lp,{JsonPatchError:Ui,deepClone:rt,escapePathComponent:Yt,unescapePathComponent:ji});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var dp=function(e,t){return dp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},dp(e,t)};function Xt(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 n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function mv(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(v){s(v)}}function u(g){try{c(r.throw(g))}catch(v){s(v)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})}function rc(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function hn(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Eo(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function xo(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function Ir(e){return this instanceof Ir?(this.v=e,this):new Ir(e)}function gv(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(y){return Promise.resolve(y).then(h,v)}}function a(h,y){r[h]&&(o[h]=function(b){return new Promise(function(w,R){i.push([h,b,w,R])>1||u(h,b)})},y&&(o[h]=y(o[h])))}function u(h,y){try{c(r[h](y))}catch(b){x(i[0][3],b)}}function c(h){h.value instanceof Ir?Promise.resolve(h.value.v).then(g,v):x(i[0][2],h)}function g(h){u("next",h)}function v(h){u("throw",h)}function x(h,y){h(y),i.shift(),i.length&&u(i[0][0],i[0][1])}}function hv(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof hn=="function"?hn(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(s){return new Promise(function(a,u){s=e[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(c){i({value:c,done:a})},s)}}m();d();f();p();function Ae(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function Io(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var oc=Io(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
31
+ `;function nR(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var rR=["1",1,"yes",!0];function oR(){let e=[];return ld()&&e.push(window.doNotTrack),Ed()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>rR.indexOf(t)!==-1)}function Ca(e){return e===!0?!1:oR()}var Th="v15",kh={default:"https://analytics.cloud.coveo.com/rest/ua"};function iR(e=kh.default,t=Th,n=!1){if(e=e.replace(/\/$/,""),n)return`${e}/${t}`;let r=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${r?"":"/rest"}/${t}`}var sR="38824e1f-37f5-42d3-8372-a4b8fa9df946",zt=class{get defaultOptions(){return{endpoint:kh.default,isCustomEndpoint:!1,token:"",version:Th,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Eh}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=[Kx,Gx].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let n={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ca(this.options.disableBrowserPrivacySignals)?this.runtime=new wa:this.runtime=this.options.runtimeEnvironment||this.initRuntime(n),this.addEventTypeMapping(Se.view,{newEventType:Se.view,addClientIdParameter:!0}),this.addEventTypeMapping(Se.click,{newEventType:Se.click,addClientIdParameter:!0}),this.addEventTypeMapping(Se.custom,{newEventType:Se.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Se.search,{newEventType:Se.search,addClientIdParameter:!0})}initRuntime(t){return ld()&&lo()?new wd(t,()=>{let n=[...this.bufferedRequests];return this.bufferedRequests=[],n}):(nR()&&console.warn(tR),new Cd(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return ld()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||cr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),cr()}})}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,n){return G(this,void 0,void 0,function*(){if(ya(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!n)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(va(t,va(n,sR)))}})}getParameters(t,...n){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...n)})}getPayload(t,...n){return G(this,void 0,void 0,function*(){let r=yield this.resolveParameters(t,...n);return yield this.resolvePayloadForParameters(t,r)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(cr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ca(this.options.disableBrowserPrivacySignals))return null;try{let n=new URL(t).searchParams.get(En.cvo_cid);if(n==null)return null;let r=En.fromString(n);return!r||!lo()||!r.validate(document.referrer,this.acceptedLinkReferrers)?null:r.clientId}catch{}return null}resolveParameters(t,...n){return G(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:r=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:s=!1}=this.eventTypeMapping[t]||{};return yield[h=>r.length>0?this.parseVariableArgumentsPayload(r,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 s?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>i?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((v,A)=>G(this,void 0,void 0,function*(){let C=yield v;return yield A(t,C)}),h)].reduce((h,v)=>G(this,void 0,void 0,function*(){let A=yield h;return yield v(A)}),Promise.resolve(n))})}resolvePayloadForParameters(t,n){return G(this,void 0,void 0,function*(){let{usesMeasurementProtocol:r=!1}=this.eventTypeMapping[t]||{};return yield[y=>this.setTrackingIdIfTrackingIdNotPresent(y),y=>this.removeEmptyPayloadValues(y,t),y=>this.validateParams(y,t),y=>r?HI(y):y,y=>r?this.removeUnknownParameters(y):y,y=>r?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,E)=>G(this,void 0,void 0,function*(){let h=yield y;return yield E(h)}),Promise.resolve(n))})}makeEvent(t,...n){return G(this,void 0,void 0,function*(){let{newEventType:r=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...n),i=yield this.resolvePayloadForParameters(t,o);return{eventType:r,payload:i,log:s=>G(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:r,payload:Object.assign(Object.assign({},i),s)}),yield Promise.all(this.afterSendHooks.map(a=>a(t,Object.assign(Object.assign({},o),s)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...n){return G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...n)).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:n,payload:r}=t;return this.runtime.getClientDependingOnEventType(n).sendEvent(n,r)}})}clear(){this.storage.removeItem("visitorId"),(new ha).clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Se.search,t)})}sendSearchEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:n}=t,r=fn(t,["searchQueryUid"]);return(yield this.makeSearchEvent(r)).log({searchQueryUid:n})})}makeClickEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Se.click,t)})}sendClickEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:n}=t,r=fn(t,["searchQueryUid"]);return(yield this.makeClickEvent(r)).log({searchQueryUid:n})})}makeCustomEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Se.custom,t)})}sendCustomEvent(t){return G(this,void 0,void 0,function*(){var{lastSearchQueryUid:n}=t,r=fn(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(r)).log({lastSearchQueryUid:n})})}makeViewEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(Se.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 n=yield(yield I(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=n.visitorId,n})}getHealth(){return G(this,void 0,void 0,function*(){return yield(yield I(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,n){this.eventTypeMapping[t]=n}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(n=>typeof n=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,n){let r={};for(let o=0,i=n.length;o<i;o++){let s=n[o];if(typeof s=="string")r[t[o]]=s;else if(typeof s=="object")return Object.assign(Object.assign({},r),s)}return r}isKeyAllowedEmpty(t,n){return({[Se.search]:["queryText"]}[t]||[]).indexOf(n)!==-1}removeEmptyPayloadValues(t,n){let r=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(n,o)||r(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(r=>{if(KI(r))return!0;console.log(r,"is not processed by coveoua")}).reduce((r,o)=>Object.assign(Object.assign({},r),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:n}=t,r=fn(t,["custom"]),o={};n&&ga(n)&&(o=this.lowercaseKeys(n));let i=YI(r);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:n}=t,r=fn(t,["custom"]);if(n&&ga(n)){let o=this.lowercaseKeys(n);return Object.assign(Object.assign({},r),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let n=Object.keys(t),r={};return n.forEach(o=>{r[o.toLowerCase()]=t[o]}),r}validateParams(t,n){let{anonymizeIp:r}=t,o=fn(t,["anonymizeIp"]);return r!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${r}`.toLowerCase())==-1&&(o.anonymizeIp=1),(n==Se.view||n==Se.click||n==Se.search||n==Se.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),n==Se.view&&(o.location=this.limit(o.location,1024)),(n=="pageview"||n=="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:n}=t,r=fn(t,["userId"]);return eR(this.options.token)&&!n?(r.userId="anonymous",r):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:n}=t,r=fn(t,["trackingId"]);return n?t:(r.hasOwnProperty("custom")&&ga(r.custom)&&(r.custom.hasOwnProperty("context_website")||r.custom.hasOwnProperty("siteName"))&&(r.trackingId=r.custom.context_website||r.custom.siteName),r.hasOwnProperty("customData")&&ga(r.customData)&&(r.customData.hasOwnProperty("context_website")||r.customData.hasOwnProperty("siteName"))&&(r.trackingId=r.customData.context_website||r.customData.siteName),r)}limit(t,n){return typeof t=="string"?cI(t,n):t}get baseUrl(){return iR(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},pn;(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"})(pn||(pn={}));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 vh={[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",[pn.expandToFullUI]:"interface",[pn.openUserActions]:"User Actions",[pn.showPrecedingSessions]:"User Actions",[pn.showFollowingSessions]:"User Actions",[pn.clickViewedDocument]:"User Actions",[pn.clickPageView]:"User Actions",[pn.createArticle]:"createArticle"},go=class{constructor(){this.runtime=new wa,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(Se.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Se.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Se.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Se.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Eh}};function aR(e){let t="";return e.filter(n=>{let r=n!==t;return t=n,r})}function cR(e){return e.map(t=>t.replace(/;/g,""))}function _h(e){let n=e.join(";");return n.length<=256?n:_h(e.slice(1))}var Sh=e=>{let t=cR(e),n=aR(t);return _h(n)};function bh(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Sh(e.partialQueries),n=typeof e.suggestions=="string"?e.suggestions:Sh(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:n})}var Ea=class{constructor(t,n){this.opts=t,this.provider=n;let r=t.enableAnalytics===!1||Ca(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=r?new go:new zt(t)}disable(){this.coveoAnalyticsClient=new go}enable(){this.coveoAnalyticsClient=new zt(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,n){return this.makeClickEvent(H.recommendationOpen,t,n)}logRecommendationOpen(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,n)).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,n){return this.makeClickEvent(H.documentQuickview,t,n)}logDocumentQuickview(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,n){return this.makeClickEvent(H.documentOpen,t,n)}logDocumentOpen(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(H.omniboxAnalytics,bh(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,bh(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,n){return this.makeCustomEvent(H.sendSmartSnippetReason,{reason:t,details:n})}logSmartSnippetFeedbackReason(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,n)).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,n){return this.makeClickEvent(H.openSmartSnippetSource,t,n)}logOpenSmartSnippetSource(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,n){return this.makeClickEvent(H.openSmartSnippetSuggestionSource,t,{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}makeCopyToClipboard(t,n){return this.makeClickEvent(H.copyToClipboard,t,n)}logCopyToClipboard(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,n)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,n){return this.makeClickEvent(H.openSmartSnippetInlineLink,t,{contentIDKey:n.contentIDKey,contentIDValue:n.contentIDValue},n)}logOpenSmartSnippetInlineLink(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,n){return this.makeClickEvent(H.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}logOpenSmartSnippetSuggestionInlineLink(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,n)).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,n){return this.makeCustomEvent(H.recentResultClick,{info:t,identifier:n})}logRecentResultClick(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,n)).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,n){return this.makeClickEvent(H.showMoreFoldedResults,t,n)}logShowMoreFoldedResults(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,n)).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,n){var r;return{actionCause:n,customData:(r=t.payload)===null||r===void 0?void 0:r.customData}}makeCustomEvent(t,n){return G(this,arguments,void 0,function*(r,o,i=vh[r]){this.coveoAnalyticsClient.getParameters;let s=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(s)),{eventType:i,eventValue:r}),u=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(u,r),log:({searchUID:c})=>u.log({lastSearchQueryUid:c})}})}logCustomEvent(t,n){return G(this,arguments,void 0,function*(r,o,i=vh[r]){return(yield this.makeCustomEvent(r,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,n,r){return G(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:n,eventValue:t}),s=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({lastSearchQueryUid:a})}})}logCustomEventWithType(t,n,r){return G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,n,r)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,n)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,n){return G(this,void 0,void 0,function*(){let r=yield this.getBaseSearchEventRequest(t,n),o=yield this.coveoAnalyticsClient.makeSearchEvent(r);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,n,r,o){return G(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},n),yield this.getBaseEventRequest(Object.assign(Object.assign({},r),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),s=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(s,t),log:({searchUID:a})=>s.log({searchQueryUid:a})}})}logClickEvent(t,n,r,o){return G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,n,r,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,n){return G(this,void 0,void 0,function*(){var r,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},n),(o=(r=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(r)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:n,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,n;return{originContext:(n=(t=this.provider).getOriginContext)===null||n===void 0?void 0:n.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof zt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",n=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),n&&{splitTestRunVersion:n})}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,n){return this.makeClickEvent(H.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:n.documentId.contentIdKey,contentIDValue:n.documentId.contentIdValue},n)}logGeneratedAnswerCitationClick(t,n){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,n)).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()})})}},xa=Object.assign({},Oi),Ah=Object.keys(xa).map(e=>xa[e]),po=class extends md{constructor({client:t,uuidGenerator:n=cr}){super({client:t,uuidGenerator:n}),this.ticket={}}getApi(t){let n=super.getApi(t);return n!==null?n: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,...[n])=>Ah.indexOf(t)!==-1?this.addSVCDataToPayload(t,n):n),this.client.registerAfterSendEventHook((t,...[n])=>(Ah.indexOf(t)!==-1&&this.updateLocationInformation(t,n),n))}addHooksForPageView(){this.client.addEventTypeMapping(xa.pageview,{newEventType:Se.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(xa.event,{newEventType:Se.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,n){var r;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,n)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((r=this.actionData)!==null&&r!==void 0?r:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),n)}getTicketPayload(){return pI(this.ticket)}};po.Id="svc";var Ia;(function(e){e.click="click",e.flowStart="flowStart"})(Ia||(Ia={}));var Tt;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(Tt||(Tt={}));var Ra;(function(e){e.quit="Quit",e.solved="Solved"})(Ra||(Ra={}));var Ta=class{constructor(t,n){var r;this.options=t,this.provider=n;let o=((r=t.enableAnalytics)!==null&&r!==void 0?r:!0)&&!Ca(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new zt(t):new go,this.svc=new po({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new go,this.svc=new po({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new zt(this.options),this.svc=new po({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(Tt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(Tt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(Tt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(Tt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(Tt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(Tt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(Tt.caseCancelled,{reason:Ra.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(Tt.caseSolved,{reason:Ra.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(Tt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ia.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ia.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(this,void 0,void 0,function*(){var n,r;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(n=this.provider)===null||n===void 0?void 0:n.getLanguage(),anonymous:(r=this.provider)===null||r===void 0?void 0:r.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof zt?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,n,r,o,i;return{originContext:(n=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||n===void 0?void 0:n.call(t),originLevel1:(r=this.provider)===null||r===void 0?void 0:r.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,n,r,o){return G(this,void 0,void 0,function*(){var i,s;let a=Object.assign(Object.assign(Object.assign({},n),yield this.getBaseEventRequest(Object.assign(Object.assign({},r),o))),{searchQueryUid:(s=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&s!==void 0?s:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}};m();d();p();f();var uR=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},ur=class{constructor(t){ce(this,"getState",t);ce(this,"state");this.state=t()}getLanguage(){return uR(this.state)}getBaseMetadata(){let{context:t,configuration:n}=this.state,r=t?.contextValues||{},o={};for(let[i,s]of Object.entries(r)){let a=`context_${i}`;o[a]=s}return n.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=ro),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||io()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};m();d();p();f();var ho=e=>new zt(e).getCurrentVisitorId(),Ni=(e,t)=>typeof t=="function"?(...n)=>{let r=oi(n[0]);try{return t.apply(t,n)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),r}}:void 0,Fi=(e,t)=>(...n)=>{let r=oi(n[1]);try{return t.apply(t,n)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),r}};var Di=class extends ur{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Oh=({logger:e,getState:t,analyticsClientMiddleware:n=(s,a)=>a,preprocessRequest:r,provider:o=new Di(t),disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,u=s.configuration.analytics.apiBaseUrl??at(s.configuration.organizationId,s.configuration.environment,"analytics"),c=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,y=new Ta({enableAnalytics:g,token:a,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ni(e,r),beforeSendHooks:[Fi(e,n),(E,h)=>(e.info({...h,type:E,endpoint:u,token:a},"Analytics request"),h)]},o);return g||y.disable(),y};m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function ka(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();p();f();m();d();p();f();m();d();p();f();function Ph(e){let{activeValue:t,ancestryMap:n}=fR(e);return t?pR(t,n):[]}function fR(e){let t=[...e],n=new Map;for(;t.length>0;){let r=t.shift();if(r.state==="selected")return{activeValue:r,ancestryMap:n};if(n)for(let o of r.children)n.set(o,r);t.unshift(...r.children)}return{}}function pR(e,t){let n=[];if(!e)return[];let r=e;do n.unshift(r),r=t.get(r);while(r);return n}var mR=(e,t)=>e.categoryFacetSet[t]?.request;var xd=(e,t)=>{let n=mR(e,t);return Ph(n?.currentValues??[])};m();d();p();f();function _a(){return{}}m();d();p();f();function Oa(){return{}}m();d();p();f();function Pa(){return{}}m();d();p();f();function Na(){return{}}function Id(e){return{facetSet:e.facetSet??Na(),categoryFacetSet:e.categoryFacetSet??_a(),dateFacetSet:e.dateFacetSet??Oa(),numericFacetSet:e.numericFacetSet??Pa(),automaticFacetSet:e.automaticFacetSet??ka()}}var Rd=e=>{let t=[];return yR(e).forEach((n,r)=>{let o=xR(e,n.facetId),i=CR(n,r+1);if(hR(n)){if(!!!xd(e,n.facetId).length)return;t.push({...i,...AR(e,n.facetId),facetType:o,state:"selected"});return}n.currentValues.forEach((s,a)=>{if(s.state==="idle")return;let u=Nh(s,a+1,o),c=gR(n)?Fh(s):SR(s);t.push({...i,...u,...c})})}),vR(e).forEach((n,r)=>{let o=wR(n,r+1);n.values.forEach((i,s)=>{if(i.state==="idle")return;let a=Nh(i,s+1,"specific"),u=Fh(i);t.push({...o,...a,...u})})}),t},gR=e=>e.type==="specific",hR=e=>e.type==="hierarchical",yR=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),vR=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Nh=(e,t,n)=>({state:e.state,valuePosition:t,facetType:n}),SR=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Fh=e=>({displayValue:e.value,value:e.value}),bR=(e,t)=>xd(e,t).map(r=>r.value).join(";"),AR=(e,t)=>{let r=bR(e,t);return{value:r,valuePosition:1,displayValue:r}},wR=(e,t)=>({title:Dh(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),CR=(e,t)=>({title:Dh(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Dh=(e,t)=>`${e}_${t}`,ER=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,xR=(e,t)=>{let n=ER(e,t);return n?n.type:"specific"};m();d();p();f();m();d();p();f();var Td=e=>e.configuration.search.locale,Mh=e=>e.configuration.search.timezone,Lh=e=>e.configuration.accessToken,jh=e=>e.configuration.organizationId,qh=e=>e.configuration.environment,Fa=e=>e.configuration?.knowledge?.agentId,Uh=e=>e.configuration.knowledge.debugAgentSession;var Me=e=>{if(IR(e)||kd(e))return e.generatedAnswer?.answerId;if(RR(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},IR=e=>"answer"in e&&"generatedAnswer"in e&&!ue(e.generatedAnswer?.answerConfigurationId),kd=e=>{let t=Fa(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},RR=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",_d=e=>e.generatedAnswer?.fieldsToIncludeInCitations,xn=e=>e.followUpAnswers?.conversationId,TR=e=>e.generatedAnswer?.citations,kR=e=>e.followUpAnswers?.followUpAnswers,_R=Qe(kR,e=>e?.flatMap(t=>t.citations)),OR=(e,t)=>t,yo=Qe(TR,_R,OR,(e,t,n)=>e?.find(r=>r.id===n)??t?.find(r=>r.id===n));m();d();p();f();var qt=()=>({q:"",enableQuerySyntax:!1});m();d();p();f();function Od(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Wt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Od(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Od(),extendedResults:{},searchAction:void 0}}m();d();p();f();m();d();p();f();m();d();p();f();var Vh=(n=>(n.Ascending="ascending",n.Descending="descending",n))(Vh||{}),Gh=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Gh||{}),Pd=e=>{if(am(e))return e.map(t=>Pd(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""}},Bh=()=>({by:"relevancy"});var Q2=new Re({values:{by:new pl({enum:Gh,required:!0}),order:new pl({enum:Vh}),field:new te}});function Da(){return Pd(Bh())}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function PR(){return typeof navigator<"u"}function $h(){try{return typeof localStorage<"u"}catch{return!1}}function Hh(){try{return typeof sessionStorage<"u"}catch{return!1}}function Qh(){return PR()&&navigator.cookieEnabled}m();d();p();f();var lr=class e{static set(t,n,r){let o;r&&(o=new Date,o.setTime(o.getTime()+r)),Nd(t,n,o,NR(window.location.hostname))}static get(t){for(var n=t+"=",r=document.cookie.split(";"),o=0;o<r.length;o++){var i=r[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function NR(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let n=2;n<=t.length;n++){let r=t.slice(-n).join(".");if(FR(r))return r}}function FR(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Nd(t,"1",void 0,e),lr.get(t)==="1"}catch{return!1}finally{try{Nd(t,"",new Date(0),e)}catch{}}}function Nd(e,t,n,r){document.cookie=`${e}=${t}`+(n?`;expires=${n.toUTCString()}`:"")+(r?`;domain=${r}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function zh(){return $h()?localStorage:Qh()?new Ma:Hh()?sessionStorage:new Fd}var Ma=class e{getItem(t){return lr.get(`${e.prefix}${t}`)}removeItem(t){lr.erase(`${e.prefix}${t}`)}setItem(t,n,r){lr.set(`${e.prefix}${t}`,n,r)}};Ma.prefix="coveo_";var Fd=class{getItem(t){return null}removeItem(t){}setItem(t,n){}};var La="__coveo.analytics.history",DR=20,MR=1e3*60,LR=75,ja=class{constructor(t){this.store=t||zh()}addElement(t){t.internalTime=(new Date).getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let n=this.getHistoryWithInternalTime();n!=null?this.isValidEntry(t)&&this.setHistory([t].concat(n)):this.setHistory([t])}addElementAsync(t){var _this4=this;return _asyncToGenerator(function*(){t.internalTime=(new Date).getTime(),t=_this4.cropQueryElement(_this4.stripEmptyQuery(t));let n=yield _this4.getHistoryWithInternalTimeAsync();n!=null?_this4.isValidEntry(t)&&_this4.setHistory([t].concat(n)):_this4.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this5=this;return _asyncToGenerator(function*(){let t=yield _this5.getHistoryWithInternalTimeAsync();return _this5.stripEmptyQueries(_this5.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(La);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this6=this;return _asyncToGenerator(function*(){try{let t=yield _this6.store.getItem(La);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(La,JSON.stringify(t.slice(0,DR)))}catch{}}clear(){try{this.store.removeItem(La)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((r,o)=>(o.internalTime||0)-(r.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,LR)),t}isValidEntry(t){let n=this.getMostRecentElement();return n&&n.value==t.value?(t.internalTime||0)-(n.internalTime||0)>MR:!0}stripInternalTime(t){return Array.isArray(t)?t.map(n=>{let{name:r,time:o,value:i}=n;return{name:r,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:n,time:r,value:o}=t;return n&&typeof o=="string"&&n.toLowerCase()==="query"&&o.trim()===""?{name:n,time:r}:t}stripEmptyQueries(t){return t.map(n=>this.stripEmptyQuery(n))}};var dr=class dr extends ja{static getInstance(t){return dr.instance||(dr.instance=new dr(t)),dr.instance}constructor(t){super(t)}};ce(dr,"instance",null);var At=dr;var Mi=class Mi extends ur{constructor(){super(...arguments);ce(this,"getFacetRequest",n=>this.state.facetSet?.[n]?.request||this.state.categoryFacetSet?.[n]?.request||this.state.dateFacetSet?.[n]?.request||this.state.numericFacetSet?.[n]?.request||this.state.automaticFacetSet?.set[n]?.response)}getFacetState(){return Rd(Id(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Mi.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let n=this.getState();return n.search?.searchResponseId||n.search?.response.searchUid||Wt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let n=!!this.getSplitTestRunName(),r=this.state.search?.response.pipeline||this.state.pipeline||Mi.fallbackPipelineName;return n?r:void 0}getBaseMetadata(){let n=this.getState(),r=super.getBaseMetadata(),o=Me(n);return o&&(r.generativeQuestionAnsweringId=o),r}getFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,facetValue:r,facetTitle:`${i}_${n}`}}getFacetClearAllMetadata(n){let o=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:o,facetTitle:`${o}_${n}`}}getFacetUpdateSortMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,criteria:r,facetTitle:`${i}_${n}`}}getRangeBreadcrumbFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),facetId:n,facetField:i,facetRangeEnd:r.end,facetRangeEndInclusive:r.endInclusive,facetRangeStart:r.start,facetTitle:`${i}_${n}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??Da()}}getStaticFilterToggleMetadata(n,r){return{...this.getBaseMetadata(),staticFilterId:n,staticFilterValue:r}}getStaticFilterClearAllMetadata(n){return{...this.getBaseMetadata(),staticFilterId:n}}getUndoTriggerQueryMetadata(n){return{...this.getBaseMetadata(),undoneQuery:n}}getCategoryBreadcrumbFacetMetadata(n,r){let i=this.getFacetRequest(n)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:n,categoryFacetField:i,categoryFacetPath:r,categoryFacetTitle:`${i}_${n}`}}getOmniboxAnalyticsMetadata(n,r){let o=this.state.querySuggest?.[n],i=o.completions.map(c=>c.expression),s=o.partialQueries.length-1,a=o.partialQueries[s]||"",u=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(r),partialQuery:a,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(n){return{...this.getBaseMetadata(),...n}}getGeneratedAnswerMetadata(){let n=this.getState(),r={};return n.generatedAnswer?.isVisible!==void 0&&(r.showGeneratedAnswer=n.generatedAnswer.isVisible),r}get resultURIs(){return this.results?.map(n=>({documentUri:n.uri,documentUriHash:n.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||qt().q}get responseTime(){return this.state.search?.duration||Wt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Wt().response.totalCountFiltered}};ce(Mi,"fallbackPipelineName","default");var In=Mi,Wh=({logger:e,getState:t,analyticsClientMiddleware:n=(s,a)=>a,preprocessRequest:r,provider:o,disableBrowserPrivacySignals:i})=>{let s=t(),a=s.configuration.accessToken,u=s.configuration.analytics.apiBaseUrl??at(s.configuration.organizationId,s.configuration.environment,"analytics"),c=s.configuration.analytics.runtimeEnvironment,g=s.configuration.analytics.enabled,y=new Ea({token:a,endpoint:u,runtimeEnvironment:c,disableBrowserPrivacySignals:i,preprocessRequest:Ni(e,r),beforeSendHooks:[Fi(e,n),(E,h)=>(e.info({...h,type:E,endpoint:u,token:a},"Analytics request"),h)]},o);return g||y.disable(),y},Dd=()=>{let t=At.getInstance().getHistory().reverse().find(n=>n.name==="PageView"&&n.value);return t?t.value:""};m();d();p();f();function Kh(e){let t=Yh(e),n=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return Xp([e,...t,...n],o=>o.uniqueId)}function Yh(e){return e.childResults?e.childResults.flatMap(t=>[t,...Yh(t)]):[]}m();d();p();f();var vo=()=>"";function Zh(e,t){return{...new In(t).getBaseMetadata(),actionCause:e,type:e}}function jR(e){return Object.assign(e,{instantlyCallable:!0})}function qR(e,t){let n=i=>{let s=Te(e,i);return jR(Object.assign(s,{type:s.typePrefix}))},r=n(/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(i,{getState:s,extra:a}){let{analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y}=a;return yield(yield t({getState:s,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y})).log({state:s(),extra:a})});return function(_x42,_x43){return _ref8.apply(this,arguments)}}());return Object.assign(r,{prepare:function(){var _prepare=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u,disableBrowserPrivacySignals:c}){let{description:g,log:y}=yield t({getState:i,analyticsClientMiddleware:s,preprocessRequest:a,logger:u,disableBrowserPrivacySignals:c});return{description:g,action:n(/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(E,{getState:h,extra:v}){return yield y({state:h(),extra:v})});return function(_x45,_x46){return _ref9.apply(this,arguments)}}())}});function prepare(_x44){return _prepare.apply(this,arguments)}return prepare}()}),r}var Jh=(e,t,n)=>{function r(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:n}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:n};return GR(i)}return r},UR=e=>e.configuration.analytics.analyticsMode==="legacy",VR=e=>e.configuration.analytics.analyticsMode==="next",GR=({prefix:e,__legacy__getBuilder:t,__legacy__provider:n,analyticsPayloadBuilder:r,analyticsType:o,analyticsConfigurator:i,providerClass:s})=>(n??(n=a=>new s(a)),qR(e,/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:u,preprocessRequest:c,logger:g,disableBrowserPrivacySignals:y}){let E=[],h={log:function(){var _log=_asyncToGenerator(function*({state:k}){for(let O of E)yield O(k)});function log(_x48){return _log.apply(this,arguments)}return log}()},v=a(),A=i({getState:a,logger:g,analyticsClientMiddleware:u,preprocessRequest:c,disableBrowserPrivacySignals:y,provider:n(a)}),C=yield t(A,a());h.description=C?.description,E.push(/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(k){UR(k)&&(yield BR(C,n,k,g,A.coveoAnalyticsClient))});return function(_x49){return _ref1.apply(this,arguments)}}());let{emit:w}=wi(v);return E.push(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(k){if(VR(k)&&o&&r){let O=r(k);yield XR(w,o,O)}});return function(_x50){return _ref10.apply(this,arguments)}}()),h});return function(_x47){return _ref0.apply(this,arguments)}}()));function BR(_x51,_x52,_x53,_x54,_x55){return _BR.apply(this,arguments)}function _BR(){_BR=_asyncToGenerator(function*(e,t,n,r,o){t(()=>n);let i=yield e?.log({searchUID:t(()=>n).getSearchUID()});r.info({client:o,response:i},"Analytics response")});return _BR.apply(this,arguments)}var $R=e=>n=>(r,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _log2=_asyncToGenerator(function*(i){n(r,o)});function log(_x56){return _log2.apply(this,arguments)}return log}()}),Ne=Jh(e=>Wh({...e,provider:e.provider||new In(e.getState)}),e=>e,In),wt=Jh(Oh,$R("caseAssist"),Di);var Md=(e,t)=>{let n=i=>i+(t.pagination?.firstResult??0),r=-1,o=t.search?.results;return r=sy(e,o),r<0&&(r=YR(e,o)),r<0&&(r=0),HR(e,n(r),t)};var ey=(e,t)=>({sourceName:ny(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||vo()}),ty=(e,t)=>({sourceName:ny(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||vo()});function ny(e){let t=e.source;return ue(t)?"unknown":t}var ry=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function HR(e,t,n){let r=e.raw.collection;return{collectionName:typeof r=="string"?r:"default",documentAuthor:WR(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:KR(e),queryPipeline:n.pipeline||vo()}}function Xh(e){return e.raw?.objecttype||void 0}var Ld=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 te,sourcetype:new te,permanentid:new te},iy={uniqueId:J,raw:new Re({values:oy}),title:J,uri:J,clickUri:J,rankingModifier:new te({required:!1,emptyAllowed:!0})};function QR(e){return Object.assign({},...Object.keys(oy).map(t=>({[t]:e[t]})))}function zR(e){return Object.assign({},...Object.keys(iy).map(t=>({[t]:e[t]})),{raw:QR(e.raw)})}function WR(e){let t=e.raw.author;return ue(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function KR(e){let t=e.raw.source;return ue(t)?"unknown":t}var jd=e=>new Mt(iy).validate(zR(e));function YR(e,t){for(let[n,r]of t.entries()){let o=Kh(r);if(sy(e,o)!==-1)return n}return-1}function sy(e,t=[]){return t.findIndex(({uniqueId:n})=>n===e.uniqueId)}function XR(_x57,_x58,_x59){return _XR.apply(this,arguments)}function _XR(){_XR=_asyncToGenerator(function*(e,t,n){yield e(t,n)});return _XR.apply(this,arguments)}m();d();p();f();var qa=e=>{if(e==="yes")return!0;if(e==="no")return!1},ZR=()=>Ne("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function JR(e,t){return Ne({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(n,r)=>{let o=t??Me(r),i=yo(r,e);if(!o||!i)return null;let s=xn(r);return n.makeGeneratedAnswerCitationClick(ey(i,r),{generativeQuestionAnsweringId:o,citationId:i.id,documentId:ry(i),...(s&&{conversationId:s})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:n=>{let r=yo(n,e);return{answerId:t??Me(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}})}function eT(e,t,n){return Ne({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,o)=>{let i=n??Me(o),s=yo(o,e);if(!i||!s)return null;let a=xn(o);return r.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:i,permanentId:s.permanentid,citationId:s.id,citationHoverTimeMs:t,...(a&&{conversationId:a})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let o=yo(r,e);return{answerId:n??Me(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function tT(e,t){return Ne({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:n=>n.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function nT(e){return Ne({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,n)=>{let r=e??Me(n);if(!r)return null;let o=xn(n);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"like"})})}function rT(e){return Ne({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,n)=>{let r=e??Me(n);if(!r)return null;let o=xn(n);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"dislike"})})}var oT=e=>Ne({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,n)=>{let r=Me(n);return r?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:r,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let n=Me(t),{helpful:r,readable:o,documented:i,hallucinationFree:s,correctTopic:a,documentUrl:u,details:c}=e;return{answerId:n??"",helpful:r,details:{readable:qa(o),documented:qa(i),correctTopic:qa(a),hallucinationFree:qa(s)},additionalNotes:c,correctAnswerUrl:u}}}),qd=(e,t,n)=>Ne({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(r,o)=>{let i=t??Me(o);if(!i)return null;let s=xn(o);return r.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:i,answerGenerated:e,answerTextIsEmpty:n,...(s&&{conversationId:s})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:r=>({answerId:t??Me(r)??"",answerGenerated:e??!1})}),So=e=>Ne({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),iT=()=>Ne({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let n=Me(t);return n?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"show"})}),sT=()=>Ne({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let n=Me(t);return n?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"hide"})}),aT=()=>Ne({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let n=Me(t);return n?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"expand"})}),cT=()=>Ne({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let n=Me(t);return n?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:n}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Me(e)??"",action:"collapse"})});function uT(e){return Ne({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,n)=>{let r=e??Me(n);if(!r)return null;let o=xn(n);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Me(t)??"",action:"copyToClipboard"})})}function lT(e,t){return Ne({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(n,r)=>{let o=yo(r,e);if(!o)return null;let i=xn(r);return i?n.makeGeneratedAnswerFollowupOpenSource({...ty(o,r),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:i}):null}})}var Ua={logCopyGeneratedAnswer:uT,logGeneratedAnswerHideAnswers:sT,logGeneratedAnswerShowAnswers:iT,logGeneratedAnswerStreamEnd:qd,logGeneratedAnswerFeedback:oT,logDislikeGeneratedAnswer:rT,logLikeGeneratedAnswer:nT,logGeneratedAnswerOpenInlineLink:tT,logHoverCitation:eT,logOpenGeneratedAnswerSource:JR,logOpenGeneratedAnswerFollowUpSource:lT,logRetryGeneratedAnswer:ZR,logGeneratedAnswerExpand:aT,logGeneratedAnswerCollapse:cT};m();d();p();f();m();d();p();f();var ay=Qe(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:n,dq:r,lq:o}=e;return{...(t&&{aq:t}),...(n&&{cq:n}),...(r&&{dq:r}),...(o&&{lq:o})}});m();d();p();f();var fr=(e,t,n)=>({analytics:{clientId:t.clientId,clientTimestamp:(new Date).toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(n&&{actionCause:n.actionCause}),...(n&&{customData:n.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:so(e)}});m();d();p();f();var Ud=e=>e.context;m();d();p();f();var Vd=e=>e.pipeline;m();d();p();f();m();d();p();f();var ji=Dt(Va(),1),py=Dt(cy(),1);m();d();p();f();var ly=Dt(Va(),1),dy=Dt(uy(),1);ly.default.extend(dy.default);var dT="YYYY/MM/DD@HH:mm:ss";function fy(e){return e.format(dT)}ji.default.extend(py.default);var fT=["past","now","next"],pT=["minute","hour","day","week","month","quarter","year"];function mT(e){let{period:t,amount:n,unit:r}=e;switch(t){case"past":return(0,ji.default)().subtract(n,r);case"next":return(0,ji.default)().add(n,r);case"now":return(0,ji.default)()}}function Wd(e){return fy(mT(gT(e)))}function my(e){return e.toLocaleLowerCase().split("-")}function Kd(e){let[t,n,r]=my(e);if(t==="now")return!0;if(!fT.includes(t)||!pT.includes(r))return!1;let o=parseInt(n,10);return!(Number.isNaN(o)||o<=0)}function gT(e){let[t,n,r]=my(e);return t==="now"?{period:"now"}:{period:t,amount:n?parseInt(n,10):void 0,unit:r||void 0}}m();d();p();f();function gy(e){return e.type==="dateRange"}function hy(e){return`start${e}`}function yy(e){return`end${e}`}var Yd=()=>({dateFacetValueMap:{}});function hT(e,t,n){let r=e.start,o=e.end;return Kd(r)&&(r=Wd(r),n.dateFacetValueMap[t][hy(r)]=e.start),Kd(o)&&(o=Wd(o),n.dateFacetValueMap[t][yy(o)]=e.end),{...e,start:r,end:o}}function Xd(e,t){if(gy(e)){let{facetId:n,currentValues:r}=e;return t.dateFacetValueMap[n]={},{...e,currentValues:r.map(o=>hT(o,n,t))}}return e}function Rn(e){let t=Yd();return{request:{...e,facets:e.facets?.map(r=>Xd(r,t))},mappings:t}}function yT(e,t,n){return{...e,start:n.dateFacetValueMap[t][hy(e.start)]||e.start,end:n.dateFacetValueMap[t][yy(e.end)]||e.end}}function vT(e,t){return e.facetId in t.dateFacetValueMap}function ST(e,t){return vT(e,t)?{...e,values:e.values.map(n=>yT(n,e.facetId,t))}:e}function Ga(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(r=>ST(r,t))}}:e}m();d();p();f();m();d();p();f();m();d();p();f();function Tn(e){return Object.values(e).map(t=>t.request)}function Zd(e,t){let n={};e.forEach(i=>{n[i.facetId]=i});let r=[];t.forEach(i=>{i in n&&(r.push(n[i]),delete n[i])});let o=Object.values(n);return[...r,...o]}function vy(e){return Tn(e).map(t=>{let r=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!r?{...t,currentValues:[]}:t})}var Jd={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function bT(e){return Tn(e).map(t=>{let n=Jd[t.sortCriteria];return n?{...t,sortCriteria:n}:t})}function AT(e){return[...bT(e.facetSet??{}),...vy(e.numericFacetSet??{}),...vy(e.dateFacetSet??{}),...Tn(e.categoryFacetSet??{})]}function wT(e){return AT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Ba(e){return Zd(wT(e),e.facetOrder??[])}m();d();p();f();m();d();p();f();m();d();p();f();var Sy=/*#__PURE__*/function(){var _Sy=_asyncToGenerator(function*(e,t){let n=e.analyticsMode==="next";return{analytics:{clientId:yield ho(e),clientTimestamp:(new Date).toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!n&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Dd()&&{pageId:Dd()}),...(n&&e.trackingId&&{trackingId:e.trackingId}),capture:n,...(n&&{source:so(e)})}}});function Sy(_x60,_x61){return _Sy.apply(this,arguments)}return Sy}();var bo=/*#__PURE__*/function(){var _bo=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Qr(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:At.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Sy(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 bo(_x62,_x63){return _bo.apply(this,arguments)}return bo}();m();d();p();f();var $a=(e,t,n)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Qr(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&&fr(e.configuration.analytics,t,n)),...(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 by=Qe(e=>e.staticFilterSet,e=>Object.values(e||{}).map(n=>{let r=n.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=r.map(i=>i.expression).join(" OR ");return r.length>1?`(${o})`:o}));var kn=/*#__PURE__*/function(){var _kn=_asyncToGenerator(function*(e,t,n){let r=tf(e),o=CT(e),i=ET(e),s=e.configuration.analytics.analyticsMode==="legacy"?yield bo(e,n):$a(e,t,n);return Rn({...s,...(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}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:ef(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 kn(_x64,_x65,_x66){return _kn.apply(this,arguments)}return kn}();function ef(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function CT(e){return Zd(IT(e),e.facetOrder??[])}function ET(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(n=>n.response).map(xT).filter(n=>n.currentValues.length>0):void 0}function xT(e){let{field:t,label:n,values:r}=e,o=r.filter(i=>i.state==="selected");return{field:t,label:n,currentValues:o}}function IT(e){return RT(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function RT(e){return[...TT(e.facetSet??{}),...Ay(e.numericFacetSet??{}),...Ay(e.dateFacetSet??{}),...Tn(e.categoryFacetSet??{})]}function TT(e){return Tn(e).map(t=>{let n=Jd[t.sortCriteria];return n?{...t,sortCriteria:n}:t})}function Ay(e){return Tn(e).map(t=>{let n=t.currentValues,r=n.some(({state:i})=>i!=="idle"),o=n.some(i=>i.previousState);return t.generateAutomaticRanges&&!r&&!o?{...t,currentValues:[]}:t})}function tf(e){let t=e.advancedSearchQueries?.cq.trim()||"",r=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=by(e);return[t,r,...o].filter(i=>!!i).join(" AND ")}m();d();p();f();m();d();p();f();var Ui=(e,t)=>{let n=e;return ue(n[t])?ue(e.raw[t])?null:e.raw[t]:n[t]},kT=e=>t=>e.every(n=>!ue(Ui(t,n))),_T=e=>t=>e.every(n=>ue(Ui(t,n))),OT=(e,t)=>n=>{let r=wy(e,n);return t.some(o=>r.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},PT=(e,t)=>n=>{let r=wy(e,n);return t.every(o=>r.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},wy=(e,t)=>{let n=Ui(t,e);return Yp(n)?n:[n]},Cy={getResultProperty:Ui,fieldsMustBeDefined:kT,fieldsMustNotBeDefined:_T,fieldMustMatch:OT,fieldMustNotMatch:PT};var nf=Qe(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();p();f();var rf=e=>e.searchHub;m();d();p();f();var Ha=Qe(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),fH=Qe(e=>e,e=>{let t=Ha(e);return t&&e?e[t].expression:""});m();d();p();f();var Ey=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();p();f();var xy=e=>e.excerptLength?.length;m();d();p();f();var Iy=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();p();f();var Ry=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 Ty=e=>e.sortCriteria;var ky=/*#__PURE__*/function(){var _ky=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Hr(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});function ky(_x67){return _ky.apply(this,arguments)}return ky}(),_y=(e,t)=>{let n=ar(e)?.q,{aq:r,cq:o,dq:i,lq:s}=Ny(e),a=Ud(e),u=fr(e.configuration.analytics,t,{actionCause:nf(e)}),c=rf(e),g=Vd(e),y=_d(e)??[],E=Py(e),h=Ha(e.tabSet)||"default",v=Td(e),A=Mh(e),C=t.referrer||"",w=Iy(e),k=Ty(e),O=NT(e),F=xy(e),b=Ry(e),T=Ey(e);return{q:n,...(r&&{aq:r}),...(o&&{cq:o}),...(i&&{dq:i}),...(s&&{lq:s}),...(e.query&&{enableQuerySyntax:lh(e)}),...(a?.contextValues&&{context:a.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...(c?.length&&{searchHub:c}),...(g?.length&&{pipeline:g}),...(E.length&&{facets:E}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:ef(e),firstResult:e.pagination.firstResult}),tab:h,locale:v,timezone:A,...(e.debug!==void 0&&{debug:e.debug}),referrer:C,...O,...(b??{}),...(F&&{excerptLength:F}),...(T&&{dictionaryFieldContext:T}),sortCriteria:k,...(w&&{facetOptions:w}),...u,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Oy=(e,t)=>{let n=ar(e)?.q,r=Py(e),o=fr(e.configuration.analytics,t,{actionCause:nf(e)}),i=Td(e),s=Ha(e.tabSet)||"default",a=t.referrer,{aq:u,cq:c}=Ny(e),g=rf(e),y=Vd(e),E=Ud(e),h=_d(e)??[];return{q:n||"",...(r.length&&{facets:r}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(y?.length&&{pipeline:y}),...(E?.contextValues&&{context:E.contextValues}),...(u&&{aq:u}),...(c&&{cq:c}),tab:s,referrer:a,...o,locale:i}},Py=e=>Ba(e)?.map(t=>Xd(t,Yd())).sort((t,n)=>t.facetId>n.facetId?1:n.facetId>t.facetId?-1:0),NT=e=>({actionsHistory:e.configuration.analytics.enabled?At.getInstance().getHistory():[]}),Ny=e=>{let t=ay(e),n=tf(e);return{...t,...(n&&{cq:n})}};m();d();p();f();var Qa=["searching","thinking","answering"];function za(e){return e.toLowerCase()}var Wa=["search","generic"];m();d();p();f();var Fy=["text/plain","text/markdown"];var Ao=new te({required:!0}),Dy=new te,wo=new Ve({required:!0}),of={id:Ao,title:Ao,uri:Ao,permanentid:Ao,clickUri:Dy},Ka=new te({required:!0,constrainTo:Fy}),My=new te({required:!0,constrainTo:Qa}),Ly=e=>({...e,name:za(e.name)}),PQ=$("generatedAnswer/setIsVisible",e=>K(e,wo)),Ya=$("generatedAnswer/setAnswerId",e=>K(e,J)),NQ=$("generatedAnswer/setAnswerGenerationMode",e=>K(e,new te({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),FQ=$("generatedAnswer/setIsEnabled",e=>K(e,wo)),Gi=$("generatedAnswer/updateMessage",e=>K(e,{textDelta:Ao})),Bi=$("generatedAnswer/updateCitations",e=>K(e,{citations:new Lt({required:!0,each:new Re({values:of})})})),$i=$("generatedAnswer/updateError",e=>K(e,{message:Dy,code:new qe({min:0})})),Xa=$("generatedAnswer/resetAnswer"),DQ=$("generatedAnswer/like"),MQ=$("generatedAnswer/dislike"),LQ=$("generatedAnswer/feedbackModal/open"),jQ=$("generatedAnswer/expand"),qQ=$("generatedAnswer/collapse"),UQ=$("generatedAnswer/setId",e=>K(e,{id:new te({required:!0})})),VQ=$("generatedAnswer/feedbackModal/close"),GQ=$("generatedAnswer/sendFeedback"),_n=$("generatedAnswer/setIsLoading",e=>K(e,wo)),Vi=$("generatedAnswer/setIsStreaming",e=>K(e,wo)),Hi=$("generatedAnswer/setAnswerContentFormat",e=>K(e,Ka)),BQ=$("generatedAnswer/updateResponseFormat",e=>K(e,{contentFormat:new Lt({each:Ka,default:["text/plain"]})})),$Q=$("knowledge/updateAnswerConfigurationId",e=>K(e,Ao)),HQ=$("generatedAnswer/registerFieldsToIncludeInCitations",e=>K(e,ng)),sf=$("generatedAnswer/setIsAnswerGenerated",e=>K(e,wo)),Qi=$("generatedAnswer/setCannotAnswer",e=>K(e,wo)),FT=$("generatedAnswer/setAnswerApiQueryParams",e=>K(e,new Re({}))),jy=$("generatedAnswer/startStep",e=>K(Ly(e),{name:My,startedAt:new qe({min:0,required:!0})})),qy=$("generatedAnswer/finishStep",e=>K(Ly(e),{name:My,finishedAt:new qe({min:0,required:!0})})),Uy=$("generatedAnswer/startToolCall",e=>K(e,{toolCallName:J,startedAt:new qe({min:0,required:!0}),toolCallId:J})),Vy=$("generatedAnswer/finishToolCall",e=>K(e,{finishedAt:new qe({min:0,required:!0}),toolCallId:J})),Za=$("generatedAnswer/toolCallArgs",e=>K(e,{toolCallId:J,args:new Re({options:{required:!0}}),type:new te({required:!0,constrainTo:Wa})})),QQ=Te("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(e,t){let n=t.getState(),{dispatch:r,extra:o,getState:i}=t,{generatedAnswerAnalyticsClient:s}=o,{search:a}=i(),{queryExecuted:u}=a,{setAbortControllerRef:c}=e,g=yield ky(n),y=(v,A)=>{switch(v){case"genqa.headerMessageType":{let C=JSON.parse(A);r(Hi(C.contentFormat));break}case"genqa.messageType":r(Gi(JSON.parse(A)));break;case"genqa.citationsType":r(Bi(JSON.parse(A)));break;case"genqa.endOfStreamType":{let C=JSON.parse(A).answerGenerated,{answerId:w,answer:k}=i().generatedAnswer,F=u.length!==0&&!C,b=!k?.trim();r(Qi(F)),r(Vi(!1)),r(sf(C)),r((s??Ua).logGeneratedAnswerStreamEnd(C,w,C?b:void 0)),r(So());break}default:n.debug&&o.logger.warn(`Unknown payloadType: "${v}"`)}};r(_n(!0));let E=v=>v.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:v=>{E(g)&&(r(_n(!1)),v.payload&&v.payloadType&&y(v.payloadType,v.payload))},abort:v=>{E(g)&&r($i(v))},close:()=>{E(g)&&r(Vi(!1))},resetAnswer:()=>{E(g)&&r(Xa())}});h?c(h):r(_n(!1))});return function(_x68,_x69){return _ref11.apply(this,arguments)}}()),zQ=Te("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(e,{getState:t,dispatch:n,extra:{navigatorContext:r,logger:o}}){n(Xa());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 s=_y(i,r);n(FT(s)),yield n(Gy(s))}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(_x70,_x71){return _ref12.apply(this,arguments)}}());m();d();p();f();m();d();p();f();function $y(_x72,_x73){return _$y.apply(this,arguments)}function _$y(){_$y=_asyncToGenerator(function*(e,t){let n=e.getReader(),r;for(;!(r=yield n.read()).done;)t(r.value)});return _$y.apply(this,arguments)}function Hy(e){let t,n,r,o=!1;return function(s){t===void 0?(t=s,n=0,r=-1):t=MT(t,s);let a=t.length,u=0;for(;n<a;){o&&(t[n]===10&&(u=++n),o=!1);let c=-1;for(;n<a&&c===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-u);break;case 13:o=!0,c=n;break;case 10:c=n;break}if(c===-1)break;e(t.subarray(u,c),r),u=n,r=-1}u===a?t=void 0:u!==0&&(t=t.subarray(u),n-=u)}}function Qy(e,t,n){let r=By(),o=new TextDecoder;return function(s,a){if(s.length===0)n?.(r),r=By();else if(a>0){let u=o.decode(s.subarray(0,a)),c=a+(s[a+1]===32?2:1),g=o.decode(s.subarray(c));switch(u){case"data":r.data=r.data?`${r.data}
32
+ ${g}`:g;break;case"event":r.event=g;break;case"id":e(r.id=g);break;case"retry":DT(g,r,t);break}}}}function DT(e,t,n){let r=parseInt(e,10);Number.isNaN(r)||n(t.retry=r)}function MT(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function By(){return{data:"",event:"",id:"",retry:void 0}}var af="text/event-stream",LT=1e3,zy="last-event-id";function Wy(){return typeof window<"u"}function Ky(e,{signal:t,headers:n,onopen:r,onmessage:o,onclose:i,onerror:s,openWhenHidden:a,fetch:u,...c}){return new Promise((g,y)=>{let E={...n};E.accept||(E.accept=af);let h;function v(){h?.abort(),document.hidden||F()}!a&&Wy()&&document.addEventListener("visibilitychange",v);let A=LT,C;function w(){Wy()&&document.removeEventListener("visibilitychange",v),clearTimeout(C),h?.abort()}t?.addEventListener("abort",()=>{w(),g()});let k=u??I,O=r??jT;function F(){return _F2.apply(this,arguments)}function _F2(){_F2=_asyncToGenerator(function*(){h=l.AbortController?new l.AbortController:null;try{let b=yield k(e,{...c,headers:E,signal:h?.signal});yield O(b),yield $y(b.body,Hy(Qy(T=>{T?E[zy]=T:delete E[zy]},T=>{A=T},o))),i?.(),w(),g()}catch(b){if(!h?.signal?.aborted)try{let T=s?.(b)??A;clearTimeout(C),C=setTimeout(F,T)}catch(T){w(),y(T)}}});return _F2.apply(this,arguments)}F()})}function jT(e){let t=e.headers.get("content-type");if(!t?.startsWith(af))throw new Error(`Expected content-type to be ${af}, Actual: ${t}`)}m();d();p();f();var qT=/*#__PURE__*/function(){var _qT=_asyncToGenerator(function*(e,t,n){let r=t.getState(),{accessToken:o,environment:i,organizationId:s}=r.configuration,a=r.generatedAnswer.answerConfigurationId,u={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let c=Hr(r.configuration.search?.apiBaseUrl,s,i);return Yg({baseUrl:`${c}/rest/organizations/${s}/answer/v1/configs/${a}`,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,E={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{E[h]=g[h]}),E.duplex="half",E.body=yield g.text(),I(y,E)});function fetchFn(_x77){return _fetchFn.apply(this,arguments)}return fetchFn}()})(u,{...t,signal:null},n)}catch(c){return{error:c}}});function qT(_x74,_x75,_x76){return _qT.apply(this,arguments)}return qT}(),Yy=uh({reducerPath:"answer",baseQuery:Zg(qT,{maxRetries:3}),endpoints:()=>({})});var UT=(e,t)=>{let{contentFormat:n}=t;e.contentFormat=n,e.isStreaming=!0,e.isLoading=!1},VT=(e,t)=>{let{textDelta:n}=t;if(typeof n!="string")return;let r=e.answer;!r?.trim()&&!n.trim()||(delete e.error,e.answer=r?.trim()?r.concat(n):n)},GT=(e,t)=>{delete e.error,e.citations=t.citations},BT=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},$T=(e,t)=>{let n=t.errorMessage||"Unknown error occurred";e.error={message:n,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${n} (code: ${t.code})`)},HT=(e,t,n,r)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&$T(t,o);let i=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":i.contentFormat&&(UT(t,i),n(Hi(i.contentFormat)));break;case"genqa.messageType":typeof i.textDelta=="string"&&(VT(t,i),n(Gi({textDelta:i.textDelta})));break;case"genqa.citationsType":i.citations&&(GT(t,i),n(Bi({citations:i.citations})));break;case"genqa.endOfStreamType":{BT(t,i);let s=t.answerId,a=i.answerGenerated??!1,u=a?!t.answer?.trim():void 0;n(r.logGeneratedAnswerStreamEnd(a,s,u)),n(So());break}}},QT=(e,t,n,r)=>{if(!e||!t||!n)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=r?`insight/v1/configs/${r}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${n}/generate`},cf=Yy.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:n})=>{let{analytics:r,...o}=n;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x78,_x79){return _asyncToGenerator(function*(t,{getState:n,cacheDataLoaded:r,updateCachedData:o,dispatch:i,extra:s}){yield r;let{configuration:a,generatedAnswer:u,insightConfiguration:c}=n(),{generatedAnswerAnalyticsClient:g}=s,{organizationId:y,environment:E,accessToken:h}=a,v=Hr(a.search.apiBaseUrl,y,E),A=QT(v,y,u.answerConfigurationId,c?.insightId);yield Ky(A,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:I,onopen:function(){var _onopen=_asyncToGenerator(function*(C){let w=C.headers.get("x-answer-id");w&&o(k=>{k.answerId=w,i(Ya(w))})});function onopen(_x80){return _onopen.apply(this,arguments)}return onopen}(),onmessage:C=>{o(w=>{HT(C,w,i,g??Ua)})},onerror:C=>{throw C},onclose:()=>{o(C=>{i(Qi(!C.generated))})}})}).apply(this,arguments)}})})}),Gy=e=>cf.endpoints.getAnswer.initiate(e);m();d();p();f();var Xy=Ke(ro,e=>e);m();d();p();f();function zT(e){let t=e.payload?.analyticsAction;return Zy(e)&&!ue(t)}function Zy(e){return"type"in e}var Jy=e=>t=>n=>{let r;zT(n)&&(r=n.payload.analyticsAction,delete n.payload.analyticsAction);let o=t(n);return Zy(n)&&(n.type==="search/executeSearch/fullfilled"&&r===void 0&&console.error("No analytics action associated with search:",n),n.type==="recommendation/get/fullfilled"&&r===void 0&&console.error("No analytics action associated with recommendation:",n),n.type==="productRecommendations/get/fullfilled"&&r===void 0&&console.error("No analytics action associated with product recommendation:",n)),r!==void 0&&e.dispatch(r),o};m();d();p();f();m();d();p();f();m();d();p();f();var $4=$("tab/register",e=>{let t=new Re({values:{id:J,expression:jt}});return K(e,t)}),ev=$("tab/updateActiveTab",e=>K(e,J));m();d();p();f();var Ja=Dt(Va(),1),rv=Dt(tv(),1),ov=Dt(nv(),1);Ja.default.extend(ov.default);Ja.default.extend(rv.default);var iv=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Ja.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 WT=/(^|; )Coveo-Pendragon=([^;]*)/,KT=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function sv(){return typeof window>"u"?!1:WT.exec(document.cookie)?.pop()||null}function av(){return typeof window>"u"?!1:KT.test(document.cookie)}var cv=Ke(iv(),e=>e.addCase(oo,(t,n)=>{YT(t,n.payload)}).addCase(ta,(t,n)=>{XT(t,n.payload)}).addCase(na,(t,n)=>{ZT(t,n.payload)}).addCase(ra,t=>{t.analytics.enabled=!1}).addCase(oa,t=>{t.analytics.enabled=!0}).addCase(pg,(t,n)=>{t.analytics.originLevel2=n.payload.originLevel2}).addCase(mg,(t,n)=>{t.analytics.originLevel3=n.payload.originLevel3}).addCase(ev,(t,n)=>{t.analytics.originLevel2=n.payload}).addCase(ag,(t,n)=>{t.analytics.originLevel2=n.payload}).addCase(Zs,(t,n)=>{ue(n.payload.tab)||(t.analytics.originLevel2=n.payload.tab)}).addCase(gg,(t,{payload:n})=>{JT(t,n)}));function YT(e,t){ue(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ue(t.organizationId)||(e.organizationId=t.organizationId)}function XT(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 ZT(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 n=sv();n&&(e.analytics.analyticsMode="next",e.analytics.trackingId=n)}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 JT(e,t){e.knowledge.agentId=t;try{av()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Ct=cv;m();d();p();f();function e0(e){return e.instantlyCallable}var uv=()=>e=>t=>e(e0(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 rt=[];for(let e=0;e<256;++e)rt.push((e+256).toString(16).slice(1));function lv(e,t=0){return(rt[e[t+0]]+rt[e[t+1]]+rt[e[t+2]]+rt[e[t+3]]+"-"+rt[e[t+4]]+rt[e[t+5]]+"-"+rt[e[t+6]]+rt[e[t+7]]+"-"+rt[e[t+8]]+rt[e[t+9]]+"-"+rt[e[t+10]]+rt[e[t+11]]+rt[e[t+12]]+rt[e[t+13]]+rt[e[t+14]]+rt[e[t+15]]).toLowerCase()}m();d();p();f();var pf,t0=new Uint8Array(16);function mf(){if(!pf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pf=crypto.getRandomValues.bind(crypto)}return pf(t0)}m();d();p();f();m();d();p();f();var n0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gf={randomUUID:n0};function r0(e,t,n){if(gf.randomUUID&&!t&&!e)return gf.randomUUID();e=e||{};let r=e.random??e.rng?.()??mf();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return lv(r)}var On=r0;m();d();p();f();m();d();p();f();var S={};ls(S,{BRAND:()=>k0,DIRTY:()=>pr,EMPTY_PATH:()=>a0,INVALID:()=>de,NEVER:()=>pk,OK:()=>dt,ParseStatus:()=>ot,Schema:()=>ve,ZodAny:()=>Fn,ZodArray:()=>yn,ZodBigInt:()=>gr,ZodBoolean:()=>hr,ZodBranded:()=>Wi,ZodCatch:()=>Rr,ZodDate:()=>yr,ZodDefault:()=>Ir,ZodDiscriminatedUnion:()=>nc,ZodEffects:()=>Pt,ZodEnum:()=>Er,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>fe,ZodFunction:()=>oc,ZodIntersection:()=>Ar,ZodIssueCode:()=>W,ZodLazy:()=>wr,ZodLiteral:()=>Cr,ZodMap:()=>To,ZodNaN:()=>_o,ZodNativeEnum:()=>xr,ZodNever:()=>Ut,ZodNull:()=>Sr,ZodNullable:()=>Xt,ZodNumber:()=>mr,ZodObject:()=>ht,ZodOptional:()=>_t,ZodParsedType:()=>ee,ZodPipeline:()=>Ki,ZodPromise:()=>Dn,ZodReadonly:()=>Tr,ZodRecord:()=>rc,ZodSchema:()=>ve,ZodSet:()=>ko,ZodString:()=>Nn,ZodSymbol:()=>Io,ZodTransformer:()=>Pt,ZodTuple:()=>Yt,ZodType:()=>ve,ZodUndefined:()=>vr,ZodUnion:()=>br,ZodUnknown:()=>hn,ZodVoid:()=>Ro,addIssueToContext:()=>Z,any:()=>j0,array:()=>G0,bigint:()=>N0,boolean:()=>Av,coerce:()=>fk,custom:()=>vv,date:()=>F0,datetimeRegex:()=>hv,defaultErrorMap:()=>mn,discriminatedUnion:()=>Q0,effect:()=>ok,enum:()=>tk,function:()=>Z0,getErrorMap:()=>Co,getParsedType:()=>Kt,instanceof:()=>O0,intersection:()=>z0,isAborted:()=>ec,isAsync:()=>Eo,isDirty:()=>tc,isValid:()=>Pn,late:()=>_0,lazy:()=>J0,literal:()=>ek,makeIssue:()=>zi,map:()=>Y0,nan:()=>P0,nativeEnum:()=>nk,never:()=>U0,null:()=>L0,nullable:()=>sk,number:()=>bv,object:()=>B0,objectUtil:()=>hf,oboolean:()=>dk,onumber:()=>lk,optional:()=>ik,ostring:()=>uk,pipeline:()=>ck,preprocess:()=>ak,promise:()=>rk,quotelessJson:()=>o0,record:()=>K0,set:()=>X0,setErrorMap:()=>s0,strictObject:()=>$0,string:()=>Sv,symbol:()=>D0,transformer:()=>ok,tuple:()=>W0,undefined:()=>M0,union:()=>H0,unknown:()=>q0,util:()=>Ae,void:()=>V0});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},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 s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var hf;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(hf||(hf={}));var ee=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Kt=e=>{switch(typeof e){case"undefined":return ee.undefined;case"string":return ee.string;case"number":return Number.isNaN(e)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"symbol":return ee.symbol;case"object":return Array.isArray(e)?ee.array:e===null?ee.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ee.promise:typeof Map<"u"&&e instanceof Map?ee.map:typeof Set<"u"&&e instanceof Set?ee.set:typeof Date<"u"&&e instanceof Date?ee.date:ee.object;default:return ee.unknown}};var W=Ae.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"]),o0=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),gt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(this),r}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,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};gt.create=e=>new gt(e);var i0=(e,t)=>{let n;switch(e.code){case W.invalid_type:e.received===ee.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case W.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case W.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ae.assertNever(e)}return{message:n}},mn=i0;var dv=mn;function s0(e){dv=e}function Co(){return dv}m();d();p();f();var zi=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...(o.path||[])],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=r.filter(c=>!!c).slice().reverse();for(let c of u)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},a0=[];function Z(e,t){let n=Co(),r=zi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===mn?void 0:mn].filter(o=>!!o)});e.common.issues.push(r)}var ot=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return de;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static mergeObjectAsync(t,n){return _asyncToGenerator(function*(){let r=[];for(let o of n){let i=yield o.key,s=yield o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)})()}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return de;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},de=Object.freeze({status:"aborted"}),pr=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),ec=e=>e.status==="aborted",tc=e=>e.status==="dirty",Pn=e=>e.status==="valid",Eo=e=>typeof Promise<"u"&&e instanceof Promise;m();d();p();f();m();d();p();f();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 Ot=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,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(Pn(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 n=new gt(e.common.issues);return this._error=n,this._error}}};function ge(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))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:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??n??a.defaultError}},description:o}}var ve=class{get description(){return this._def.description}_getType(t){return Kt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ot,ctx:{common:t.parent.common,data:t.data,parsedType:Kt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Eo(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Kt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return fv(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Kt(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Pn(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Pn(r)?{value:r.value}:{issues:n.common.issues})}parseAsync(t,n){var _this7=this;return _asyncToGenerator(function*(){let r=yield _this7.safeParseAsync(t,n);if(r.success)return r.data;throw r.error})()}safeParseAsync(t,n){var _this8=this;return _asyncToGenerator(function*(){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:_this8._def.errorMap,parent:null,data:t,parsedType:Kt(t)},o=_this8._parse({data:t,path:r.path,parent:r}),i=yield Eo(o)?o:Promise.resolve(o);return fv(r,i)})()}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:W.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Pt({schema:this,typeName:fe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return _t.create(this,this._def)}nullable(){return Xt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yn.create(this)}promise(){return Dn.create(this,this._def)}or(t){return br.create([this,t],this._def)}and(t){return Ar.create(this,t,this._def)}transform(t){return new Pt({...ge(this._def),schema:this,typeName:fe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Ir({...ge(this._def),innerType:this,defaultValue:n,typeName:fe.ZodDefault})}brand(){return new Wi({typeName:fe.ZodBranded,type:this,...ge(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Rr({...ge(this._def),innerType:this,catchValue:n,typeName:fe.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ki.create(this,t)}readonly(){return Tr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},c0=/^c[^\s-]{8,}$/i,u0=/^[0-9a-z]+$/,l0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,d0=/^[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,f0=/^[a-z0-9_-]{21}$/i,p0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,m0=/^[-+]?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)?)??$/,g0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,h0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yf,y0=/^(?:(?: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])$/,v0=/^(?:(?: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])$/,S0=/^(([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]))$/,b0=/^(([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])$/,A0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,w0=/^([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])))",C0=new RegExp(`^${mv}$`);function gv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function E0(e){return new RegExp(`^${gv(e)}$`)}function hv(e){let t=`${mv}T${gv(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function x0(e,t){return!!((t==="v4"||!t)&&y0.test(e)||(t==="v6"||!t)&&S0.test(e))}function I0(e,t){if(!p0.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function R0(e,t){return!!((t==="v4"||!t)&&v0.test(e)||(t==="v6"||!t)&&b0.test(e))}var Nn=class e extends ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ee.string){let i=this._getOrReturnCtx(t);return Z(i,{code:W.invalid_type,expected:ee.string,received:i.parsedType}),de}let r=new ot,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?Z(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Z(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")g0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"email",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")yf||(yf=new RegExp(h0,"u")),yf.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"emoji",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")d0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"uuid",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")f0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"nanoid",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")c0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")u0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cuid2",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")l0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ulid",code:W.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),Z(o,{validation:"url",code:W.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"regex",code:W.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),Z(o,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.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),Z(o,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),Z(o,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?hv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:W.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?C0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:W.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?E0(i).test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{code:W.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?m0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"duration",code:W.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?x0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"ip",code:W.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?I0(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"jwt",code:W.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?R0(t.data,i.version)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"cidr",code:W.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?A0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64",code:W.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?w0.test(t.data)||(o=this._getOrReturnCtx(t,o),Z(o,{validation:"base64url",code:W.invalid_string,message:i.message}),r.dirty()):Ae.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:W.invalid_string,...ie.errToObj(r)})}_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,n){return this._addCheck({kind:"regex",regex:t,...ie.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...ie.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ie.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ie.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ie.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ie.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ie.errToObj(n)})}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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Nn.create=e=>new Nn({checks:[],typeName:fe.ZodString,coerce:e?.coerce??!1,...ge(e)});function T0(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var mr=class e extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ee.number){let i=this._getOrReturnCtx(t);return Z(i,{code:W.invalid_type,expected:ee.number,received:i.parsedType}),de}let r,o=new ot;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:W.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.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)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?T0(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Z(r,{code:W.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ie.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,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,n){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(n)})}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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ae.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};mr.create=e=>new mr({checks:[],typeName:fe.ZodNumber,coerce:e?.coerce||!1,...ge(e)});var gr=class e extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ee.bigint)return this._getInvalidInput(t);let r,o=new ot;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.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)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Z(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return Z(n,{code:W.invalid_type,expected:ee.bigint,received:n.parsedType}),de}gte(t,n){return this.setLimit("min",t,!0,ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ie.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,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,n){return this._addCheck({kind:"multipleOf",value:t,message:ie.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};gr.create=e=>new gr({checks:[],typeName:fe.ZodBigInt,coerce:e?.coerce??!1,...ge(e)});var hr=class extends ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ee.boolean){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.boolean,received:r.parsedType}),de}return dt(t.data)}};hr.create=e=>new hr({typeName:fe.ZodBoolean,coerce:e?.coerce||!1,...ge(e)});var yr=class e extends ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ee.date){let i=this._getOrReturnCtx(t);return Z(i,{code:W.invalid_type,expected:ee.date,received:i.parsedType}),de}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Z(i,{code:W.invalid_date}),de}let r=new ot,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),Z(o,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ae.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ie.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ie.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};yr.create=e=>new yr({checks:[],coerce:e?.coerce||!1,typeName:fe.ZodDate,...ge(e)});var Io=class extends ve{_parse(t){if(this._getType(t)!==ee.symbol){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.symbol,received:r.parsedType}),de}return dt(t.data)}};Io.create=e=>new Io({typeName:fe.ZodSymbol,...ge(e)});var vr=class extends ve{_parse(t){if(this._getType(t)!==ee.undefined){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.undefined,received:r.parsedType}),de}return dt(t.data)}};vr.create=e=>new vr({typeName:fe.ZodUndefined,...ge(e)});var Sr=class extends ve{_parse(t){if(this._getType(t)!==ee.null){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.null,received:r.parsedType}),de}return dt(t.data)}};Sr.create=e=>new Sr({typeName:fe.ZodNull,...ge(e)});var Fn=class extends ve{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Fn.create=e=>new Fn({typeName:fe.ZodAny,...ge(e)});var hn=class extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};hn.create=e=>new hn({typeName:fe.ZodUnknown,...ge(e)});var Ut=class extends ve{_parse(t){let n=this._getOrReturnCtx(t);return Z(n,{code:W.invalid_type,expected:ee.never,received:n.parsedType}),de}};Ut.create=e=>new Ut({typeName:fe.ZodNever,...ge(e)});var Ro=class extends ve{_parse(t){if(this._getType(t)!==ee.undefined){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.void,received:r.parsedType}),de}return dt(t.data)}};Ro.create=e=>new Ro({typeName:fe.ZodVoid,...ge(e)});var yn=class e extends ve{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ee.array)return Z(n,{code:W.invalid_type,expected:ee.array,received:n.parsedType}),de;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(Z(n,{code:s?W.too_big:W.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(Z(n,{code:W.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(Z(n,{code:W.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Ot(n,s,n.path,a)))).then(s=>ot.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Ot(n,s,n.path,a)));return ot.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ie.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ie.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:ie.toString(n)}})}nonempty(t){return this.min(1,t)}};yn.create=(e,t)=>new yn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:fe.ZodArray,...ge(t)});function xo(e){if(e instanceof ht){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=_t.create(xo(r))}return new ht({...e._def,shape:()=>t})}else return e instanceof yn?new yn({...e._def,type:xo(e.element)}):e instanceof _t?_t.create(xo(e.unwrap())):e instanceof Xt?Xt.create(xo(e.unwrap())):e instanceof Yt?Yt.create(e.items.map(t=>xo(t))):e}var ht=class e extends ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ae.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ee.object){let c=this._getOrReturnCtx(t);return Z(c,{code:W.invalid_type,expected:ee.object,received:c.parsedType}),de}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ut&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let u=[];for(let c of s){let g=i[c],y=o.data[c];u.push({key:{status:"valid",value:c},value:g._parse(new Ot(o,y,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Ut){let c=this._def.unknownKeys;if(c==="passthrough")for(let g of a)u.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(c==="strict")a.length>0&&(Z(o,{code:W.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let g of a){let y=o.data[g];u.push({key:{status:"valid",value:g},value:c._parse(new Ot(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,E=yield g.value;c.push({key:y,value:E,alwaysSet:g.alwaysSet})}return c})).then(c=>ot.mergeObjectSync(r,c)):ot.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return ie.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.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:fe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of Ae.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of Ae.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return xo(this)}partial(t){let n={};for(let r of Ae.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of Ae.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof _t;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return yv(Ae.objectKeys(this.shape))}};ht.create=(e,t)=>new ht({shape:()=>e,unknownKeys:"strip",catchall:Ut.create(),typeName:fe.ZodObject,...ge(t)});ht.strictCreate=(e,t)=>new ht({shape:()=>e,unknownKeys:"strict",catchall:Ut.create(),typeName:fe.ZodObject,...ge(t)});ht.lazycreate=(e,t)=>new ht({shape:e,unknownKeys:"strip",catchall:Ut.create(),typeName:fe.ZodObject,...ge(t)});var br=class extends ve{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new gt(a.ctx.common.issues));return Z(n,{code:W.invalid_union,unionErrors:s}),de}if(n.common.async)return Promise.all(r.map(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i){let s={...n,common:{...n.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}});return function(_x81){return _ref14.apply(this,arguments)}}())).then(o);{let i,s=[];for(let u of r){let c={...n,common:{...n.common,issues:[]},parent:null},g=u._parseSync({data:n.data,path:n.path,parent:c});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new gt(u));return Z(n,{code:W.invalid_union,unionErrors:a}),de}}get options(){return this._def.options}};br.create=(e,t)=>new br({options:e,typeName:fe.ZodUnion,...ge(t)});var gn=e=>e instanceof wr?gn(e.schema):e instanceof Pt?gn(e.innerType()):e instanceof Cr?[e.value]:e instanceof Er?e.options:e instanceof xr?Ae.objectValues(e.enum):e instanceof Ir?gn(e._def.innerType):e instanceof vr?[void 0]:e instanceof Sr?[null]:e instanceof _t?[void 0,...gn(e.unwrap())]:e instanceof Xt?[null,...gn(e.unwrap())]:e instanceof Wi||e instanceof Tr?gn(e.unwrap()):e instanceof Rr?gn(e._def.innerType):[],nc=class e extends ve{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.object)return Z(n,{code:W.invalid_type,expected:ee.object,received:n.parsedType}),de;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Z(n,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=gn(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:fe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ge(r)})}};function vf(e,t){let n=Kt(e),r=Kt(t);if(e===t)return{valid:!0,data:e};if(n===ee.object&&r===ee.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=vf(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(n===ee.array&&r===ee.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=vf(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return n===ee.date&&r===ee.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ar=class extends ve{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(ec(i)||ec(s))return de;let a=vf(i.value,s.value);return a.valid?((tc(i)||tc(s))&&n.dirty(),{status:n.value,value:a.data}):(Z(r,{code:W.invalid_intersection_types}),de)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ar.create=(e,t,n)=>new Ar({left:e,right:t,typeName:fe.ZodIntersection,...ge(n)});var Yt=class e extends ve{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.array)return Z(r,{code:W.invalid_type,expected:ee.array,received:r.parsedType}),de;if(r.data.length<this._def.items.length)return Z(r,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&r.data.length>this._def.items.length&&(Z(r,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Ot(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>ot.mergeArray(n,s)):ot.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Yt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yt({items:e,typeName:fe.ZodTuple,rest:null,...ge(t)})};var rc=class e extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.object)return Z(r,{code:W.invalid_type,expected:ee.object,received:r.parsedType}),de;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Ot(r,a,r.path,a)),value:s._parse(new Ot(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?ot.mergeObjectAsync(n,o):ot.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ve?new e({keyType:t,valueType:n,typeName:fe.ZodRecord,...ge(r)}):new e({keyType:Nn.create(),valueType:t,typeName:fe.ZodRecord,...ge(n)})}},To=class extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.map)return Z(r,{code:W.invalid_type,expected:ee.map,received:r.parsedType}),de;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,u],c)=>({key:o._parse(new Ot(r,a,r.path,[c,"key"])),value:i._parse(new Ot(r,u,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let u of s){let c=yield u.key,g=yield u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),a.set(c.value,g.value)}return{status:n.value,value:a}}))}else{let a=new Map;for(let u of s){let c=u.key,g=u.value;if(c.status==="aborted"||g.status==="aborted")return de;(c.status==="dirty"||g.status==="dirty")&&n.dirty(),a.set(c.value,g.value)}return{status:n.value,value:a}}}};To.create=(e,t,n)=>new To({valueType:t,keyType:e,typeName:fe.ZodMap,...ge(n)});var ko=class e extends ve{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.set)return Z(r,{code:W.invalid_type,expected:ee.set,received:r.parsedType}),de;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(Z(r,{code:W.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(Z(r,{code:W.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(u){let c=new Set;for(let g of u){if(g.status==="aborted")return de;g.status==="dirty"&&n.dirty(),c.add(g.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((u,c)=>i._parse(new Ot(r,u,r.path,c)));return r.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:ie.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ie.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};ko.create=(e,t)=>new ko({valueType:e,minSize:null,maxSize:null,typeName:fe.ZodSet,...ge(t)});var oc=class e extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.function)return Z(n,{code:W.invalid_type,expected:ee.function,received:n.parsedType}),de;function r(a,u){return zi({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Co(),mn].filter(c=>!!c),issueData:{code:W.invalid_arguments,argumentsError:u}})}function o(a,u){return zi({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Co(),mn].filter(c=>!!c),issueData:{code:W.invalid_return_type,returnTypeError:u}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Dn){let a=this;return dt(/*#__PURE__*/_asyncToGenerator(function*(...u){let c=new gt([]),g=yield a._def.args.parseAsync(u,i).catch(h=>{throw c.addIssue(r(u,h)),c}),y=yield Reflect.apply(s,this,g);return yield a._def.returns._def.type.parseAsync(y,i).catch(h=>{throw c.addIssue(o(y,h)),c})}))}else{let a=this;return dt(function(...u){let c=a._def.args.safeParse(u,i);if(!c.success)throw new gt([r(u,c.error)]);let g=Reflect.apply(s,this,c.data),y=a._def.returns.safeParse(g,i);if(!y.success)throw new gt([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:Yt.create(t).rest(hn.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,n,r){return new e({args:t||Yt.create([]).rest(hn.create()),returns:n||hn.create(),typeName:fe.ZodFunction,...ge(r)})}},wr=class extends ve{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};wr.create=(e,t)=>new wr({getter:e,typeName:fe.ZodLazy,...ge(t)});var Cr=class extends ve{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return Z(n,{received:n.data,code:W.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:t.data}}get value(){return this._def.value}};Cr.create=(e,t)=>new Cr({value:e,typeName:fe.ZodLiteral,...ge(t)});function yv(e,t){return new Er({values:e,typeName:fe.ZodEnum,...ge(t)})}var Er=class e extends ve{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{expected:Ae.joinValues(r),received:n.parsedType,code:W.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return Z(n,{received:n.data,code:W.invalid_enum_value,options:r}),de}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};Er.create=yv;var xr=class extends ve{_parse(t){let n=Ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ee.string&&r.parsedType!==ee.number){let o=Ae.objectValues(n);return Z(r,{expected:Ae.joinValues(o),received:r.parsedType,code:W.invalid_type}),de}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(n);return Z(r,{received:r.data,code:W.invalid_enum_value,options:o}),de}return dt(t.data)}get enum(){return this._def.values}};xr.create=(e,t)=>new xr({values:e,typeName:fe.ZodNativeEnum,...ge(t)});var Dn=class extends ve{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.promise&&n.common.async===!1)return Z(n,{code:W.invalid_type,expected:ee.promise,received:n.parsedType}),de;let r=n.parsedType===ee.promise?n.data:Promise.resolve(n.data);return dt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Dn.create=(e,t)=>new Dn({type:e,typeName:fe.ZodPromise,...ge(t)});var Pt=class extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this9=this;let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Z(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(a){if(n.value==="aborted")return de;let u=yield _this9._def.schema._parseAsync({data:a,path:r.path,parent:r});return u.status==="aborted"?de:u.status==="dirty"?pr(u.value):n.value==="dirty"?pr(u.value):u});return function(_x82){return _ref17.apply(this,arguments)}}());{if(n.value==="aborted")return de;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?de:a.status==="dirty"?pr(a.value):n.value==="dirty"?pr(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Pn(s))return de;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Pn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):de);Ae.assertNever(o)}};Pt.create=(e,t,n)=>new Pt({schema:e,typeName:fe.ZodEffects,effect:t,...ge(n)});Pt.createWithPreprocess=(e,t,n)=>new Pt({schema:t,effect:{type:"preprocess",transform:e},typeName:fe.ZodEffects,...ge(n)});var _t=class extends ve{_parse(t){return this._getType(t)===ee.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};_t.create=(e,t)=>new _t({innerType:e,typeName:fe.ZodOptional,...ge(t)});var Xt=class extends ve{_parse(t){return this._getType(t)===ee.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Xt.create=(e,t)=>new Xt({innerType:e,typeName:fe.ZodNullable,...ge(t)});var Ir=class extends ve{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===ee.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ir.create=(e,t)=>new Ir({innerType:e,typeName:fe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ge(t)});var Rr=class extends ve{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Eo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Rr.create=(e,t)=>new Rr({innerType:e,typeName:fe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ge(t)});var _o=class extends ve{_parse(t){if(this._getType(t)!==ee.nan){let r=this._getOrReturnCtx(t);return Z(r,{code:W.invalid_type,expected:ee.nan,received:r.parsedType}),de}return{status:"valid",value:t.data}}};_o.create=e=>new _o({typeName:fe.ZodNaN,...ge(e)});var k0=Symbol("zod_brand"),Wi=class extends ve{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Ki=class e extends ve{_parse(t){var _this0=this;let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return _asyncToGenerator(function*(){let i=yield _this0._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?de:i.status==="dirty"?(n.dirty(),pr(i.value)):_this0._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?de:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:fe.ZodPipeline})}},Tr=class extends ve{_parse(t){let n=this._def.innerType._parse(t),r=o=>(Pn(o)&&(o.value=Object.freeze(o.value)),o);return Eo(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:fe.ZodReadonly,...ge(t)});function pv(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function vv(e,t={},n){return e?Fn.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=pv(t,r),u=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=pv(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Fn.create()}var _0={object:ht.lazycreate},fe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(fe||(fe={}));var O0=(e,t={message:`Input not instance of ${e.name}`})=>vv(n=>n instanceof e,t),Sv=Nn.create,bv=mr.create,P0=_o.create,N0=gr.create,Av=hr.create,F0=yr.create,D0=Io.create,M0=vr.create,L0=Sr.create,j0=Fn.create,q0=hn.create,U0=Ut.create,V0=Ro.create,G0=yn.create,B0=ht.create,$0=ht.strictCreate,H0=br.create,Q0=nc.create,z0=Ar.create,W0=Yt.create,K0=rc.create,Y0=To.create,X0=ko.create,Z0=oc.create,J0=wr.create,ek=Cr.create,tk=Er.create,nk=xr.create,rk=Dn.create,ok=Pt.create,ik=_t.create,sk=Xt.create,ak=Pt.createWithPreprocess,ck=Ki.create,uk=()=>Sv().optional(),lk=()=>bv().optional(),dk=()=>Av().optional(),fk={string:e=>Nn.create({...e,coerce:!0}),number:e=>mr.create({...e,coerce:!0}),boolean:e=>hr.create({...e,coerce:!0}),bigint:e=>gr.create({...e,coerce:!0}),date:e=>yr.create({...e,coerce:!0})};var pk=de;var mk=S.record(S.any()),kr=mk.optional();function wv(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var gk=S.object({name:S.string(),arguments:S.string()}),hk=S.object({id:S.string(),type:S.literal("function"),function:gk,encryptedValue:S.string().optional(),metadata:kr}),ic=S.object({id:S.string(),role:S.string(),content:S.string().optional(),name:S.string().optional(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:kr}),yk=S.object({type:S.literal("text"),text:S.string()}),vk=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()}),sc=S.discriminatedUnion("type",[vk,Sk]),bk=S.object({type:S.literal("image"),source:sc,metadata:S.unknown().optional()}),Ak=S.object({type:S.literal("audio"),source:sc,metadata:S.unknown().optional()}),wk=S.object({type:S.literal("video"),source:sc,metadata:S.unknown().optional()}),Ck=S.object({type:S.literal("document"),source:sc,metadata:S.unknown().optional()});var Cv=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()}),Ev=(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"]})},A6=Cv.superRefine((e,t)=>{Ev(e,t)}),Ek=S.discriminatedUnion("type",[yk,bk,Ak,wk,Ck,Cv]),xk=Ek.superRefine((e,t)=>{e.type==="binary"&&Ev(e,t)}),Ik=ic.extend({role:S.literal("developer"),content:S.string()}),Rk=ic.extend({role:S.literal("system"),content:S.string()}),Tk=ic.extend({role:S.literal("assistant"),content:S.string().optional(),toolCalls:S.array(hk).optional()}),kk=ic.extend({role:S.literal("user"),content:S.union([S.string(),S.array(xk)])}),_k=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:kr}),Ok=S.object({id:S.string(),role:S.literal("activity"),activityType:S.string(),content:S.record(S.any()),subagentRunId:S.string().optional(),metadata:kr}),Pk=S.object({id:S.string(),role:S.literal("reasoning"),content:S.string(),encryptedValue:S.string().optional(),subagentRunId:S.string().optional(),metadata:kr}),xv=S.discriminatedUnion("role",[Ik,Rk,Tk,kk,_k,Ok,Pk]),w6=S.union([S.literal("developer"),S.literal("system"),S.literal("assistant"),S.literal("user"),S.literal("tool"),S.literal("activity"),S.literal("reasoning")]),Nk=S.object({description:S.string(),value:S.string()}),Iv=S.object({name:S.string(),description:S.string(),parameters:S.any(),metadata:S.record(S.any()).optional()}),Fk=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()}),Dk=S.object({interruptId:S.string(),status:S.enum(["resolved","cancelled"]),payload:S.any().optional(),metadata:kr}),Mk=S.object({threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),state:S.any().transform(e=>e??void 0),messages:S.array(xv),tools:S.array(Iv),context:S.array(Nk),forwardedProps:S.any(),resume:S.array(Dk).optional()}),Lk=S.any(),pe=class extends Error{constructor(e){super(e)}},Sf=class extends pe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},jk=S.object({name:S.string(),description:S.string().optional()}),qk=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()}),Uk=S.object({streaming:S.boolean().optional(),websocket:S.boolean().optional(),httpBinary:S.boolean().optional(),pushNotifications:S.boolean().optional(),resumable:S.boolean().optional()}),Vk=S.object({supported:S.boolean().optional(),items:S.array(Iv).optional(),parallelCalls:S.boolean().optional(),clientProvided:S.boolean().optional()}),Gk=S.object({structuredOutput:S.boolean().optional(),supportedMimeTypes:S.array(S.string()).optional()}),Bk=S.object({snapshots:S.boolean().optional(),deltas:S.boolean().optional(),memory:S.boolean().optional(),persistentState:S.boolean().optional()}),$k=S.object({supported:S.boolean().optional(),delegation:S.boolean().optional(),handoffs:S.boolean().optional(),subAgents:S.array(jk).optional()}),Hk=S.object({supported:S.boolean().optional(),streaming:S.boolean().optional(),encrypted:S.boolean().optional()}),Qk=S.object({image:S.boolean().optional(),audio:S.boolean().optional(),video:S.boolean().optional(),pdf:S.boolean().optional(),file:S.boolean().optional()}),zk=S.object({image:S.boolean().optional(),audio:S.boolean().optional()}),Wk=S.object({input:Qk.optional(),output:zk.optional()}),Kk=S.object({codeExecution:S.boolean().optional(),sandboxed:S.boolean().optional(),maxIterations:S.number().optional(),maxExecutionTime:S.number().optional()}),Yk=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()}),C6=S.object({identity:qk.optional(),transport:Uk.optional(),tools:Vk.optional(),output:Gk.optional(),state:Bk.optional(),multiAgent:$k.optional(),reasoning:Hk.optional(),multimodal:Wk.optional(),execution:Kk.optional(),humanInTheLoop:Yk.optional(),custom:S.record(S.unknown()).optional()}),Rv=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}({}),Ce=S.object({type:S.nativeEnum(D),timestamp:S.number().optional(),rawEvent:S.any().optional(),metadata:kr}).passthrough(),Xk=Ce.extend({type:S.literal(D.TEXT_MESSAGE_START),messageId:S.string(),role:Rv.default("assistant"),name:S.string().optional(),subagentRunId:S.string().optional()}),Tv=Ce.extend({type:S.literal(D.TEXT_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),Zk=Ce.extend({type:S.literal(D.TEXT_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),Jk=Ce.extend({type:S.literal(D.TEXT_MESSAGE_CHUNK),messageId:S.string().optional(),role:Rv.optional(),delta:S.string().optional(),name:S.string().optional(),subagentRunId:S.string().optional()}),e_=Ce.extend({type:S.literal(D.THINKING_TEXT_MESSAGE_START)}),t_=Tv.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:S.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),n_=Ce.extend({type:S.literal(D.THINKING_TEXT_MESSAGE_END)}),r_=Ce.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()}),o_=Ce.extend({type:S.literal(D.TOOL_CALL_ARGS),toolCallId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),i_=Ce.extend({type:S.literal(D.TOOL_CALL_END),toolCallId:S.string(),subagentRunId:S.string().optional()}),s_=Ce.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()}),a_=Ce.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()}),c_=Ce.extend({type:S.literal(D.THINKING_START),title:S.string().optional()}),u_=Ce.extend({type:S.literal(D.THINKING_END)}),l_=Ce.extend({type:S.literal(D.STATE_SNAPSHOT),snapshot:Lk,subagentRunId:S.string().optional()}),d_=Ce.extend({type:S.literal(D.STATE_DELTA),delta:S.array(S.any()),subagentRunId:S.string().optional()}),f_=Ce.extend({type:S.literal(D.MESSAGES_SNAPSHOT),messages:S.array(xv)}),p_=Ce.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()}),m_=Ce.extend({type:S.literal(D.ACTIVITY_DELTA),messageId:S.string(),activityType:S.string(),patch:S.array(S.any()),subagentRunId:S.string().optional()}),g_=Ce.extend({type:S.literal(D.RAW),event:S.any(),source:S.string().optional(),subagentRunId:S.string().optional()}),h_=Ce.extend({type:S.literal(D.CUSTOM),name:S.string(),value:S.any(),subagentRunId:S.string().optional()}),y_=Ce.extend({type:S.literal(D.RUN_STARTED),threadId:S.string(),runId:S.string(),parentRunId:S.string().optional(),input:Mk.optional()}),v_=S.object({type:S.literal("success")}).strict(),S_=S.object({type:S.literal("interrupt"),interrupts:S.array(Fk).min(1)}).strict(),b_=S.discriminatedUnion("type",[v_,S_]),kv=S.object({provider:S.string().optional(),model:S.string().optional(),inputTokens:S.number().int().nonnegative().optional(),outputTokens:S.number().int().nonnegative().optional(),totalTokens:S.number().int().nonnegative().optional(),reasoningTokens:S.number().int().nonnegative().optional(),cachedInputTokens:S.number().int().nonnegative().optional()}),A_=Ce.extend({type:S.literal(D.RUN_FINISHED),threadId:S.string(),runId:S.string(),result:S.any().optional(),outcome:b_.nullable().optional().transform(e=>e??void 0),usage:S.array(kv).optional()}),w_=Ce.extend({type:S.literal(D.RUN_ERROR),message:S.string(),code:S.string().optional(),usage:S.array(kv).optional()}),C_=Ce.extend({type:S.literal(D.STEP_STARTED),stepName:S.string(),subagentRunId:S.string().optional()}),E_=Ce.extend({type:S.literal(D.STEP_FINISHED),stepName:S.string(),subagentRunId:S.string().optional()}),x_=S.union([S.literal("tool-call"),S.literal("message")]),I_=Ce.extend({type:S.literal(D.REASONING_START),messageId:S.string(),subagentRunId:S.string().optional()}),R_=Ce.extend({type:S.literal(D.REASONING_MESSAGE_START),messageId:S.string(),role:S.literal("reasoning"),subagentRunId:S.string().optional()}),T_=Ce.extend({type:S.literal(D.REASONING_MESSAGE_CONTENT),messageId:S.string(),delta:S.string(),subagentRunId:S.string().optional()}),k_=Ce.extend({type:S.literal(D.REASONING_MESSAGE_END),messageId:S.string(),subagentRunId:S.string().optional()}),__=Ce.extend({type:S.literal(D.REASONING_MESSAGE_CHUNK),messageId:S.string().optional(),delta:S.string().optional(),subagentRunId:S.string().optional()}),O_=Ce.extend({type:S.literal(D.REASONING_END),messageId:S.string(),subagentRunId:S.string().optional()}),P_=Ce.extend({type:S.literal(D.REASONING_ENCRYPTED_VALUE),subtype:x_,entityId:S.string(),encryptedValue:S.string(),subagentRunId:S.string().optional()}),N_=Ce.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()}),F_=S.object({type:S.literal("success")}).strict(),D_=S.object({type:S.literal("suspended"),interruptIds:S.array(S.string()).optional()}).strict(),M_=S.discriminatedUnion("type",[F_,D_]),L_=Ce.extend({type:S.literal(D.SUBAGENT_FINISHED),subagentRunId:S.string(),result:S.any().optional(),outcome:M_.optional()}),j_=Ce.extend({type:S.literal(D.SUBAGENT_ERROR),subagentRunId:S.string(),message:S.string(),code:S.string().optional()}),ac=S.discriminatedUnion("type",[Xk,Tv,Zk,Jk,c_,u_,e_,t_,n_,r_,o_,i_,a_,s_,l_,d_,f_,p_,m_,g_,h_,y_,A_,w_,C_,E_,I_,R_,T_,k_,__,O_,P_,N_,L_,j_]);m();d();p();f();var bf={};ls(bf,{JsonPatchError:()=>Ge,_areEquals:()=>Zi,applyOperation:()=>_r,applyPatch:()=>mc,applyReducer:()=>B_,deepClone:()=>V_,getValueByPointer:()=>fc,validate:()=>Ov,validator:()=>pc});m();d();p();f();m();d();p();f();var q_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),U_=Object.prototype.hasOwnProperty;function uc(e,t){return U_.call(e,t)}function lc(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var o in e)uc(e,o)&&r.push(o);return r}function it(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function dc(e){for(var t=0,n=e.length,r;t<n;){if(r=e.charCodeAt(t),r>=48&&r<=57){t++;continue}return!1}return!0}function Zt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Yi(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function cc(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(cc(e[t]))return!0}else if(typeof e=="object"){for(var r=lc(e),o=r.length,i=0;i<o;i++)if(cc(e[r[i]]))return!0}}return!1}function _v(e,t){var n=[e];for(var r in t){var o=typeof t[r]=="object"?JSON.stringify(t[r],null,2):t[r];typeof o<"u"&&n.push(r+": "+o)}return n.join(`
33
+ `)}var Xi=function(e){q_(t,e);function t(n,r,o,i,s){var a=this.constructor,u=e.call(this,_v(n,{name:r,index:o,operation:i,tree:s}))||this;return u.name=r,u.index=o,u.operation=i,u.tree=s,Object.setPrototypeOf(u,a.prototype),u.message=_v(n,{name:r,index:o,operation:i,tree:s}),u}return t}(Error);var Ge=Xi,V_=it,Oo={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=fc(n,this.path);r&&(r=it(r));var o=_r(n,{op:"remove",path:this.from}).removed;return _r(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=fc(n,this.from);return _r(n,{op:"add",path:this.path,value:it(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:Zi(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},G_={add:function(e,t,n){return dc(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){var r=e.splice(t,1);return{newDocument:n,removed:r[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:Oo.move,copy:Oo.copy,test:Oo.test,_get:Oo._get};function fc(e,t){if(t=="")return e;var n={op:"_get",path:t};return _r(e,n),n.value}function _r(e,t,n,r,o,i){if(n===void 0&&(n=!1),r===void 0&&(r=!0),o===void 0&&(o=!0),i===void 0&&(i=0),n&&(typeof n=="function"?n(t,0,e,t.path):pc(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=fc(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Zi(e,t.value),s.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(n)throw new Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{r||(e=it(e));var a=t.path||"",u=a.split("/"),c=e,g=1,y=u.length,E=void 0,h=void 0,v=void 0;for(typeof n=="function"?v=n:v=pc;;){if(h=u[g],h&&h.indexOf("~")!=-1&&(h=Yi(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(n&&E===void 0&&(c[h]===void 0?E=u.slice(0,g).join("/"):g==y-1&&(E=t.path),E!==void 0&&v(t,0,e,E)),g++,Array.isArray(c)){if(h==="-")h=c.length;else{if(n&&!dc(h))throw new Ge("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);dc(h)&&(h=~~h)}if(g>=y){if(n&&t.op==="add"&&h>c.length)throw new Ge("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=G_[t.op].call(t,c,h,e);if(s.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(g>=y){var s=Oo[t.op].call(t,c,h,e);if(s.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(c=c[h],n&&g<y&&(!c||typeof c!="object"))throw new Ge("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function mc(e,t,n,r,o){if(r===void 0&&(r=!0),o===void 0&&(o=!0),n&&!Array.isArray(t))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=it(e));for(var i=new Array(t.length),s=0,a=t.length;s<a;s++)i[s]=_r(e,t[s],n,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function B_(e,t,n){var r=_r(e,t);if(r.test===!1)throw new Ge("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument}function pc(e,t,n,r){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ge("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(Oo[e.op]){if(typeof e.path!="string")throw new Ge("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ge("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ge("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ge("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&cc(e.value))throw new Ge("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var o=e.path.split("/").length,i=r.split("/").length;if(o!==i+1&&o!==i)throw new Ge("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==r)throw new Ge("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=Ov([s],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ge("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new Ge("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function Ov(e,t,n){try{if(!Array.isArray(e))throw new Ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)mc(it(t),it(e),n||!0);else{n=n||pc;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(o){if(o instanceof Ge)return o;throw o}}function Zi(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=Array.isArray(e),r=Array.isArray(t),o,i,s;if(n&&r){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Zi(e[o],t[o]))return!1;return!0}if(n!=r)return!1;var a=Object.keys(e);if(i=a.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(a[o]))return!1;for(o=i;o--!==0;)if(s=a[o],!Zi(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var Ef={};ls(Ef,{compare:()=>X_,generate:()=>Af,observe:()=>Y_,unobserve:()=>K_});m();d();p();f();var wf=new WeakMap,$_=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),H_=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function Q_(e){return wf.get(e)}function z_(e,t){return e.observers.get(t)}function W_(e,t){e.observers.delete(t.callback)}function K_(e,t){t.unobserve()}function Y_(e,t){var n=[],r,o=Q_(e);if(!o)o=new $_(e),wf.set(e,o);else{var i=z_(o,t);r=i&&i.observer}if(r)return r;if(r={},o.value=it(e),t){r.callback=t,r.next=null;var s=function(){Af(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=n,r.object=e,r.unobserve=function(){Af(r),clearTimeout(r.next),W_(o,r),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new H_(t,r)),r}function Af(e,t){t===void 0&&(t=!1);var n=wf.get(e.object);Cf(n.value,e.object,e.patches,"",t),e.patches.length&&mc(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function Cf(e,t,n,r,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=lc(t),s=lc(e),a=!1,u=!1,c=s.length-1;c>=0;c--){var g=s[c],y=e[g];if(uc(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var E=t[g];typeof y=="object"&&y!=null&&typeof E=="object"&&E!=null&&Array.isArray(y)===Array.isArray(E)?Cf(y,E,n,r+"/"+Zt(g),o):y!==E&&(a=!0,o&&n.push({op:"test",path:r+"/"+Zt(g),value:it(y)}),n.push({op:"replace",path:r+"/"+Zt(g),value:it(E)}))}else Array.isArray(e)===Array.isArray(t)?(o&&n.push({op:"test",path:r+"/"+Zt(g),value:it(y)}),n.push({op:"remove",path:r+"/"+Zt(g)}),u=!0):(o&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),a=!0)}if(!(!u&&i.length==s.length))for(var c=0;c<i.length;c++){var g=i[c];!uc(e,g)&&t[g]!==void 0&&n.push({op:"add",path:r+"/"+Zt(g),value:it(t[g])})}}}function X_(e,t,n){n===void 0&&(n=!1);var r=[];return Cf(e,t,r,"",n),r}var gc=Object.assign({},bf,Ef,{JsonPatchError:Xi,deepClone:it,escapePathComponent:Zt,unescapePathComponent:Yi});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var xf=function(e,t){return xf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},xf(e,t)};function Jt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xf(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Pv(e,t,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(g){try{c(r.next(g))}catch(y){s(y)}}function u(g){try{c(r.throw(g))}catch(y){s(y)}}function c(g){g.done?i(g.value):o(g.value).then(a,u)}c((r=r.apply(e,t||[])).next())})}function hc(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(g){return u([c,g])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(g){c=[6,g],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function vn(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Po(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,i=[],s;try{for(;(t===void 0||t-->0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function No(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function Or(e){return this instanceof Or?(this.v=e,this):new Or(e)}function Nv(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(v){return Promise.resolve(v).then(h,y)}}function a(h,v){r[h]&&(o[h]=function(A){return new Promise(function(C,w){i.push([h,A,C,w])>1||u(h,A)})},v&&(o[h]=v(o[h])))}function u(h,v){try{c(r[h](v))}catch(A){E(i[0][3],A)}}function c(h){h.value instanceof Or?Promise.resolve(h.value.v).then(g,y):E(i[0][2],h)}function g(h){u("next",h)}function y(h){u("throw",h)}function E(h,v){h(v),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Fv(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof vn=="function"?vn(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(s){return new Promise(function(a,u){s=e[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(c){i({value:c,done:a})},s)}}m();d();p();f();function be(e){return typeof e=="function"}m();d();p();f();m();d();p();f();m();d();p();f();function Fo(e){var t=function(r){Error.call(r),r.stack=(new Error).stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var yc=Fo(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
34
34
  `+n.map(function(r,o){return o+1+") "+r.toString()}).join(`
35
- `):"",this.name="UnsubscriptionError",this.errors=n}});m();d();f();p();function Vi(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ro=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=hn(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(b){t={error:b}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(Ae(g))try{g()}catch(b){i=b instanceof oc?b.errors:[b]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var x=hn(v),h=x.next();!h.done;h=x.next()){var y=h.value;try{yv(y)}catch(b){i=i??[],b instanceof oc?i=xo(xo([],Eo(i)),Eo(b.errors)):i.push(b)}}}catch(b){r={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}}if(i)throw new oc(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)yv(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Vi(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Vi(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var pp=Ro.EMPTY;function ic(e){return e instanceof Ro||e&&"closed"in e&&Ae(e.remove)&&Ae(e.add)&&Ae(e.unsubscribe)}function yv(e){Ae(e)?e():e.unsubscribe()}m();d();f();p();var qt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var To={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=To.delegate;return o?.setTimeout?o.setTimeout.apply(o,xo([e,t],Eo(n))):setTimeout.apply(void 0,xo([e,t],Eo(n)))},clearTimeout:function(e){var t=To.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function sc(e){To.setTimeout(function(){var t=qt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Gi(){}m();d();f();p();var vv=function(){return fp("C",void 0,void 0)}();function Sv(e){return fp("E",void 0,e)}function bv(e){return fp("N",e,void 0)}function fp(e,t,n){return{kind:e,value:t,error:n}}m();d();f();p();var Rr=null;function ko(e){if(qt.useDeprecatedSynchronousErrorHandling){var t=!Rr;if(t&&(Rr={errorThrown:!1,error:null}),e(),t){var n=Rr,r=n.errorThrown,o=n.error;if(Rr=null,r)throw o}}else e()}function Av(e){qt.useDeprecatedSynchronousErrorHandling&&Rr&&(Rr.errorThrown=!0,Rr.error=e)}var Bi=function(e){Xt(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ic(n)&&n.add(r)):r.destination=R_,r}return t.create=function(n,r,o){return new cc(n,r,o)},t.prototype.next=function(n){this.isStopped?gp(bv(n),this):this._next(n)},t.prototype.error=function(n){this.isStopped?gp(Sv(n),this):(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped?gp(vv,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(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ro);var E_=Function.prototype.bind;function mp(e,t){return E_.call(e,t)}var x_=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){ac(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){ac(r)}else ac(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){ac(n)}},e}(),cc=function(e){Xt(t,e);function t(n,r,o){var i=e.call(this)||this,s;if(Ae(n)||!n)s={next:n??void 0,error:r??void 0,complete:o??void 0};else{var a;i&&qt.useDeprecatedNextContext?(a=Object.create(n),a.unsubscribe=function(){return i.unsubscribe()},s={next:n.next&&mp(n.next,a),error:n.error&&mp(n.error,a),complete:n.complete&&mp(n.complete,a)}):s=n}return i.destination=new x_(s),i}return t}(Bi);function ac(e){qt.useDeprecatedSynchronousErrorHandling?Av(e):sc(e)}function I_(e){throw e}function gp(e,t){var n=qt.onStoppedNotification;n&&To.setTimeout(function(){return n(e,t)})}var R_={closed:!0,next:Gi,error:I_,complete:Gi};m();d();f();p();var _o=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Oo(e){return e}function uc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return hp(e)}function hp(e){return e.length===0?Oo:e.length===1?e[0]:function(n){return e.reduce(function(r,o){return o(r)},n)}}var Me=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,i=k_(t)?t:new cc(t,n,r);return ko(function(){var s=o,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=wv(n),new n(function(o,i){var s=new cc({next:function(a){try{t(a)}catch(u){i(u),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[_o]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hp(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=wv(t),new t(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},e.create=function(t){return new e(t)},e}();function wv(e){var t;return(t=e??qt.Promise)!==null&&t!==void 0?t:Promise}function T_(e){return e&&Ae(e.next)&&Ae(e.error)&&Ae(e.complete)}function k_(e){return e&&e instanceof Bi||T_(e)&&ic(e)}m();d();f();p();function __(e){return Ae(e?.lift)}function Ve(e){return function(t){if(__(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function $e(e,t,n,r,o){return new O_(e,t,n,r,o)}var O_=function(e){Xt(t,e);function t(n,r,o,i,s,a){var u=e.call(this,n)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=r?function(c){try{r(c)}catch(g){n.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){n.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(Bi);m();d();f();p();m();d();f();p();var Cv=Io(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Zt=function(e){Xt(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new Ev(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Cv},t.prototype.next=function(n){var r=this;ko(function(){var o,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=hn(r.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(n)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;ko(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;ko(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?pp:(this.currentObservers=null,a.push(n),new Ro(function(){r.currentObservers=null,Vi(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,i=r.thrownError,s=r.isStopped;o?n.error(i):s&&n.complete()},t.prototype.asObservable=function(){var n=new Me;return n.source=this,n},t.create=function(n,r){return new Ev(n,r)},t}(Me);var Ev=function(e){Xt(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:pp},t}(Zt);m();d();f();p();m();d();f();p();var yp={now:function(){return(yp.delegate||Date).now()},delegate:void 0};var lc=function(e){Xt(t,e);function t(n,r,o){n===void 0&&(n=1/0),r===void 0&&(r=1/0),o===void 0&&(o=yp);var i=e.call(this)||this;return i._bufferSize=n,i._windowTime=r,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,n),i._windowTime=Math.max(1,r),i}return t.prototype.next=function(n){var r=this,o=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,u=r._windowTime;o||(i.push(n),!s&&i.push(a.now()+u)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),u=0;u<a.length&&!n.closed;u+=i?1:2)n.next(a[u]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,o=n._timestampProvider,i=n._buffer,s=n._infiniteTimeWindow,a=(s?1:2)*r;if(r<1/0&&a<i.length&&i.splice(0,i.length-a),!s){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}(Zt);m();d();f();p();var dc=new Me(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function xv(e){return e&&Ae(e.schedule)}function P_(e){return e[e.length-1]}function Iv(e){return xv(P_(e))?e.pop():void 0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var pc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function fc(e){return Ae(e?.then)}m();d();f();p();function mc(e){return Ae(e[_o])}m();d();f();p();function gc(e){return Symbol.asyncIterator&&Ae(e?.[Symbol.asyncIterator])}m();d();f();p();function hc(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 N_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var yc=N_();function vc(e){return Ae(e?.[yc])}m();d();f();p();function Sc(e){return gv(this,arguments,function(){var n,r,o,i;return rc(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ir(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,Ir(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ir(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function bc(e){return Ae(e?.getReader)}function Ke(e){if(e instanceof Me)return e;if(e!=null){if(mc(e))return F_(e);if(pc(e))return D_(e);if(fc(e))return M_(e);if(gc(e))return Rv(e);if(vc(e))return L_(e);if(bc(e))return j_(e)}throw hc(e)}function F_(e){return new Me(function(t){var n=e[_o]();if(Ae(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function D_(e){return new Me(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function M_(e){return new Me(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,sc)})}function L_(e){return new Me(function(t){var n,r;try{for(var o=hn(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function Rv(e){return new Me(function(t){U_(e,t).catch(function(n){return t.error(n)})})}function j_(e){return Rv(Sc(e))}function U_(e,t){var n,r,o,i;return mv(this,void 0,void 0,function(){var s,a;return rc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=hv(e),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),o={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[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 Ot(e,t,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=t.schedule(function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(i),!o)return i}function Ac(e,t){return t===void 0&&(t=0),Ve(function(n,r){n.subscribe($e(r,function(o){return Ot(r,e,function(){return r.next(o)},t)},function(){return Ot(r,e,function(){return r.complete()},t)},function(o){return Ot(r,e,function(){return r.error(o)},t)}))})}m();d();f();p();function wc(e,t){return t===void 0&&(t=0),Ve(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Tv(e,t){return Ke(e).pipe(wc(t),Ac(t))}m();d();f();p();function kv(e,t){return Ke(e).pipe(wc(t),Ac(t))}m();d();f();p();function _v(e,t){return new Me(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}m();d();f();p();function Ov(e,t){return new Me(function(n){var r;return Ot(n,t,function(){r=e[yc](),Ot(n,t,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return Ae(r?.return)&&r.return()}})}m();d();f();p();function Cc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Me(function(n){Ot(n,t,function(){var r=e[Symbol.asyncIterator]();Ot(n,t,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}m();d();f();p();function Pv(e,t){return Cc(Sc(e),t)}function Nv(e,t){if(e!=null){if(mc(e))return Tv(e,t);if(pc(e))return _v(e,t);if(fc(e))return kv(e,t);if(gc(e))return Cc(e,t);if(vc(e))return Ov(e,t);if(bc(e))return Pv(e,t)}throw hc(e)}function Tr(e,t){return t?Nv(e,t):Ke(e)}function Te(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Iv(e);return Tr(e,n)}m();d();f();p();function ce(e,t){var n=Ae(e)?e:function(){return e},r=function(o){return o.error(n())};return new Me(t?function(o){return t.schedule(r,0,o)}:r)}m();d();f();p();m();d();f();p();var Fv=Io(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Ec(e,t){var n=typeof t=="object";return new Promise(function(r,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?r(s):n?r(t.defaultValue):o(new Fv)}})})}m();d();f();p();function Nn(e,t){return Ve(function(n,r){var o=0;n.subscribe($e(r,function(i){r.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Dv(e,t,n,r,o,i,s,a){var u=[],c=0,g=0,v=!1,x=function(){v&&!u.length&&!c&&t.complete()},h=function(b){return c<r?y(b):u.push(b)},y=function(b){i&&t.next(b),c++;var w=!1;Ke(n(b,g++)).subscribe($e(t,function(R){o?.(R),i?h(R):t.next(R)},function(){w=!0},void 0,function(){if(w)try{c--;for(var R=function(){var N=u.shift();s?Ot(t,s,function(){return y(N)}):y(N)};u.length&&c<r;)R();x()}catch(N){t.error(N)}}))};return e.subscribe($e(t,h,function(){v=!0,x()})),function(){a?.()}}function ft(e,t,n){return n===void 0&&(n=1/0),Ae(t)?ft(function(r,o){return Nn(function(i,s){return t(r,i,o,s)})(Ke(e(r,o)))},n):(typeof t=="number"&&(n=t),Ve(function(r,o){return Dv(r,o,e,n)}))}function vp(e){return e===void 0&&(e=1/0),ft(Oo,e)}m();d();f();p();function xc(e){return new Me(function(t){Ke(e()).subscribe(t)})}m();d();f();p();function Sp(e,t){return Ve(function(n,r){var o=0;n.subscribe($e(r,function(i){return e.call(t,i,o++)&&r.next(i)}))})}m();d();f();p();function $i(e){return Ve(function(t,n){var r=null,o=!1,i;r=t.subscribe($e(n,void 0,void 0,function(s){i=Ke(e(s,$i(e)(t))),r?(r.unsubscribe(),r=null,i.subscribe(n)):o=!0})),o&&(r.unsubscribe(),r=null,i.subscribe(n))})}m();d();f();p();function Ic(e,t){return Ae(t)?ft(e,t,1):ft(e,1)}m();d();f();p();function bp(e){return Ve(function(t,n){var r=!1;t.subscribe($e(n,function(o){r=!0,n.next(o)},function(){r||n.next(e),n.complete()}))})}m();d();f();p();function kr(e){return Ve(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}m();d();f();p();function Ap(e,t){return Ve(function(n,r){var o=null,i=0,s=!1,a=function(){return s&&!o&&r.complete()};n.subscribe($e(r,function(u){o?.unsubscribe();var c=0,g=i++;Ke(e(u,g)).subscribe(o=$e(r,function(v){return r.next(t?t(u,v,g,c++):v)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();f();p();function Rc(e){return Ve(function(t,n){Ke(e).subscribe($e(n,function(){return n.complete()},Gi)),!n.closed&&t.subscribe(n)})}m();d();f();p();function Tc(e,t,n){var r=Ae(e)||t||n?{next:e,error:t,complete:n}:e;return r?Ve(function(o,i){var s;(s=r.subscribe)===null||s===void 0||s.call(r);var a=!0;o.subscribe($e(i,function(u){var c;(c=r.next)===null||c===void 0||c.call(r,u),i.next(u)},function(){var u;a=!1,(u=r.complete)===null||u===void 0||u.call(r),i.complete()},function(u){var c;a=!1,(c=r.error)===null||c===void 0||c.call(r,u),i.error(u)},function(){var u,c;a&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Oo}m();d();f();p();m();d();f();p();function Mv(e){return` \r
36
- `.indexOf(e)>=0}function kc(e){for(var t=["topLevel"],n=0,r,o,i,s=function(N){return t.push(N)},a=function(N){return t[t.length-1]=N},u=function(N){r==null&&(r=n,o=t.length,i=N)},c=function(N){N===i&&(r=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},v=function(){return n--},x=function(N){if("0"<=N&&N<="9"){s("number");return}switch(N){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;n<h;n++){var y=e[n];switch(t[t.length-1]){case"topLevel":x(y);break;case"string":switch(y){case"\"":g();break;case"\\":u("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":y==="u"?s("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":n-e.lastIndexOf("u",n)===4&&(c("stringEscape"),g());break;case"number":y==="."?a("numberNeedsDigit"):y==="e"||y==="E"?a("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),g());break;case"arrayNeedsValue":y==="]"?g():Mv(y)||(c("collectionItem"),a("arrayNeedsComma"),x(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(u("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(u("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":y===":"&&a("objectNeedsValue");break;case"objectNeedsValue":Mv(y)||(c("collectionItem"),a("objectNeedsComma"),x(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(u("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[r!=null?e.slice(0,r):e],w=function(N){return b.push(N.slice(e.length-e.lastIndexOf(N[0])))},R=t.length-1;R>=0;R--)switch(t[R]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("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 jv(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}let o=e[t++];if(n|=(o&15)<<28,r=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}throw new Error("invalid varint")}var _c=4294967296;function wp(e){let t=e[0]==="-";t&&(e=e.slice(1));let n=1e6,r=0,o=0;function i(s,a){let u=Number(e.slice(s,a));o*=n,r=r*n+u,r>=_c&&(o=o+(r/_c|0),r=r%_c)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?qv(r,o):Ep(r,o)}function Uv(e,t){let n=Ep(e,t),r=n.hi&2147483648;r&&(n=qv(n.lo,n.hi));let o=Cp(n.lo,n.hi);return r?"-"+o:o}function Cp(e,t){if({lo:e,hi:t}=q_(e,t),t<=2097151)return String(_c*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=n+r*6777216+o*6710656,s=r+o*8147497,a=o*2,u=1e7;return i>=u&&(s+=Math.floor(i/u),i%=u),s>=u&&(a+=Math.floor(s/u),s%=u),a.toString()+Lv(s)+Lv(i)}function q_(e,t){return{lo:e>>>0,hi:t>>>0}}function Ep(e,t){return{lo:e|0,hi:t|0}}function qv(e,t){return t=~t,e?e=~e+1:t+=1,Ep(e,t)}var Lv=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Vv(){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 n=5;(e&128)!==0&&n<10;n++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Vt=V_();function V_(){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"&&(!!C.Deno||!!C.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let n=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>r||a<n)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(n){return typeof n!="string"&&(n=n.toString()),Gv(n),n},uParse(n){return typeof n!="string"&&(n=n.toString()),Bv(n),n},enc(n){return typeof n!="string"&&(n=n.toString()),Gv(n),wp(n)},uEnc(n){return typeof n!="string"&&(n=n.toString()),Bv(n),wp(n)},dec(n,r){return Uv(n,r)},uDec(n,r){return Cp(n,r)}}}function Gv(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Bv(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var xp;function G_(e){var t;xp=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Rp(e.encodeUtf8.bind(e))})}function Ip(){if(!xp){let e=C;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,n=new e.TextDecoder,r,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(r||(r=new e.TextDecoder("utf-8",{fatal:!0})),r.decode(s)):n.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),G_(o)}return xp}function Rp(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Fn;(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"})(Fn||(Fn={}));var B_=4294967295,$_=2147483647,H_=-2147483648,fe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Rp(t):Ip().encodeUtf8Into,this.buffer=Hv,this.viewCache=z_,this.pos=0}ensureCapacity(t){let n=this.pos+t;if(n>this.buffer.length){let r=this.buffer.length||Q_;for(;r<n;)r*=2;let o=new Uint8Array(r);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,n=this.viewCache;if(n.byteLength===t.byteLength)return n;let r=new DataView(t.buffer);return this.viewCache=r,r}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(Hi),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 n=this.pos-t-Hi,r=Tp(n);return r>Hi&&(this.ensureCapacity(r-Hi),this.buffer.copyWithin(t+r,t+Hi,this.pos)),this.pos=t,this.uint32(n),this.pos+=n,this}tag(t,n){return this.uint32((t<<3|n)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if($v(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(kp(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let n=0;n<9;n++)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 n=t.length;if(n<=Qv){this.ensureCapacity(n+1);let u=this.buffer,c=this.pos;u[c++]=n;let g=0;for(;g<n;g++){let v=t.charCodeAt(g);if(v>127)break;u[c++]=v}if(g==n)return this.pos=c,this}this.ensureCapacity(n*3+5);let r=Tp(n),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+r)),a=Tp(s);return a!=r&&o.copyWithin(i+a,i+r,i+r+s),this.uint32(s),this.pos+=s,this}float(t){return W_(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 $v(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return kp(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return kp(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let n=Vt.enc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}fixed64(t){let n=Vt.uEnc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}int64(t){let n=Vt.enc(t);return this.writeVarint64(n.lo,n.hi)}sint64(t){let n=Vt.enc(t),r=n.hi>>31,o=n.lo<<1^r,i=(n.hi<<1|n.lo>>>31)^r;return this.writeVarint64(o,i)}uint64(t){let n=Vt.uEnc(t);return this.writeVarint64(n.lo,n.hi)}writeVarint64(t,n){this.ensureCapacity(10);let r=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let u=t>>>a,c=!(!(u>>>7)&&n==0);if(r[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}let i=t>>>28&15|(n&7)<<4,s=n>>3!=0;if(r[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let u=n>>>a,c=!!(u>>>7);if(r[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return r[o++]=n>>>31&1,this.pos=o,this}},Q_=128,Hi=1,Hv=new Uint8Array(0),z_=new DataView(Hv.buffer),Qv=32;function Tp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(t,n=Ip().decodeUtf8){this.decodeUtf8=n,this.varint64Lo=0,this.varint64Hi=0,this.varint64=jv,this.uint32=Vv,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,n=this.uint32(),r=this.pos-t;if(r>5||r==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=n>>>3,i=n&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,n,r=100){let o=this.pos;switch(t){case Fn.Varint:for(;this.buf[this.pos++]&128;);break;case Fn.Bit64:this.pos+=4;case Fn.Bit32:this.pos+=4;break;case Fn.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Fn.StartGroup:if(r<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Fn.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s,r-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(),Vt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Vt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,n=this.varint64Hi,r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,Vt.dec(t,n)}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 Vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(t){let n=this.bytes(),r=n.length;if(r<=Qv){let o=new Array(r);for(let i=0;i<r;i++){let s=n[i];if(s>127)return this.decodeUtf8(n,t);o[i]=s}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(n,t)}};function kp(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>$_||e<H_)throw new Error("invalid int32: "+e)}function $v(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>B_||e<0)throw new Error("invalid uint32: "+e)}function W_(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 K_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function _p(){return{fields:{}}}var ot={encode(e,t=new fe){return Object.entries(e.fields).forEach(([n,r])=>{r!==void 0&&Np.encode({key:n,value:r},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=_p();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=Np.decode(n,n.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=_p();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,o])=>(o!==void 0&&(n[r]=o),n),{}),t},wrap(e){let t=_p();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function zv(){return{key:"",value:void 0}}var Np={encode(e,t=new fe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&oe.encode(oe.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=zv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=n.string();continue;case 2:if(i!==18)break;o.value=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Np.fromPartial(e??{})},fromPartial(e){let t=zv();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 oe={encode(e,t=new fe){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ot.encode(ot.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Qi.encode(Qi.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Op();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=n.int32();continue;case 2:if(i!==17)break;o.numberValue=n.double();continue;case 3:if(i!==26)break;o.stringValue=n.string();continue;case 4:if(i!==32)break;o.boolValue=n.bool();continue;case 5:if(i!==42)break;o.structValue=ot.unwrap(ot.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.listValue=Qi.unwrap(Qi.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return oe.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=K_.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(C.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new C.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 Qi={encode(e,t=new fe){for(let n of e.values)oe.encode(oe.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Pp();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(oe.unwrap(oe.decode(n,n.uint32())));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Qi.fromPartial(e??{})},fromPartial(e){let t=Pp();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Pp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&C.Array.isArray(e.values)?e.values:e}},Y_=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 Wv(){return{op:0,path:"",from:void 0,value:void 0}}var Pc={encode(e,t=new fe){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&oe.encode(oe.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Wv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=n.int32();continue;case 2:if(i!==18)break;o.path=n.string();continue;case 3:if(i!==26)break;o.from=n.string();continue;case 4:if(i!==34)break;o.value=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=Wv();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Kv(){return{id:"",type:"",function:void 0,metadata:void 0}}var Nc={encode(e,t=new fe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Fc.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ot.encode(ot.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Kv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.type=n.string();continue;case 3:if(i!==26)break;o.function=Fc.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.metadata=ot.unwrap(ot.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Nc.fromPartial(e??{})},fromPartial(e){let t=Kv();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Fc.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function Yv(){return{name:"",arguments:""}}var Fc={encode(e,t=new fe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Yv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=n.string();continue;case 2:if(i!==18)break;o.arguments=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Fc.fromPartial(e??{})},fromPartial(e){let t=Yv();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Xv(){return{value:"",mimeType:""}}var Dc={encode(e,t=new fe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Xv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=n.string();continue;case 2:if(i!==18)break;o.mimeType=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Dc.fromPartial(e??{})},fromPartial(e){let t=Xv();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function Zv(){return{value:"",mimeType:void 0}}var Mc={encode(e,t=new fe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Zv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=n.string();continue;case 2:if(i!==18)break;o.mimeType=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Mc.fromPartial(e??{})},fromPartial(e){let t=Zv();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function Jv(){return{data:void 0,url:void 0}}var At={encode(e,t=new fe){return e.data!==void 0&&Dc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Mc.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=Jv();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Dc.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.url=Mc.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return At.fromPartial(e??{})},fromPartial(e){let t=Jv();return t.data=e.data!==void 0&&e.data!==null?Dc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Mc.fromPartial(e.url):void 0,t}};function eS(){return{text:""}}var Lc={encode(e,t=new fe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=eS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Lc.fromPartial(e??{})},fromPartial(e){let t=eS();return t.text=e.text??"",t}};function tS(){return{source:void 0,metadata:void 0}}var jc={encode(e,t=new fe){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&oe.encode(oe.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=tS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return jc.fromPartial(e??{})},fromPartial(e){let t=tS();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function nS(){return{source:void 0,metadata:void 0}}var Uc={encode(e,t=new fe){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&oe.encode(oe.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=nS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Uc.fromPartial(e??{})},fromPartial(e){let t=nS();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function rS(){return{source:void 0,metadata:void 0}}var qc={encode(e,t=new fe){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&oe.encode(oe.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=rS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return qc.fromPartial(e??{})},fromPartial(e){let t=rS();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function oS(){return{source:void 0,metadata:void 0}}var Vc={encode(e,t=new fe){return e.source!==void 0&&At.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&oe.encode(oe.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=oS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=At.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=oe.unwrap(oe.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Vc.fromPartial(e??{})},fromPartial(e){let t=oS();return t.source=e.source!==void 0&&e.source!==null?At.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function iS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Gc={encode(e,t=new fe){return e.text!==void 0&&Lc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&jc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Uc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&qc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Vc.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=iS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Lc.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.image=jc.decode(n,n.uint32());continue;case 3:if(i!==26)break;o.audio=Uc.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.video=qc.decode(n,n.uint32());continue;case 5:if(i!==42)break;o.document=Vc.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Gc.fromPartial(e??{})},fromPartial(e){let t=iS();return t.text=e.text!==void 0&&e.text!==null?Lc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?jc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Uc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?qc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Vc.fromPartial(e.document):void 0,t}};function sS(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Bc={encode(e,t=new fe){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)Nc.encode(n,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 n of e.contentParts)Gc.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&ot.encode(ot.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=sS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.role=n.string();continue;case 3:if(i!==26)break;o.content=n.string();continue;case 4:if(i!==34)break;o.name=n.string();continue;case 5:if(i!==42)break;o.toolCalls.push(Nc.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=n.string();continue;case 7:if(i!==58)break;o.error=n.string();continue;case 8:if(i!==66)break;o.contentParts.push(Gc.decode(n,n.uint32()));continue;case 9:if(i!==74)break;o.metadata=ot.unwrap(ot.decode(n,n.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Bc.fromPartial(e??{})},fromPartial(e){let t=sS();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(n=>Nc.fromPartial(n))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(n=>Gc.fromPartial(n))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function aS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var $c={encode(e,t=new fe){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&oe.encode(oe.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&oe.encode(oe.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=aS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.reason=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.toolCallId=n.string();continue;case 5:if(i!==42)break;o.responseSchema=oe.unwrap(oe.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=n.string();continue;case 7:if(i!==58)break;o.metadata=oe.unwrap(oe.decode(n,n.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return $c.fromPartial(e??{})},fromPartial(e){let t=aS();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}},X_=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 cS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ne={encode(e,t=new fe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&oe.encode(oe.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ot.encode(ot.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=cS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=n.int32();continue;case 2:if(i!==16)break;o.timestamp=Po(n.int64());continue;case 3:if(i!==26)break;o.rawEvent=oe.unwrap(oe.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.metadata=ot.unwrap(ot.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=cS();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 uS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Hc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=uS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.role=n.string();continue;case 4:if(i!==34)break;o.name=n.string();continue;case 5:if(i!==42)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Hc.fromPartial(e??{})},fromPartial(e){let t=uS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 lS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Qc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=lS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.delta=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=lS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function dS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var zc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=dS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=dS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function pS(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Wc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=pS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.toolCallName=n.string();continue;case 4:if(i!==34)break;o.parentMessageId=n.string();continue;case 5:if(i!==42)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=pS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 fS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Kc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=fS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.delta=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=fS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function mS(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Yc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=mS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=mS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function gS(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Xc={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&oe.encode(oe.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=gS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.snapshot=oe.unwrap(oe.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=gS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function hS(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Zc={encode(e,t=new fe){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)Pc.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=hS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.delta.push(Pc.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=hS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(n=>Pc.fromPartial(n))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function yS(){return{baseEvent:void 0,messages:[]}}var Jc={encode(e,t=new fe){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Bc.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=yS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messages.push(Bc.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=yS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(n=>Bc.fromPartial(n))||[],t}};function vS(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var eu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&oe.encode(oe.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=vS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.event=oe.unwrap(oe.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.source=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return eu.fromPartial(e??{})},fromPartial(e){let t=vS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 SS(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var tu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&oe.encode(oe.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=SS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.name=n.string();continue;case 3:if(i!==26)break;o.value=oe.unwrap(oe.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=SS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function bS(){return{baseEvent:void 0,threadId:"",runId:""}}var nu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=bS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.threadId=n.string();continue;case 3:if(i!==26)break;o.runId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return nu.fromPartial(e??{})},fromPartial(e){let t=bS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function AS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var _r={encode(e,t=new fe){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=AS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=n.string();continue;case 2:if(i!==18)break;o.model=n.string();continue;case 3:if(i!==24)break;o.inputTokens=Po(n.int64());continue;case 4:if(i!==32)break;o.outputTokens=Po(n.int64());continue;case 5:if(i!==40)break;o.totalTokens=Po(n.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Po(n.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Po(n.int64());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return _r.fromPartial(e??{})},fromPartial(e){let t=AS();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function wS(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var ru={encode(e,t=new fe){e.baseEvent!==void 0&&ne.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&&oe.encode(oe.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)$c.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)_r.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=wS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.threadId=n.string();continue;case 3:if(i!==26)break;o.runId=n.string();continue;case 4:if(i!==34)break;o.result=oe.unwrap(oe.decode(n,n.uint32()));continue;case 5:if(i!==42)break;o.outcome=n.string();continue;case 6:if(i!==50)break;o.interrupts.push($c.decode(n,n.uint32()));continue;case 7:if(i!==58)break;o.usage.push(_r.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=wS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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(n=>$c.fromPartial(n))||[],t.usage=e.usage?.map(n=>_r.fromPartial(n))||[],t}};function CS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ou={encode(e,t=new fe){e.baseEvent!==void 0&&ne.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 n of e.usage)_r.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=CS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.code=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.usage.push(_r.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ou.fromPartial(e??{})},fromPartial(e){let t=CS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(n=>_r.fromPartial(n))||[],t}};function ES(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var iu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=ES();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.stepName=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return iu.fromPartial(e??{})},fromPartial(e){let t=ES();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function xS(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var su={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=xS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.stepName=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=xS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function IS(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var au={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=IS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.role=n.string();continue;case 4:if(i!==34)break;o.delta=n.string();continue;case 5:if(i!==42)break;o.name=n.string();continue;case 6:if(i!==50)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return au.fromPartial(e??{})},fromPartial(e){let t=IS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 RS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var cu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=RS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.toolCallName=n.string();continue;case 4:if(i!==34)break;o.parentMessageId=n.string();continue;case 5:if(i!==42)break;o.delta=n.string();continue;case 6:if(i!==50)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=RS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 TS(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var uu={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=TS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.name=n.string();continue;case 4:if(i!==34)break;o.description=n.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=n.string();continue;case 6:if(i!==50)break;o.parentToolCallId=n.string();continue;case 7:if(i!==58)break;o.parentMessageId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=TS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 kS(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var lu={encode(e,t=new fe){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&oe.encode(oe.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=kS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.result=oe.unwrap(oe.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.outcome=n.string();continue;case 5:if(i!==42)break;o.interruptIds.push(n.string());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=kS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(n=>n)||[],t}};function _S(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var du={encode(e,t=new fe){return e.baseEvent!==void 0&&ne.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 n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=_S();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.code=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=_S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function OS(){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 PS={encode(e,t=new fe){return e.textMessageStart!==void 0&&Hc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Qc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&zc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Wc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Kc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Yc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Xc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Zc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Jc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&eu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&tu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&nu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&ru.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ou.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&iu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&su.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&au.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&cu.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&uu.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&lu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&du.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,o=OS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=Hc.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=Qc.decode(n,n.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=zc.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=Wc.decode(n,n.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Kc.decode(n,n.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Yc.decode(n,n.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Xc.decode(n,n.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Zc.decode(n,n.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=Jc.decode(n,n.uint32());continue;case 10:if(i!==82)break;o.raw=eu.decode(n,n.uint32());continue;case 11:if(i!==90)break;o.custom=tu.decode(n,n.uint32());continue;case 12:if(i!==98)break;o.runStarted=nu.decode(n,n.uint32());continue;case 13:if(i!==106)break;o.runFinished=ru.decode(n,n.uint32());continue;case 14:if(i!==114)break;o.runError=ou.decode(n,n.uint32());continue;case 15:if(i!==122)break;o.stepStarted=iu.decode(n,n.uint32());continue;case 16:if(i!==130)break;o.stepFinished=su.decode(n,n.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=au.decode(n,n.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=cu.decode(n,n.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=uu.decode(n,n.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=lu.decode(n,n.uint32());continue;case 21:if(i!==170)break;o.subagentError=du.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return PS.fromPartial(e??{})},fromPartial(e){let t=OS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Hc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Qc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?zc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Wc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Kc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Yc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Xc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Zc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Jc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?eu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?tu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?nu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?ru.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ou.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?iu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?su.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?au.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?cu.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?uu.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?lu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?du.fromPartial(e.subagentError):void 0,t}};function Po(e){let t=C.Number(e.toString());if(t>C.Number.MAX_SAFE_INTEGER)throw new C.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<C.Number.MIN_SAFE_INTEGER)throw new C.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var NS=e=>e&&typeof e=="object"?e:void 0;var Oc=e=>{let t=NS(e);if(t){if(t.data){let n=t.data;return{type:"data",value:n.value,mimeType:n.mimeType}}if(t.url){let n=t.url;return{type:"url",value:n.value,mimeType:n.mimeType}}}},Z_=e=>{let t=NS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let n=t.image;return{type:"image",source:Oc(n.source),metadata:n.metadata}}if(t.audio){let n=t.audio;return{type:"audio",source:Oc(n.source),metadata:n.metadata}}if(t.video){let n=t.video;return{type:"video",source:Oc(n.source),metadata:n.metadata}}if(t.document){let n=t.document;return{type:"document",source:Oc(n.source),metadata:n.metadata}}}};function FS(e){let t=PS.decode(e),n=Object.values(t).find(r=>r!==void 0);if(!n)throw new Error("Invalid event");if(n.type=X_[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===F.MESSAGES_SNAPSHOT)for(let r of n.messages){let o=r;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(s=>Z_(s)).filter(s=>s!==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(n.type===F.RUN_FINISHED){let r=n,o=typeof r.outcome=="string"&&r.outcome!==""?r.outcome:void 0,i=Array.isArray(r.interrupts)?r.interrupts:[];delete r.interrupts,o==="interrupt"?r.outcome={type:"interrupt",interrupts:i}:o==="success"?r.outcome={type:"success"}:delete r.outcome}if(n.type===F.SUBAGENT_FINISHED){let r=n,o=typeof r.outcome=="string"&&r.outcome!==""?r.outcome:void 0,i=Array.isArray(r.interruptIds)?r.interruptIds:[];delete r.interruptIds,o==="suspended"?r.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?r.outcome={type:"success"}:delete r.outcome}if((n.type===F.RUN_FINISHED||n.type===F.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===F.STATE_DELTA)for(let r of n.delta)r.op=Y_[r.op].toLowerCase(),Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o]});return Object.keys(n).forEach(r=>{n[r]===void 0&&delete n[r]}),Wa.parse(n)}var Fp="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var eO=/^[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(eO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},DS=e=>e==="*"||e==="x"||e==="X",MS=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},tO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],nO=(e,t)=>{if(DS(e)||DS(t))return 0;let[n,r]=tO(MS(e),MS(t));return n>r?1:n<r?-1:0},Mp=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){let r=nO(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0};var No=(e,t)=>{let n=Dp(e),r=Dp(t),o=n.pop(),i=r.pop(),s=Mp(n,r);return s!==0?s:o&&i?Mp(o.split("."),i.split(".")):o||i?o?-1:1:0};var Ee=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function zi(){return Tn()}function Up(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Up(t);return e}var LS=512*1024;function jS(e,t,n){let r=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let s=o.pop();if(typeof s=="string"){if(r+=s.length,r>n)return!0}else if(typeof s=="object"&&s){if(i.has(s))continue;if(i.add(s),Array.isArray(s))for(let a=0;a<s.length;a++)o.push(s[a]);else{let a=Object.keys(s);for(let u=0;u<a.length;u++){let c=a[u];if(r+=c.length,r>n)return!0;o.push(s[c])}}}}return!1}function ke(_x83,_x84,_x85,_x86){return _ke.apply(this,arguments)}function _ke(){_ke=_asyncToGenerator(function*(e,t,n,r){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=s&&!jS(t,n,LS),u=a?Ee(t):t,c=a?Ee(n):n,g=!1,v=!1,x;for(let h of e)try{a&&(Up(u),Up(c));let y=yield r(h,u,c);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==u&&(u=Ee(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==c&&(c=Ee(y.state),v=!0,b=!0),a&&b&&jS(u,c,LS)&&(a=!1),x=y.stopPropagation,x===!0)break}catch(y){if(s&&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)?Ee(u):u}:{}),...(v?{state:Object.isFrozen(c)?Ee(c):c}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _ke.apply(this,arguments)}function pu(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,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function Wi(e){if(e instanceof qp)return e;if(e===!0)return new qp(pu(!0))}var qp=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n=="string"?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Lp(e){return e.enabled?new qp(e):void 0}function rO(e,t,n){if(t){let o=e.find(s=>s.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?n:t,role:"assistant",toolCalls:[]};return e.push(i),i}let r={id:n,role:"assistant",toolCalls:[]};return e.push(r),r}function wt(e,t){return!e||t.metadata===void 0?!1:(e.metadata=ov(e.metadata,Ee(t.metadata)),!0)}var WS=(e,t,n,r,o)=>{let i=Wi(o),s=Ee(n.messages),a=Ee(e.state),u={},c=v=>{v.messages!==void 0&&(s=v.messages,u.messages=v.messages),v.state!==void 0&&(a=v.state,u.state=v.state)},g=()=>{let v=Ee(u);return u={},v.messages!==void 0||v.state!==void 0?Te(v):dc};return t.pipe(Ic(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(v){let x=yield ke(r,s,a,(h,y,b)=>h.onEvent?.({event:v,agent:n,input:e,messages:y,state:b}));if(c(x),x.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:r.length}),x.stopPropagation===!0)return g();switch(v.type){case F.TEXT_MESSAGE_START:{let h=yield ke(r,s,a,(y,b,w)=>y.onTextMessageStartEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:w,subagentRunId:R}=v,N=s.find(A=>A.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 k=N;if(!k){let A={id:y,role:b,content:"",...(w!==void 0&&{name:w}),...(R!=null&&{subagentRunId:R})};s.push(A),k=A}let P=wt(k,v);(!N||P)&&c({messages:s})}return g()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=s.find(R=>R.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 w=yield ke(r,s,a,(R,N,k)=>R.onTextMessageContentEvent?.({event:v,messages:N,state:k,agent:n,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return c(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,wt(b,v),c({messages:s})),g()}case F.TEXT_MESSAGE_END:{let{messageId:h}=v,y=s.find(w=>w.id===h);if(!y)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(y.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let b=yield ke(r,s,a,(w,R,N)=>w.onTextMessageEndEvent?.({event:v,messages:R,state:N,agent:n,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&wt(y,v)&&c({messages:s}),yield Promise.all(r.map(w=>{w.onNewMessage?.({message:y,messages:s,state:a,agent:n,input:e})})),g()}case F.TOOL_CALL_START:{let h=yield ke(r,s,a,(y,b,w)=>y.onToolCallStartEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:w,subagentRunId:R}=v,N=s.find(O=>O.toolCalls?.some(_=>_.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),(wt(N,v)||O)&&c({messages:s}),g()}let k=new Set(s.map(O=>O.id)),P=rO(s,w,y);!k.has(P.id)&&R!=null&&P.subagentRunId===void 0&&(P.subagentRunId=R),P.toolCalls??(P.toolCalls=[]);let A={id:y,type:"function",function:{name:b,arguments:""}};P.toolCalls.push(A),wt(A,v),c({messages:s})}return g()}case F.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=v,b=s.find(N=>N.toolCalls?.some(k=>k.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(N=>N.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let R=yield ke(r,s,a,(N,k,P)=>{let A=w.function.arguments,O=w.function.name,_={};try{_=kc(A)}catch{}return N.onToolCallArgsEvent?.({event:v,messages:k,state:P,agent:n,input:e,toolCallBuffer:A,toolCallName:O,partialToolCallArgs:_})});return c(R),R.stopPropagation!==!0&&(w.function.arguments+=y,wt(w,v),c({messages:s})),g()}case F.TOOL_CALL_END:{let{toolCallId:h}=v,y=s.find(R=>R.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(R=>R.id===h);if(!b)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let w=yield ke(r,s,a,(R,N,k)=>{let P=b.function.arguments,A=b.function.name,O={};try{O=JSON.parse(P)}catch{}return R.onToolCallEndEvent?.({event:v,messages:N,state:k,agent:n,input:e,toolCallName:A,toolCallArgs:O})});return c(w),w.stopPropagation!==!0&&wt(b,v)&&c({messages:s}),yield Promise.all(r.map(R=>{R.onNewToolCall?.({toolCall:b,messages:s,state:a,agent:n,input:e})})),g()}case F.TOOL_CALL_RESULT:{let h=yield ke(r,s,a,(y,b,w)=>y.onToolCallResultEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:w,role:R,subagentRunId:N}=v,k={id:y,toolCallId:b,role:R||"tool",content:w,...(N!=null&&{subagentRunId:N})};wt(k,v);let P=s.findIndex(A=>A.role==="assistant"&&A.toolCalls?.some(O=>O.id===b));if(P===-1)s.push(k);else{let A=P+1;for(;A<s.length&&s[A].role==="tool";)A++;s.splice(A,0,k)}yield Promise.all(r.map(A=>{A.onNewMessage?.({message:k,messages:s,state:a,agent:n,input:e})})),c({messages:s})}return g()}case F.STATE_SNAPSHOT:{let h=yield ke(r,s,a,(y,b,w)=>y.onStateSnapshotEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:y}=v;a=y,c({state:a})}return g()}case F.STATE_DELTA:{let h=yield ke(r,s,a,(y,b,w)=>y.onStateDeltaEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:y}=v;try{a=nc.applyPatch(a,y,!0,!1).newDocument,c({state:a})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=n}});m();d();p();f();function Ji(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Do=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=vn(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(A){t={error:A}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var g=this.initialTeardown;if(be(g))try{g()}catch(A){i=A instanceof yc?A.errors:[A]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var E=vn(y),h=E.next();!h.done;h=E.next()){var v=h.value;try{Dv(v)}catch(A){i=i??[],A instanceof yc?i=No(No([],Po(i)),Po(A.errors)):i.push(A)}}}catch(A){r={error:A}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(r)throw r.error}}}if(i)throw new yc(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Dv(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Ji(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Ji(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var If=Do.EMPTY;function vc(e){return e instanceof Do||e&&"closed"in e&&be(e.remove)&&be(e.add)&&be(e.unsubscribe)}function Dv(e){be(e)?e():e.unsubscribe()}m();d();p();f();var Vt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();p();f();m();d();p();f();var Mo={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=Mo.delegate;return o?.setTimeout?o.setTimeout.apply(o,No([e,t],Po(n))):setTimeout.apply(void 0,No([e,t],Po(n)))},clearTimeout:function(e){var t=Mo.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Sc(e){Mo.setTimeout(function(){var t=Vt.onUnhandledError;if(t)t(e);else throw e})}m();d();p();f();function es(){}m();d();p();f();var Mv=function(){return Rf("C",void 0,void 0)}();function Lv(e){return Rf("E",void 0,e)}function jv(e){return Rf("N",e,void 0)}function Rf(e,t,n){return{kind:e,value:t,error:n}}m();d();p();f();var Pr=null;function Lo(e){if(Vt.useDeprecatedSynchronousErrorHandling){var t=!Pr;if(t&&(Pr={errorThrown:!1,error:null}),e(),t){var n=Pr,r=n.errorThrown,o=n.error;if(Pr=null,r)throw o}}else e()}function qv(e){Vt.useDeprecatedSynchronousErrorHandling&&Pr&&(Pr.errorThrown=!0,Pr.error=e)}var ts=function(e){Jt(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,vc(n)&&n.add(r)):r.destination=tO,r}return t.create=function(n,r,o){return new Ac(n,r,o)},t.prototype.next=function(n){this.isStopped?kf(jv(n),this):this._next(n)},t.prototype.error=function(n){this.isStopped?kf(Lv(n),this):(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped?kf(Mv,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(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Do);var Z_=Function.prototype.bind;function Tf(e,t){return Z_.call(e,t)}var J_=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){bc(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){bc(r)}else bc(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){bc(n)}},e}(),Ac=function(e){Jt(t,e);function t(n,r,o){var i=e.call(this)||this,s;if(be(n)||!n)s={next:n??void 0,error:r??void 0,complete:o??void 0};else{var a;i&&Vt.useDeprecatedNextContext?(a=Object.create(n),a.unsubscribe=function(){return i.unsubscribe()},s={next:n.next&&Tf(n.next,a),error:n.error&&Tf(n.error,a),complete:n.complete&&Tf(n.complete,a)}):s=n}return i.destination=new J_(s),i}return t}(ts);function bc(e){Vt.useDeprecatedSynchronousErrorHandling?qv(e):Sc(e)}function eO(e){throw e}function kf(e,t){var n=Vt.onStoppedNotification;n&&Mo.setTimeout(function(){return n(e,t)})}var tO={closed:!0,next:es,error:eO,complete:es};m();d();p();f();var jo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();p();f();m();d();p();f();function qo(e){return e}function wc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _f(e)}function _f(e){return e.length===0?qo:e.length===1?e[0]:function(n){return e.reduce(function(r,o){return o(r)},n)}}var je=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,i=rO(t)?t:new Ac(t,n,r);return Lo(function(){var s=o,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=Uv(n),new n(function(o,i){var s=new Ac({next:function(a){try{t(a)}catch(u){i(u),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[jo]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return _f(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=Uv(t),new t(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},e.create=function(t){return new e(t)},e}();function Uv(e){var t;return(t=e??Vt.Promise)!==null&&t!==void 0?t:Promise}function nO(e){return e&&be(e.next)&&be(e.error)&&be(e.complete)}function rO(e){return e&&e instanceof ts||nO(e)&&vc(e)}m();d();p();f();function oO(e){return be(e?.lift)}function Be(e){return function(t){if(oO(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();p();f();function ze(e,t,n,r,o){return new iO(e,t,n,r,o)}var iO=function(e){Jt(t,e);function t(n,r,o,i,s,a){var u=e.call(this,n)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=r?function(c){try{r(c)}catch(g){n.error(g)}}:e.prototype._next,u._error=i?function(c){try{i(c)}catch(g){n.error(g)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=o?function(){try{o()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(ts);m();d();p();f();m();d();p();f();var Vv=Fo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var en=function(e){Jt(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new Gv(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Vv},t.prototype.next=function(n){var r=this;Lo(function(){var o,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=vn(r.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(n)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;Lo(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;Lo(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?If:(this.currentObservers=null,a.push(n),new Do(function(){r.currentObservers=null,Ji(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,i=r.thrownError,s=r.isStopped;o?n.error(i):s&&n.complete()},t.prototype.asObservable=function(){var n=new je;return n.source=this,n},t.create=function(n,r){return new Gv(n,r)},t}(je);var Gv=function(e){Jt(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:If},t}(en);m();d();p();f();m();d();p();f();var Of={now:function(){return(Of.delegate||Date).now()},delegate:void 0};var Cc=function(e){Jt(t,e);function t(n,r,o){n===void 0&&(n=1/0),r===void 0&&(r=1/0),o===void 0&&(o=Of);var i=e.call(this)||this;return i._bufferSize=n,i._windowTime=r,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,n),i._windowTime=Math.max(1,r),i}return t.prototype.next=function(n){var r=this,o=r.isStopped,i=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,u=r._windowTime;o||(i.push(n),!s&&i.push(a.now()+u)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),u=0;u<a.length&&!n.closed;u+=i?1:2)n.next(a[u]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,o=n._timestampProvider,i=n._buffer,s=n._infiniteTimeWindow,a=(s?1:2)*r;if(r<1/0&&a<i.length&&i.splice(0,i.length-a),!s){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}(en);m();d();p();f();var Ec=new je(function(e){return e.complete()});m();d();p();f();m();d();p();f();m();d();p();f();function Bv(e){return e&&be(e.schedule)}function sO(e){return e[e.length-1]}function $v(e){return Bv(sO(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 xc=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();p();f();function Ic(e){return be(e?.then)}m();d();p();f();function Rc(e){return be(e[jo])}m();d();p();f();function Tc(e){return Symbol.asyncIterator&&be(e?.[Symbol.asyncIterator])}m();d();p();f();function kc(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 aO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var _c=aO();function Oc(e){return be(e?.[_c])}m();d();p();f();function Pc(e){return Nv(this,arguments,function(){var n,r,o,i;return hc(this,function(s){switch(s.label){case 0:n=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Or(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,Or(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Or(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Nc(e){return be(e?.getReader)}function Ze(e){if(e instanceof je)return e;if(e!=null){if(Rc(e))return cO(e);if(xc(e))return uO(e);if(Ic(e))return lO(e);if(Tc(e))return Hv(e);if(Oc(e))return dO(e);if(Nc(e))return fO(e)}throw kc(e)}function cO(e){return new je(function(t){var n=e[jo]();if(be(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function uO(e){return new je(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function lO(e){return new je(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,Sc)})}function dO(e){return new je(function(t){var n,r;try{for(var o=vn(e),i=o.next();!i.done;i=o.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function Hv(e){return new je(function(t){pO(e,t).catch(function(n){return t.error(n)})})}function fO(e){return Hv(Pc(e))}function pO(e,t){var n,r,o,i;return Pv(this,void 0,void 0,function(){var s,a;return hc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=Fv(e),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),o={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[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 Nt(e,t,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=t.schedule(function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(i),!o)return i}function Fc(e,t){return t===void 0&&(t=0),Be(function(n,r){n.subscribe(ze(r,function(o){return Nt(r,e,function(){return r.next(o)},t)},function(){return Nt(r,e,function(){return r.complete()},t)},function(o){return Nt(r,e,function(){return r.error(o)},t)}))})}m();d();p();f();function Dc(e,t){return t===void 0&&(t=0),Be(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Qv(e,t){return Ze(e).pipe(Dc(t),Fc(t))}m();d();p();f();function zv(e,t){return Ze(e).pipe(Dc(t),Fc(t))}m();d();p();f();function Wv(e,t){return new je(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}m();d();p();f();function Kv(e,t){return new je(function(n){var r;return Nt(n,t,function(){r=e[_c](),Nt(n,t,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return be(r?.return)&&r.return()}})}m();d();p();f();function Mc(e,t){if(!e)throw new Error("Iterable cannot be null");return new je(function(n){Nt(n,t,function(){var r=e[Symbol.asyncIterator]();Nt(n,t,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}m();d();p();f();function Yv(e,t){return Mc(Pc(e),t)}function Xv(e,t){if(e!=null){if(Rc(e))return Qv(e,t);if(xc(e))return Wv(e,t);if(Ic(e))return zv(e,t);if(Tc(e))return Mc(e,t);if(Oc(e))return Kv(e,t);if(Nc(e))return Yv(e,t)}throw kc(e)}function Nr(e,t){return t?Xv(e,t):Ze(e)}function ke(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=$v(e);return Nr(e,n)}m();d();p();f();function le(e,t){var n=be(e)?e:function(){return e},r=function(o){return o.error(n())};return new je(t?function(o){return t.schedule(r,0,o)}:r)}m();d();p();f();m();d();p();f();var Zv=Fo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Lc(e,t){var n=typeof t=="object";return new Promise(function(r,o){var i=!1,s;e.subscribe({next:function(a){s=a,i=!0},error:o,complete:function(){i?r(s):n?r(t.defaultValue):o(new Zv)}})})}m();d();p();f();function Mn(e,t){return Be(function(n,r){var o=0;n.subscribe(ze(r,function(i){r.next(e.call(t,i,o++))}))})}m();d();p();f();m();d();p();f();m();d();p();f();function Jv(e,t,n,r,o,i,s,a){var u=[],c=0,g=0,y=!1,E=function(){y&&!u.length&&!c&&t.complete()},h=function(A){return c<r?v(A):u.push(A)},v=function(A){i&&t.next(A),c++;var C=!1;Ze(n(A,g++)).subscribe(ze(t,function(w){o?.(w),i?h(w):t.next(w)},function(){C=!0},void 0,function(){if(C)try{c--;for(var w=function(){var k=u.shift();s?Nt(t,s,function(){return v(k)}):v(k)};u.length&&c<r;)w();E()}catch(k){t.error(k)}}))};return e.subscribe(ze(t,h,function(){y=!0,E()})),function(){a?.()}}function yt(e,t,n){return n===void 0&&(n=1/0),be(t)?yt(function(r,o){return Mn(function(i,s){return t(r,i,o,s)})(Ze(e(r,o)))},n):(typeof t=="number"&&(n=t),Be(function(r,o){return Jv(r,o,e,n)}))}function Pf(e){return e===void 0&&(e=1/0),yt(qo,e)}m();d();p();f();function jc(e){return new je(function(t){Ze(e()).subscribe(t)})}m();d();p();f();function Nf(e,t){return Be(function(n,r){var o=0;n.subscribe(ze(r,function(i){return e.call(t,i,o++)&&r.next(i)}))})}m();d();p();f();function ns(e){return Be(function(t,n){var r=null,o=!1,i;r=t.subscribe(ze(n,void 0,void 0,function(s){i=Ze(e(s,ns(e)(t))),r?(r.unsubscribe(),r=null,i.subscribe(n)):o=!0})),o&&(r.unsubscribe(),r=null,i.subscribe(n))})}m();d();p();f();function qc(e,t){return be(t)?yt(e,t,1):yt(e,1)}m();d();p();f();function Ff(e){return Be(function(t,n){var r=!1;t.subscribe(ze(n,function(o){r=!0,n.next(o)},function(){r||n.next(e),n.complete()}))})}m();d();p();f();function Fr(e){return Be(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}m();d();p();f();function Df(e,t){return Be(function(n,r){var o=null,i=0,s=!1,a=function(){return s&&!o&&r.complete()};n.subscribe(ze(r,function(u){o?.unsubscribe();var c=0,g=i++;Ze(e(u,g)).subscribe(o=ze(r,function(y){return r.next(t?t(u,y,g,c++):y)},function(){o=null,a()}))},function(){s=!0,a()}))})}m();d();p();f();function Uc(e){return Be(function(t,n){Ze(e).subscribe(ze(n,function(){return n.complete()},es)),!n.closed&&t.subscribe(n)})}m();d();p();f();function Vc(e,t,n){var r=be(e)||t||n?{next:e,error:t,complete:n}:e;return r?Be(function(o,i){var s;(s=r.subscribe)===null||s===void 0||s.call(r);var a=!0;o.subscribe(ze(i,function(u){var c;(c=r.next)===null||c===void 0||c.call(r,u),i.next(u)},function(){var u;a=!1,(u=r.complete)===null||u===void 0||u.call(r),i.complete()},function(u){var c;a=!1,(c=r.error)===null||c===void 0||c.call(r,u),i.error(u)},function(){var u,c;a&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):qo}m();d();p();f();m();d();p();f();function eS(e){return` \r
36
+ `.indexOf(e)>=0}function Gc(e){for(var t=["topLevel"],n=0,r,o,i,s=function(k){return t.push(k)},a=function(k){return t[t.length-1]=k},u=function(k){r==null&&(r=n,o=t.length,i=k)},c=function(k){k===i&&(r=void 0,o=void 0,i=void 0)},g=function(){return t.pop()},y=function(){return n--},E=function(k){if("0"<=k&&k<="9"){s("number");return}switch(k){case"\"":s("string");return;case"-":s("numberNeedsDigit");return;case"t":s("true");return;case"f":s("false");return;case"n":s("null");return;case"[":s("arrayNeedsValue");return;case"{":s("objectNeedsKey");return}},h=e.length;n<h;n++){var v=e[n];switch(t[t.length-1]){case"topLevel":E(v);break;case"string":switch(v){case"\"":g();break;case"\\":u("stringEscape"),s("stringEscaped");break}break;case"stringEscaped":v==="u"?s("stringUnicode"):(c("stringEscape"),g());break;case"stringUnicode":n-e.lastIndexOf("u",n)===4&&(c("stringEscape"),g());break;case"number":v==="."?a("numberNeedsDigit"):v==="e"||v==="E"?a("numberNeedsExponent"):(v<"0"||v>"9")&&(y(),g());break;case"numberNeedsDigit":a("number");break;case"numberNeedsExponent":a(v==="+"||v==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(v<"a"||v>"z")&&(y(),g());break;case"arrayNeedsValue":v==="]"?g():eS(v)||(c("collectionItem"),a("arrayNeedsComma"),E(v));break;case"arrayNeedsComma":v==="]"?g():v===","&&(u("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":v==="}"?g():v==="\""&&(u("collectionItem"),a("objectNeedsColon"),s("string"));break;case"objectNeedsColon":v===":"&&a("objectNeedsValue");break;case"objectNeedsValue":eS(v)||(c("collectionItem"),a("objectNeedsComma"),E(v));break;case"objectNeedsComma":v==="}"?g():v===","&&(u("collectionItem"),a("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var A=[r!=null?e.slice(0,r):e],C=function(k){return A.push(k.slice(e.length-e.lastIndexOf(k[0])))},w=t.length-1;w>=0;w--)switch(t[w]){case"string":A.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":A.push("0");break;case"true":C("true");break;case"false":C("false");break;case"null":C("null");break;case"arrayNeedsValue":case"arrayNeedsComma":A.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":A.push("}");break}return A.join("")}m();d();p();f();m();d();p();f();m();d();p();f();function nS(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let s=e[t++];if(n|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}let o=e[t++];if(n|=(o&15)<<28,r=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(r|=(s&127)<<i,(s&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}throw new Error("invalid varint")}var Bc=4294967296;function Mf(e){let t=e[0]==="-";t&&(e=e.slice(1));let n=1e6,r=0,o=0;function i(s,a){let u=Number(e.slice(s,a));o*=n,r=r*n+u,r>=Bc&&(o=o+(r/Bc|0),r=r%Bc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?oS(r,o):jf(r,o)}function rS(e,t){let n=jf(e,t),r=n.hi&2147483648;r&&(n=oS(n.lo,n.hi));let o=Lf(n.lo,n.hi);return r?"-"+o:o}function Lf(e,t){if({lo:e,hi:t}=mO(e,t),t<=2097151)return String(Bc*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=n+r*6777216+o*6710656,s=r+o*8147497,a=o*2,u=1e7;return i>=u&&(s+=Math.floor(i/u),i%=u),s>=u&&(a+=Math.floor(s/u),s%=u),a.toString()+tS(s)+tS(i)}function mO(e,t){return{lo:e>>>0,hi:t>>>0}}function jf(e,t){return{lo:e|0,hi:t|0}}function oS(e,t){return t=~t,e?e=~e+1:t+=1,jf(e,t)}var tS=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 n=5;(e&128)!==0&&n<10;n++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();p();f();var Gt=gO();function gO(){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"&&(!!x.Deno||!!x.Bun||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let n=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>r||a<n)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s=="bigint"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(n){return typeof n!="string"&&(n=n.toString()),sS(n),n},uParse(n){return typeof n!="string"&&(n=n.toString()),aS(n),n},enc(n){return typeof n!="string"&&(n=n.toString()),sS(n),Mf(n)},uEnc(n){return typeof n!="string"&&(n=n.toString()),aS(n),Mf(n)},dec(n,r){return rS(n,r)},uDec(n,r){return Lf(n,r)}}}function sS(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function aS(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();p();f();var qf;function hO(e){var t;qf=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Vf(e.encodeUtf8.bind(e))})}function Uf(){if(!qf){let e=x;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,n=new e.TextDecoder("utf-8",{ignoreBOM:!0}),r,o={encodeUtf8(s){return t.encode(s)},decodeUtf8(s,a){return a?(r||(r=new e.TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})),r.decode(s)):n.decode(s)},checkUtf8(s){try{return encodeURIComponent(s),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let i=String.prototype.isWellFormed;i&&(o.checkUtf8=s=>i.call(s)),hO(o)}return qf}function Vf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Ln;(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"})(Ln||(Ln={}));var yO=4294967295,vO=2147483647,SO=-2147483648,me=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Vf(t):Uf().encodeUtf8Into,this.buffer=uS,this.viewCache=AO,this.pos=0}ensureCapacity(t){let n=this.pos+t;if(n>this.buffer.length){let r=this.buffer.length||bO;for(;r<n;)r*=2;let o=new Uint8Array(r);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,n=this.viewCache;if(n.byteLength===t.byteLength)return n;let r=new DataView(t.buffer);return this.viewCache=r,r}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(rs),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 n=this.pos-t-rs,r=Gf(n);return r>rs&&(this.ensureCapacity(r-rs),this.buffer.copyWithin(t+r,t+rs,this.pos)),this.pos=t,this.uint32(n),this.pos+=n,this}tag(t,n){return this.uint32((t<<3|n)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(cS(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(Bf(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let n=0;n<9;n++)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 n=t.length;if(n<=lS){this.ensureCapacity(n+1);let u=this.buffer,c=this.pos;u[c++]=n;let g=0;for(;g<n;g++){let y=t.charCodeAt(g);if(y>127)break;u[c++]=y}if(g==n)return this.pos=c,this}this.ensureCapacity(n*3+5);let r=Gf(n),o=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(t,o.subarray(i+r)),a=Gf(s);return a!=r&&o.copyWithin(i+a,i+r,i+r+s),this.uint32(s),this.pos+=s,this}float(t){return wO(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 cS(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return Bf(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return Bf(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let n=Gt.enc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}fixed64(t){let n=Gt.uEnc(t);this.ensureCapacity(8);let r=this.view();return r.setInt32(this.pos,n.lo,!0),r.setInt32(this.pos+4,n.hi,!0),this.pos+=8,this}int64(t){let n=Gt.enc(t);return this.writeVarint64(n.lo,n.hi)}sint64(t){let n=Gt.enc(t),r=n.hi>>31,o=n.lo<<1^r,i=(n.hi<<1|n.lo>>>31)^r;return this.writeVarint64(o,i)}uint64(t){let n=Gt.uEnc(t);return this.writeVarint64(n.lo,n.hi)}writeVarint64(t,n){this.ensureCapacity(10);let r=this.buffer,o=this.pos;for(let a=0;a<28;a=a+7){let u=t>>>a,c=!(!(u>>>7)&&n==0);if(r[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}let i=t>>>28&15|(n&7)<<4,s=n>>3!=0;if(r[o++]=(s?i|128:i)&255,!s)return this.pos=o,this;for(let a=3;a<31;a=a+7){let u=n>>>a,c=!!(u>>>7);if(r[o++]=(c?u|128:u)&255,!c)return this.pos=o,this}return r[o++]=n>>>31&1,this.pos=o,this}},bO=128,rs=1,uS=new Uint8Array(0),AO=new DataView(uS.buffer),lS=32;function Gf(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var Y=class{constructor(t,n=Uf().decodeUtf8){this.decodeUtf8=n,this.varint64Lo=0,this.varint64Hi=0,this.varint64=nS,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,n=this.uint32(),r=this.pos-t;if(r>5||r==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=n>>>3,i=n&7;if(o<=0||i>5)throw new Error("illegal tag: field no "+o+" wire type "+i);return[o,i]}skip(t,n,r=100){let o=this.pos;switch(t){case Ln.Varint:for(;this.buf[this.pos++]&128;);break;case Ln.Bit64:this.pos+=4;case Ln.Bit32:this.pos+=4;break;case Ln.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Ln.StartGroup:if(r<=0)throw new Error("maximum recursion depth reached");for(;;){let[s,a]=this.tag();if(a===Ln.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s,r-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(),Gt.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Gt.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,n=this.varint64Hi,r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,Gt.dec(t,n)}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 Gt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Gt.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(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(t){let n=this.uint32(),r=this.pos;this.pos+=n,this.assertBounds();let o=this.buf;if(n<=lS){let i=new Array(n);for(let s=0;s<n;s++){let a=o[r+s];if(a>127)return this.decodeUtf8(o.subarray(r,this.pos),t);i[s]=a}return String.fromCharCode.apply(String,i)}return this.decodeUtf8(o.subarray(r,this.pos),t)}};function Bf(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>vO||e<SO)throw new Error("invalid int32: "+e)}function cS(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>yO||e<0)throw new Error("invalid uint32: "+e)}function wO(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 CO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function $f(){return{fields:{}}}var st={encode(e,t=new me){return Object.entries(e.fields).forEach(([n,r])=>{r!==void 0&&zf.encode({key:n,value:r},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=$f();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:{if(i!==10)break;let s=zf.decode(n,n.uint32());s.value!==void 0&&(o.fields[s.key]=s.value);continue}}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=$f();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,o])=>(o!==void 0&&(n[r]=o),n),{}),t},wrap(e){let t=$f();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function dS(){return{key:"",value:void 0}}var zf={encode(e,t=new me){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=dS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=n.string();continue;case 2:if(i!==18)break;o.value=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return zf.fromPartial(e??{})},fromPartial(e){let t=dS();return t.key=e.key??"",t.value=e.value??void 0,t}};function Hf(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var se={encode(e,t=new me){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&&st.encode(st.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&os.encode(os.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=Hf();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=n.int32();continue;case 2:if(i!==17)break;o.numberValue=n.double();continue;case 3:if(i!==26)break;o.stringValue=n.string();continue;case 4:if(i!==32)break;o.boolValue=n.bool();continue;case 5:if(i!==42)break;o.structValue=st.unwrap(st.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.listValue=os.unwrap(os.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Hf();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Hf();if(e===null)t.nullValue=CO.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(x.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new x.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 Qf(){return{values:[]}}var os={encode(e,t=new me){for(let n of e.values)se.encode(se.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=Qf();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(se.unwrap(se.decode(n,n.uint32())));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return os.fromPartial(e??{})},fromPartial(e){let t=Qf();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Qf();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&x.Array.isArray(e.values)?e.values:e}},EO=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 Hc={encode(e,t=new me){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=fS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=n.int32();continue;case 2:if(i!==18)break;o.path=n.string();continue;case 3:if(i!==26)break;o.from=n.string();continue;case 4:if(i!==34)break;o.value=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Hc.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 pS(){return{id:"",type:"",function:void 0,metadata:void 0}}var Qc={encode(e,t=new me){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&zc.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&st.encode(st.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=pS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.type=n.string();continue;case 3:if(i!==26)break;o.function=zc.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.metadata=st.unwrap(st.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Qc.fromPartial(e??{})},fromPartial(e){let t=pS();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?zc.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function mS(){return{name:"",arguments:""}}var zc={encode(e,t=new me){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=mS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=n.string();continue;case 2:if(i!==18)break;o.arguments=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return zc.fromPartial(e??{})},fromPartial(e){let t=mS();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function gS(){return{value:"",mimeType:""}}var Wc={encode(e,t=new me){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=gS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=n.string();continue;case 2:if(i!==18)break;o.mimeType=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Wc.fromPartial(e??{})},fromPartial(e){let t=gS();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function hS(){return{value:"",mimeType:void 0}}var Kc={encode(e,t=new me){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=hS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.value=n.string();continue;case 2:if(i!==18)break;o.mimeType=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Kc.fromPartial(e??{})},fromPartial(e){let t=hS();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function yS(){return{data:void 0,url:void 0}}var Et={encode(e,t=new me){return e.data!==void 0&&Wc.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Kc.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=yS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.data=Wc.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.url=Kc.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Et.fromPartial(e??{})},fromPartial(e){let t=yS();return t.data=e.data!==void 0&&e.data!==null?Wc.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Kc.fromPartial(e.url):void 0,t}};function vS(){return{text:""}}var Yc={encode(e,t=new me){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=vS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Yc.fromPartial(e??{})},fromPartial(e){let t=vS();return t.text=e.text??"",t}};function SS(){return{source:void 0,metadata:void 0}}var Xc={encode(e,t=new me){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=SS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Xc.fromPartial(e??{})},fromPartial(e){let t=SS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function bS(){return{source:void 0,metadata:void 0}}var Zc={encode(e,t=new me){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=bS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Zc.fromPartial(e??{})},fromPartial(e){let t=bS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function AS(){return{source:void 0,metadata:void 0}}var Jc={encode(e,t=new me){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=AS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Jc.fromPartial(e??{})},fromPartial(e){let t=AS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function wS(){return{source:void 0,metadata:void 0}}var eu={encode(e,t=new me){return e.source!==void 0&&Et.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=wS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.source=Et.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.metadata=se.unwrap(se.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return eu.fromPartial(e??{})},fromPartial(e){let t=wS();return t.source=e.source!==void 0&&e.source!==null?Et.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function CS(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var tu={encode(e,t=new me){return e.text!==void 0&&Yc.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Xc.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Zc.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Jc.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&eu.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=CS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.text=Yc.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.image=Xc.decode(n,n.uint32());continue;case 3:if(i!==26)break;o.audio=Zc.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.video=Jc.decode(n,n.uint32());continue;case 5:if(i!==42)break;o.document=eu.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=CS();return t.text=e.text!==void 0&&e.text!==null?Yc.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Xc.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Zc.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Jc.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?eu.fromPartial(e.document):void 0,t}};function ES(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var nu={encode(e,t=new me){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 n of e.toolCalls)Qc.encode(n,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 n of e.contentParts)tu.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&st.encode(st.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=ES();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.role=n.string();continue;case 3:if(i!==26)break;o.content=n.string();continue;case 4:if(i!==34)break;o.name=n.string();continue;case 5:if(i!==42)break;o.toolCalls.push(Qc.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=n.string();continue;case 7:if(i!==58)break;o.error=n.string();continue;case 8:if(i!==66)break;o.contentParts.push(tu.decode(n,n.uint32()));continue;case 9:if(i!==74)break;o.metadata=st.unwrap(st.decode(n,n.uint32()));continue;case 10:if(i!==82)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return nu.fromPartial(e??{})},fromPartial(e){let t=ES();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(n=>Qc.fromPartial(n))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(n=>tu.fromPartial(n))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function xS(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var ru={encode(e,t=new me){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&se.encode(se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&se.encode(se.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=xS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=n.string();continue;case 2:if(i!==18)break;o.reason=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.toolCallId=n.string();continue;case 5:if(i!==42)break;o.responseSchema=se.unwrap(se.decode(n,n.uint32()));continue;case 6:if(i!==50)break;o.expiresAt=n.string();continue;case 7:if(i!==58)break;o.metadata=se.unwrap(se.decode(n,n.uint32()));continue;case 8:if(i!==66)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=xS();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}},xO=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 IS(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var ne={encode(e,t=new me){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&se.encode(se.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&st.encode(st.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=IS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=n.int32();continue;case 2:if(i!==16)break;o.timestamp=Uo(n.int64());continue;case 3:if(i!==26)break;o.rawEvent=se.unwrap(se.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.metadata=st.unwrap(st.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=IS();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 RS(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var ou={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=RS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.role=n.string();continue;case 4:if(i!==34)break;o.name=n.string();continue;case 5:if(i!==42)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return ou.fromPartial(e??{})},fromPartial(e){let t=RS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 TS(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var iu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=TS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.delta=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return iu.fromPartial(e??{})},fromPartial(e){let t=TS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function kS(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var su={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=kS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return su.fromPartial(e??{})},fromPartial(e){let t=kS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function _S(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var au={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=_S();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.toolCallName=n.string();continue;case 4:if(i!==34)break;o.parentMessageId=n.string();continue;case 5:if(i!==42)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return au.fromPartial(e??{})},fromPartial(e){let t=_S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 OS(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var cu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=OS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.delta=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return cu.fromPartial(e??{})},fromPartial(e){let t=OS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function PS(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var uu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=PS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return uu.fromPartial(e??{})},fromPartial(e){let t=PS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function NS(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var lu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&se.encode(se.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=NS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.snapshot=se.unwrap(se.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return lu.fromPartial(e??{})},fromPartial(e){let t=NS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function FS(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var du={encode(e,t=new me){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)Hc.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=FS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.delta.push(Hc.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return du.fromPartial(e??{})},fromPartial(e){let t=FS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(n=>Hc.fromPartial(n))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function DS(){return{baseEvent:void 0,messages:[]}}var fu={encode(e,t=new me){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)nu.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=DS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messages.push(nu.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return fu.fromPartial(e??{})},fromPartial(e){let t=DS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(n=>nu.fromPartial(n))||[],t}};function MS(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var pu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&se.encode(se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=MS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.event=se.unwrap(se.decode(n,n.uint32()));continue;case 3:if(i!==26)break;o.source=n.string();continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return pu.fromPartial(e??{})},fromPartial(e){let t=MS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 LS(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var mu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&se.encode(se.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=LS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.name=n.string();continue;case 3:if(i!==26)break;o.value=se.unwrap(se.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return mu.fromPartial(e??{})},fromPartial(e){let t=LS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function jS(){return{baseEvent:void 0,threadId:"",runId:""}}var gu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=jS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.threadId=n.string();continue;case 3:if(i!==26)break;o.runId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return gu.fromPartial(e??{})},fromPartial(e){let t=jS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function qS(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var Dr={encode(e,t=new me){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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=qS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.provider=n.string();continue;case 2:if(i!==18)break;o.model=n.string();continue;case 3:if(i!==24)break;o.inputTokens=Uo(n.int64());continue;case 4:if(i!==32)break;o.outputTokens=Uo(n.int64());continue;case 5:if(i!==40)break;o.totalTokens=Uo(n.int64());continue;case 6:if(i!==48)break;o.reasoningTokens=Uo(n.int64());continue;case 7:if(i!==56)break;o.cachedInputTokens=Uo(n.int64());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Dr.fromPartial(e??{})},fromPartial(e){let t=qS();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 US(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var hu={encode(e,t=new me){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)ru.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)Dr.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=US();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.threadId=n.string();continue;case 3:if(i!==26)break;o.runId=n.string();continue;case 4:if(i!==34)break;o.result=se.unwrap(se.decode(n,n.uint32()));continue;case 5:if(i!==42)break;o.outcome=n.string();continue;case 6:if(i!==50)break;o.interrupts.push(ru.decode(n,n.uint32()));continue;case 7:if(i!==58)break;o.usage.push(Dr.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return hu.fromPartial(e??{})},fromPartial(e){let t=US();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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(n=>ru.fromPartial(n))||[],t.usage=e.usage?.map(n=>Dr.fromPartial(n))||[],t}};function VS(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var yu={encode(e,t=new me){e.baseEvent!==void 0&&ne.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 n of e.usage)Dr.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=VS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.code=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.usage.push(Dr.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return yu.fromPartial(e??{})},fromPartial(e){let t=VS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(n=>Dr.fromPartial(n))||[],t}};function GS(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var vu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=GS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.stepName=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return vu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function BS(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Su={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=BS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.stepName=n.string();continue;case 3:if(i!==26)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Su.fromPartial(e??{})},fromPartial(e){let t=BS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function $S(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var bu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=$S();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.messageId=n.string();continue;case 3:if(i!==26)break;o.role=n.string();continue;case 4:if(i!==34)break;o.delta=n.string();continue;case 5:if(i!==42)break;o.name=n.string();continue;case 6:if(i!==50)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return bu.fromPartial(e??{})},fromPartial(e){let t=$S();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 HS(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Au={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=HS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.toolCallId=n.string();continue;case 3:if(i!==26)break;o.toolCallName=n.string();continue;case 4:if(i!==34)break;o.parentMessageId=n.string();continue;case 5:if(i!==42)break;o.delta=n.string();continue;case 6:if(i!==50)break;o.subagentRunId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=HS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 QS(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var wu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=QS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.name=n.string();continue;case 4:if(i!==34)break;o.description=n.string();continue;case 5:if(i!==42)break;o.parentSubagentRunId=n.string();continue;case 6:if(i!==50)break;o.parentToolCallId=n.string();continue;case 7:if(i!==58)break;o.parentMessageId=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return wu.fromPartial(e??{})},fromPartial(e){let t=QS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.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 zS(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Cu={encode(e,t=new me){e.baseEvent!==void 0&&ne.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&se.encode(se.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=zS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.result=se.unwrap(se.decode(n,n.uint32()));continue;case 4:if(i!==34)break;o.outcome=n.string();continue;case 5:if(i!==42)break;o.interruptIds.push(n.string());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Cu.fromPartial(e??{})},fromPartial(e){let t=zS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(n=>n)||[],t}};function WS(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var Eu={encode(e,t=new me){return e.baseEvent!==void 0&&ne.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 n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=WS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.subagentRunId=n.string();continue;case 3:if(i!==26)break;o.message=n.string();continue;case 4:if(i!==34)break;o.code=n.string();continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return Eu.fromPartial(e??{})},fromPartial(e){let t=WS();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ne.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function KS(){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 YS={encode(e,t=new me){return e.textMessageStart!==void 0&&ou.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&iu.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&su.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&au.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&cu.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&uu.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&lu.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&du.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&fu.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&pu.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&mu.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&gu.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&hu.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&yu.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&vu.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Su.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&bu.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Au.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&wu.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Cu.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Eu.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof Y?e:new Y(e),r=t===void 0?n.len:n.pos+t,o=KS();for(;n.pos<r;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=ou.decode(n,n.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=iu.decode(n,n.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=su.decode(n,n.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=au.decode(n,n.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=cu.decode(n,n.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=uu.decode(n,n.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=lu.decode(n,n.uint32());continue;case 8:if(i!==66)break;o.stateDelta=du.decode(n,n.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=fu.decode(n,n.uint32());continue;case 10:if(i!==82)break;o.raw=pu.decode(n,n.uint32());continue;case 11:if(i!==90)break;o.custom=mu.decode(n,n.uint32());continue;case 12:if(i!==98)break;o.runStarted=gu.decode(n,n.uint32());continue;case 13:if(i!==106)break;o.runFinished=hu.decode(n,n.uint32());continue;case 14:if(i!==114)break;o.runError=yu.decode(n,n.uint32());continue;case 15:if(i!==122)break;o.stepStarted=vu.decode(n,n.uint32());continue;case 16:if(i!==130)break;o.stepFinished=Su.decode(n,n.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=bu.decode(n,n.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Au.decode(n,n.uint32());continue;case 19:if(i!==154)break;o.subagentStarted=wu.decode(n,n.uint32());continue;case 20:if(i!==162)break;o.subagentFinished=Cu.decode(n,n.uint32());continue;case 21:if(i!==170)break;o.subagentError=Eu.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skip(i&7)}return o},create(e){return YS.fromPartial(e??{})},fromPartial(e){let t=KS();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?ou.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?iu.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?su.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?au.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?cu.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?uu.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?lu.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?du.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?fu.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?pu.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?mu.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?gu.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?hu.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?yu.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?vu.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Su.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?bu.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Au.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?wu.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Cu.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Eu.fromPartial(e.subagentError):void 0,t}};function Uo(e){let t=x.Number(e.toString());if(t>x.Number.MAX_SAFE_INTEGER)throw new x.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<x.Number.MIN_SAFE_INTEGER)throw new x.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var XS=e=>e&&typeof e=="object"?e:void 0;var $c=e=>{let t=XS(e);if(t){if(t.data){let n=t.data;return{type:"data",value:n.value,mimeType:n.mimeType}}if(t.url){let n=t.url;return{type:"url",value:n.value,mimeType:n.mimeType}}}},IO=e=>{let t=XS(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let n=t.image;return{type:"image",source:$c(n.source),metadata:n.metadata}}if(t.audio){let n=t.audio;return{type:"audio",source:$c(n.source),metadata:n.metadata}}if(t.video){let n=t.video;return{type:"video",source:$c(n.source),metadata:n.metadata}}if(t.document){let n=t.document;return{type:"document",source:$c(n.source),metadata:n.metadata}}}};function ZS(e){let t=YS.decode(e),n=Object.values(t).find(r=>r!==void 0);if(!n)throw new Error("Invalid event");if(n.type=xO[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===D.MESSAGES_SNAPSHOT)for(let r of n.messages){let o=r;if(o.role==="user"&&Array.isArray(o.contentParts)){let i=o.contentParts.map(s=>IO(s)).filter(s=>s!==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(n.type===D.RUN_FINISHED){let r=n,o=typeof r.outcome=="string"&&r.outcome!==""?r.outcome:void 0,i=Array.isArray(r.interrupts)?r.interrupts:[];delete r.interrupts,o==="interrupt"?r.outcome={type:"interrupt",interrupts:i}:o==="success"?r.outcome={type:"success"}:delete r.outcome}if(n.type===D.SUBAGENT_FINISHED){let r=n,o=typeof r.outcome=="string"&&r.outcome!==""?r.outcome:void 0,i=Array.isArray(r.interruptIds)?r.interruptIds:[];delete r.interruptIds,o==="suspended"?r.outcome={type:"suspended",...(i.length>0&&{interruptIds:i})}:o==="success"?r.outcome={type:"success"}:delete r.outcome}if((n.type===D.RUN_FINISHED||n.type===D.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===D.STATE_DELTA)for(let r of n.delta)r.op=EO[r.op].toLowerCase(),Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o]});return Object.keys(n).forEach(r=>{n[r]===void 0&&delete n[r]}),ac.parse(n)}var Wf="application/vnd.ag-ui.event+proto";m();d();p();f();m();d();p();f();m();d();p();f();var TO=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Kf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(TO);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},JS=e=>e==="*"||e==="x"||e==="X",eb=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},kO=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],_O=(e,t)=>{if(JS(e)||JS(t))return 0;let[n,r]=kO(eb(e),eb(t));return n>r?1:n<r?-1:0},Yf=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){let r=_O(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0};var Vo=(e,t)=>{let n=Kf(e),r=Kf(t),o=n.pop(),i=r.pop(),s=Yf(n,r);return s!==0?s:o&&i?Yf(o.split("."),i.split(".")):o||i?o?-1:1:0};var Ee=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function is(){return On()}function Jf(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&Jf(t);return e}var tb=512*1024;function nb(e,t,n){let r=0,o=[e,t],i=new WeakSet;for(;o.length>0;){let s=o.pop();if(typeof s=="string"){if(r+=s.length,r>n)return!0}else if(typeof s=="object"&&s){if(i.has(s))continue;if(i.add(s),Array.isArray(s))for(let a=0;a<s.length;a++)o.push(s[a]);else{let a=Object.keys(s);for(let u=0;u<a.length;u++){let c=a[u];if(r+=c.length,r>n)return!0;o.push(s[c])}}}}return!1}function _e(_x83,_x84,_x85,_x86){return _e2.apply(this,arguments)}function _e2(){_e2=_asyncToGenerator(function*(e,t,n,r){let o=typeof process<"u"&&process.env!==void 0,i=o&&!!process.env.VITEST_WORKER_ID,s=o&&!!process.env.VITEST_WORKER_ID,a=s&&!nb(t,n,tb),u=a?Ee(t):t,c=a?Ee(n):n,g=!1,y=!1,E;for(let h of e)try{a&&(Jf(u),Jf(c));let v=yield r(h,u,c);if(v===void 0)continue;let A=!1;if(v.messages!==void 0&&v.messages!==u&&(u=Ee(v.messages),g=!0,A=!0),v.state!==void 0&&v.state!==c&&(c=Ee(v.state),y=!0,A=!0),a&&A&&nb(u,c,tb)&&(a=!1),E=v.stopPropagation,E===!0)break}catch(v){if(s&&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)?Ee(u):u}:{}),...(y?{state:Object.isFrozen(c)?Ee(c):c}:{}),...(E===void 0?{}:{stopPropagation:E})}});return _e2.apply(this,arguments)}function xu(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,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function ss(e){if(e instanceof ep)return e;if(e===!0)return new ep(xu(!0))}var ep=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n=="string"?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Xf(e){return e.enabled?new ep(e):void 0}function OO(e,t,n){if(t){let o=e.find(s=>s.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?n:t,role:"assistant",toolCalls:[]};return e.push(i),i}let r={id:n,role:"assistant",toolCalls:[]};return e.push(r),r}function xt(e,t){return!e||t.metadata===void 0?!1:(e.metadata=wv(e.metadata,Ee(t.metadata)),!0)}var fb=(e,t,n,r,o)=>{let i=ss(o),s=Ee(n.messages),a=Ee(e.state),u={},c=y=>{y.messages!==void 0&&(s=y.messages,u.messages=y.messages),y.state!==void 0&&(a=y.state,u.state=y.state)},g=()=>{let y=Ee(u);return u={},y.messages!==void 0||y.state!==void 0?ke(y):Ec};return t.pipe(qc(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(y){let E=yield _e(r,s,a,(h,v,A)=>h.onEvent?.({event:y,agent:n,input:e,messages:v,state:A}));if(c(E),E.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:r.length}),E.stopPropagation===!0)return g();switch(y.type){case D.TEXT_MESSAGE_START:{let h=yield _e(r,s,a,(v,A,C)=>v.onTextMessageStartEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,role:A="assistant",name:C,subagentRunId:w}=y,k=s.find(b=>b.id===v);if(k?.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=k;if(!O){let b={id:v,role:A,content:"",...(C!==void 0&&{name:C}),...(w!=null&&{subagentRunId:w})};s.push(b),O=b}let F=xt(O,y);(!k||F)&&c({messages:s})}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:v}=y,A=s.find(w=>w.id===h);if(!A)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(A.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 C=yield _e(r,s,a,(w,k,O)=>w.onTextMessageContentEvent?.({event:y,messages:k,state:O,agent:n,input:e,textMessageBuffer:typeof A.content=="string"?A.content:""}));return c(C),C.stopPropagation!==!0&&(A.content=`${typeof A.content=="string"?A.content:""}${v}`,xt(A,y),c({messages:s})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=y,v=s.find(C=>C.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 A=yield _e(r,s,a,(C,w,k)=>C.onTextMessageEndEvent?.({event:y,messages:w,state:k,agent:n,input:e,textMessageBuffer:typeof v.content=="string"?v.content:""}));return c(A),A.stopPropagation!==!0&&xt(v,y)&&c({messages:s}),yield Promise.all(r.map(C=>{C.onNewMessage?.({message:v,messages:s,state:a,agent:n,input:e})})),g()}case D.TOOL_CALL_START:{let h=yield _e(r,s,a,(v,A,C)=>v.onToolCallStartEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{toolCallId:v,toolCallName:A,parentMessageId:C,subagentRunId:w}=y,k=s.find(T=>T.toolCalls?.some(_=>_.id===v))?.toolCalls?.find(T=>T.id===v);if(k){let T=k.function.name!==A;return T&&(console.warn(`TOOL_CALL_START: tool call '${v}' already exists with name '${k.function.name}' \u2014 updating it to '${A}'`),k.function.name=A),(xt(k,y)||T)&&c({messages:s}),g()}let O=new Set(s.map(T=>T.id)),F=OO(s,C,v);!O.has(F.id)&&w!=null&&F.subagentRunId===void 0&&(F.subagentRunId=w),F.toolCalls??(F.toolCalls=[]);let b={id:v,type:"function",function:{name:A,arguments:""}};F.toolCalls.push(b),xt(b,y),c({messages:s})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:v}=y,A=s.find(k=>k.toolCalls?.some(O=>O.id===h));if(!A)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let C=A.toolCalls?.find(k=>k.id===h);if(!C)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let w=yield _e(r,s,a,(k,O,F)=>{let b=C.function.arguments,T=C.function.name,_={};try{_=Gc(b)}catch{}return k.onToolCallArgsEvent?.({event:y,messages:O,state:F,agent:n,input:e,toolCallBuffer:b,toolCallName:T,partialToolCallArgs:_})});return c(w),w.stopPropagation!==!0&&(C.function.arguments+=v,xt(C,y),c({messages:s})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=y,v=s.find(w=>w.toolCalls?.some(k=>k.id===h));if(!v)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let A=v.toolCalls?.find(w=>w.id===h);if(!A)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let C=yield _e(r,s,a,(w,k,O)=>{let F=A.function.arguments,b=A.function.name,T={};try{T=JSON.parse(F)}catch{}return w.onToolCallEndEvent?.({event:y,messages:k,state:O,agent:n,input:e,toolCallName:b,toolCallArgs:T})});return c(C),C.stopPropagation!==!0&&xt(A,y)&&c({messages:s}),yield Promise.all(r.map(w=>{w.onNewToolCall?.({toolCall:A,messages:s,state:a,agent:n,input:e})})),g()}case D.TOOL_CALL_RESULT:{let h=yield _e(r,s,a,(v,A,C)=>v.onToolCallResultEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,toolCallId:A,content:C,role:w,subagentRunId:k}=y,O={id:v,toolCallId:A,role:w||"tool",content:C,...(k!=null&&{subagentRunId:k})};xt(O,y);let F=s.findIndex(b=>b.role==="assistant"&&b.toolCalls?.some(T=>T.id===A));if(F===-1)s.push(O);else{let b=F+1;for(;b<s.length&&s[b].role==="tool";)b++;s.splice(b,0,O)}yield Promise.all(r.map(b=>{b.onNewMessage?.({message:O,messages:s,state:a,agent:n,input:e})})),c({messages:s})}return g()}case D.STATE_SNAPSHOT:{let h=yield _e(r,s,a,(v,A,C)=>v.onStateSnapshotEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{snapshot:v}=y;a=v,c({state:a})}return g()}case D.STATE_DELTA:{let h=yield _e(r,s,a,(v,A,C)=>v.onStateDeltaEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{delta:v}=y;try{a=gc.applyPatch(a,v,!0,!1).newDocument,c({state:a})}catch(A){let C=A instanceof Error?A.message:String(A);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(a,null,2)}
38
- Patch operations: ${JSON.stringify(y,null,2)}
39
- Error: ${w}`)}}return g()}case F.MESSAGES_SNAPSHOT:{let h=yield ke(r,s,a,(y,b,w)=>y.onMessagesSnapshotEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:y}=v,b=y.map(A=>{if(A.subagentRunId!==null)return A;let O={...A};return delete O.subagentRunId,O}),w=new Map(b.map(A=>[A.id,A])),R=b.some(A=>A.role==="activity"),N=b.some(A=>A.role==="reasoning"),k=A=>A.role==="activity"&&!R||A.role==="reasoning"&&!N;s=s.filter(A=>k(A)||w.has(A.id)).map(A=>k(A)?A:w.get(A.id));let P=new Set(s.map(A=>A.id));for(let A of b)P.has(A.id)||s.push(A);c({messages:s})}return g()}case F.ACTIVITY_SNAPSHOT:{let h=v,y=s.findIndex(k=>k.id===h.messageId),b=y>=0?s[y]:void 0,w=b?.role==="activity"?b:void 0,R=h.replace??!0,N=yield ke(r,s,a,(k,P,A)=>k.onActivitySnapshotEvent?.({event:h,messages:P,state:A,agent:n,input:e,activityMessage:w,existingMessage:b}));if(c(N),N.stopPropagation!==!0){let k={id:h.messageId,role:"activity",activityType:h.activityType,content:Ee(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,A;y===-1?(s.push(k),P=k,A=k):w?(R&&(s[y]={...w,activityType:h.activityType,content:Ee(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete s[y].subagentRunId),A=s[y]):R&&(s[y]=k,P=k,A=k),wt(A,h),c({messages:s}),P&&(yield Promise.all(r.map(O=>O.onNewMessage?.({message:P,messages:s,state:a,agent:n,input:e}))))}return g()}case F.ACTIVITY_DELTA:{let h=v,y=s.findIndex(N=>N.id===h.messageId);if(y===-1)return g();let b=s[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,R=yield ke(r,s,a,(N,k,P)=>N.onActivityDeltaEvent?.({event:h,messages:k,state:P,agent:n,input:e,activityMessage:w}));if(c(R),R.stopPropagation!==!0)try{wt(w,h)&&c({messages:s});let N=Ee(w.content??{}),k=nc.applyPatch(N,h.patch??[],!0,!1).newDocument;s[y]={...w,content:Ee(k),activityType:h.activityType},c({messages:s})}catch(N){let k=N instanceof Error?N.message:String(N);console.warn(`Failed to apply activity patch for '${h.messageId}': ${k}`)}return g()}case F.RAW:return c(yield ke(r,s,a,(h,y,b)=>h.onRawEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.CUSTOM:return c(yield ke(r,s,a,(h,y,b)=>h.onCustomEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.RUN_STARTED:{let h=yield ke(r,s,a,(y,b,w)=>y.onRunStartedEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let y=v;if(y.input?.messages){for(let b of y.input.messages){let w=b;if(b.subagentRunId===null){let R={...b};delete R.subagentRunId,w=R}s.find(R=>R.id===w.id)||s.push(w)}c({messages:s})}}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 ke(r,s,a,(w,R,N)=>w.onRunFinishedEvent?.({...y,messages:R,state:N,agent:n,input:e}));return c(b),b.stopPropagation!==!0&&(n.pendingInterrupts=y.outcome==="interrupt"?y.interrupts.map(w=>{if(w.subagentRunId!==null)return w;let R={...w};return delete R.subagentRunId,R}):[]),g()}case F.RUN_ERROR:return c(yield ke(r,s,a,(h,y,b)=>h.onRunErrorEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.STEP_STARTED:return c(yield ke(r,s,a,(h,y,b)=>h.onStepStartedEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.STEP_FINISHED:return c(yield ke(r,s,a,(h,y,b)=>h.onStepFinishedEvent?.({event:v,messages:y,state:b,agent:n,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 ke(r,s,a,(h,y,b)=>h.onReasoningStartEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.REASONING_MESSAGE_START:{let h=yield ke(r,s,a,(y,b,w)=>y.onReasoningMessageStartEvent?.({event:v,messages:b,state:w,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:y,subagentRunId:b}=v,w=s.find(k=>k.id===y),R=w;if(!R){let k={id:y,role:"reasoning",content:"",...(b!=null&&{subagentRunId:b})};s.push(k),R=k}let N=wt(R,v);(!w||N)&&c({messages:s})}return g()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=v,b=s.find(R=>R.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield ke(r,s,a,(R,N,k)=>R.onReasoningMessageContentEvent?.({event:v,messages:N,state:k,agent:n,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return c(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,wt(b,v),c({messages:s})),g()}case F.REASONING_MESSAGE_END:{let{messageId:h}=v,y=s.find(w=>w.id===h);if(!y)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let b=yield ke(r,s,a,(w,R,N)=>w.onReasoningMessageEndEvent?.({event:v,messages:R,state:N,agent:n,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}));return c(b),b.stopPropagation!==!0&&wt(y,v)&&c({messages:s}),yield Promise.all(r.map(w=>{w.onNewMessage?.({message:y,messages:s,state:a,agent:n,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 ke(r,s,a,(h,y,b)=>h.onReasoningEndEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=v,w=yield ke(r,s,a,(R,N,k)=>R.onReasoningEncryptedValueEvent?.({event:v,messages:N,state:k,agent:n,input:e}));if(c(w),w.stopPropagation!==!0){let R=!1;if(h==="tool-call"){for(let N of s)if(N.role==="assistant"&&N.toolCalls){let k=N.toolCalls.find(P=>P.id===y);if(k){k.encryptedValue=b,R=!0;break}}}else{let N=s.find(k=>k.id===y);N?.role!=="activity"&&N&&(N.encryptedValue=b,R=!0)}R&&(u.messages=s)}return g()}case F.SUBAGENT_STARTED:return c(yield ke(r,s,a,(h,y,b)=>h.onSubagentStartedEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.SUBAGENT_FINISHED:return c(yield ke(r,s,a,(h,y,b)=>h.onSubagentFinishedEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g();case F.SUBAGENT_ERROR:return c(yield ke(r,s,a,(h,y,b)=>h.onSubagentErrorEvent?.({event:v,messages:y,state:b,agent:n,input:e}))),g()}return v.type,g()});return function(_x87){return _ref19.apply(this,arguments)}}()),vp(),r.length>0?bp({}):v=>v)},jp=e=>t=>{let n=Wi(e),r=new Set,o=new Set,i=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},a=!1,u=!1,c=!1,g=new Map,v=A=>{let O=g.get(A);return O||(O=new Map,g.set(A,O)),O},x=()=>{for(let A of g.values())if(A.size>0)return!0;return!1},h=new Map,y=new Set,b=!1,w=!1,R=!1,N=()=>{r.clear(),o.clear(),i.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),g.clear(),h.clear(),y.clear(),b=!1,w=!1,a=!1,u=!1,R=!0},k=(A,O)=>{let _=A??[];if(Array.isArray(_))for(let T of _){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new pe(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let D=T.role==="reasoning"?s.reasoning:T.role==="activity"?s.activity:s.message;(O||!D.has(T.id))&&D.set(T.id,{subagentRunId:T.subagentRunId});for(let q of T.toolCalls??[])q&&typeof q.id=="string"&&(O||!s.toolCall.has(q.id))&&s.toolCall.set(q.id,{subagentRunId:T.subagentRunId??void 0})}},P=(A,O,_,T,D)=>{if(O!==void 0&&_&&_.subagentRunId!==O)return new pe(`Cannot send '${A}': subagentRunId '${O}' does not match the ${T} '${D}' opener's subagent '${_.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(ft(A=>{let O=A.type;if(n?.event("VERIFY","Event:",A,{type:A.type}),u&&O!==F.RUN_STARTED)return ce(()=>new pe(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&O!==F.RUN_ERROR&&O!==F.RUN_STARTED)return ce(()=>new pe(`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(R&&!a&&!u)return ce(()=>new pe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(a||u)&&N()}}else if(c=!0,O!==F.RUN_STARTED&&O!==F.RUN_ERROR)return ce(()=>new pe("First event must be 'RUN_STARTED'"));if(A.subagentRunId===null)return ce(()=>new pe(`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 _=O===F.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===F.SUBAGENT_FINISHED?["outcome"]:["code"];for(let D of _)if(A[D]===null)return ce(()=>new pe(`Cannot send '${O}' with '${D}: null'. The field is optional \u2014 omit it entirely.`));let T=A.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return ce(()=>new pe(`Cannot send '${O}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return ce(()=>new pe(`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 ce(()=>new pe(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===F.RUN_FINISHED){let _=A.outcome;if(_?.type==="interrupt"&&Array.isArray(_.interrupts)){for(let T of _.interrupts)if(T&&T.subagentRunId===null)return ce(()=>new pe(`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 _=A.messageId;if(r.has(_))return ce(()=>new pe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${_}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=s.message.get(_);if(T){let D=P(O,A.subagentRunId,T,"message",_);if(D)return ce(()=>D)}return r.add(_),T||s.message.set(_,{subagentRunId:A.subagentRunId}),Te(A)}case F.TEXT_MESSAGE_CONTENT:{let _=A.messageId;if(!r.has(_))return ce(()=>new pe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${_}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=P(O,A.subagentRunId,s.message.get(_),"message",_);return T?ce(()=>T):Te(A)}case F.TEXT_MESSAGE_END:{let _=A.messageId;if(!r.has(_))return ce(()=>new pe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${_}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=P(O,A.subagentRunId,s.message.get(_),"message",_);return T?ce(()=>T):(r.delete(_),Te(A))}case F.TOOL_CALL_START:{let _=A.toolCallId;if(o.has(_))return ce(()=>new pe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${_}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=A.parentMessageId,D=A.subagentRunId,q;if(T!==void 0){let L=s.message.get(T);if(L){if(D!==void 0&&D!==L.subagentRunId)return ce(()=>new pe(`Cannot send 'TOOL_CALL_START': subagentRunId '${D}' does not match its parent message '${T}' owner '${L.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));q=L}}let M=s.toolCall.get(_);if(M){let L=P(O,D,M,"tool call",_);if(L)return ce(()=>L);if(D===void 0&&q&&q.subagentRunId!==M.subagentRunId)return ce(()=>new pe(`Cannot send 'TOOL_CALL_START': tool call '${_}' is owned by '${M.subagentRunId??"(the parent agent)"}' but its parent message '${T}' is owned by '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(_),M||s.toolCall.set(_,D===void 0?q??{subagentRunId:void 0}:{subagentRunId:D}),Te(A)}case F.TOOL_CALL_ARGS:{let _=A.toolCallId;if(!o.has(_))return ce(()=>new pe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${_}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=P(O,A.subagentRunId,s.toolCall.get(_),"tool call",_);return T?ce(()=>T):Te(A)}case F.TOOL_CALL_END:{let _=A.toolCallId;if(!o.has(_))return ce(()=>new pe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${_}'. A 'TOOL_CALL_START' event must be sent first.`));let T=P(O,A.subagentRunId,s.toolCall.get(_),"tool call",_);return T?ce(()=>T):(o.delete(_),Te(A))}case F.STEP_STARTED:{let _=A.stepName,T=A.subagentRunId;return v(T).has(_)?ce(()=>new pe(`Step "${_}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(v(T).set(_,!0),Te(A))}case F.STEP_FINISHED:{let _=A.stepName,T=A.subagentRunId;if(!v(T).has(_)){let D,q=!1;for(let[M,L]of g)if(M!==T&&L.has(_)){D=M,q=!0;break}return ce(q?()=>new pe(`Cannot send 'STEP_FINISHED' for step "${_}" 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 pe(`Cannot send 'STEP_FINISHED' for step "${_}" that was not started`))}return v(T).delete(_),Te(A)}case F.ACTIVITY_SNAPSHOT:{let _=A.messageId;return(!s.activity.has(_)||A.replace!==!1)&&s.activity.set(_,{subagentRunId:A.subagentRunId}),Te(A)}case F.TOOL_CALL_RESULT:{let _=A.messageId;return typeof _=="string"&&s.message.set(_,{subagentRunId:A.subagentRunId}),Te(A)}case F.REASONING_START:case F.REASONING_MESSAGE_START:{let _=A.messageId,T=s.reasoning.get(_);if(T){let D=P(O,A.subagentRunId,T,"reasoning message",_);if(D)return ce(()=>D)}return i.add(_),T||s.reasoning.set(_,{subagentRunId:A.subagentRunId}),Te(A)}case F.REASONING_MESSAGE_CONTENT:case F.REASONING_MESSAGE_END:case F.REASONING_END:{let _=A.messageId,T=P(O,A.subagentRunId,s.reasoning.get(_),"reasoning message",_);return T?ce(()=>T):(O===F.REASONING_END&&i.delete(_),Te(A))}case F.REASONING_ENCRYPTED_VALUE:{let _=A.entityId,T=A.subtype,D=T==="tool-call"?s.toolCall.get(_):T==="message"?s.message.get(_)??s.reasoning.get(_):s.reasoning.get(_),q=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",M=P(O,A.subagentRunId,D,q,_);return M?ce(()=>M):Te(A)}case F.ACTIVITY_DELTA:{let _=A.messageId,T=P(O,A.subagentRunId,s.activity.get(_),"activity",_);return T?ce(()=>T):Te(A)}case F.SUBAGENT_STARTED:{if(typeof A.subagentRunId!="string")return ce(()=>new pe("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof A.name!="string")return ce(()=>new pe("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let _=A.subagentRunId,T=A.parentSubagentRunId;return h.has(_)?ce(()=>new pe(`Cannot send 'SUBAGENT_STARTED': subagent '${_}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):y.has(_)?ce(()=>new pe(`Cannot send 'SUBAGENT_STARTED': subagent '${_}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!y.has(T)?ce(()=>new pe(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(_,!0),Te(A))}case F.SUBAGENT_FINISHED:case F.SUBAGENT_ERROR:{if(typeof A.subagentRunId!="string")return ce(()=>new pe(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===F.SUBAGENT_ERROR&&typeof A.message!="string")return ce(()=>new pe("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let _=A.subagentRunId;return h.has(_)?(h.delete(_),y.add(_),Te(A)):ce(()=>new pe(`Cannot send '${O}': no active subagent found with ID '${_}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case F.MESSAGES_SNAPSHOT:{let _=k(A.messages,!0);if(_)return ce(()=>_)}return Te(A);case F.RUN_STARTED:R=!0;{let _=k((A.input??{}).messages,!1);if(_)return ce(()=>_)}return Te(A);case F.RUN_FINISHED:if(x()){let _=[];for(let[D,q]of g)for(let M of q.keys())_.push(D===void 0?M:`${M} (subagent '${D}')`);let T=_.join(", ");return ce(()=>new pe(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(r.size>0){let _=Array.from(r.keys()).join(", ");return ce(()=>new pe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${_}`))}if(o.size>0){let _=Array.from(o.keys()).join(", ");return ce(()=>new pe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${_}`))}if(h.size>0){let _=Array.from(h.keys()).join(", ");return ce(()=>new pe(`Cannot send 'RUN_FINISHED' while subagents are still active: ${_}`))}return a=!0,Te(A);case F.RUN_ERROR:return u=!0,Te(A);case F.CUSTOM:return Te(A);case F.THINKING_TEXT_MESSAGE_START:return b?w?ce(()=>new pe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(w=!0,Te(A)):ce(()=>new pe("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 w?Te(A):ce(()=>new pe("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 w?(w=!1,Te(A)):ce(()=>new pe("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?ce(()=>new pe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(b=!0,Te(A));case F.THINKING_END:return b?(b=!1,Te(A)):ce(()=>new pe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Te(A)}}))},Or=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),oO=e=>xc(()=>Tr(e())).pipe(Ap(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Tr(t.text()).pipe(ft(i=>{let s=i;if(o.includes("application/json"))try{s=JSON.parse(i)}catch{}let a=Error(`HTTP ${t.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return a.status=t.status,a.payload=s,ce(()=>a)}))}let n={type:Or.HEADERS,status:t.status,headers:t.headers},r=t.body?.getReader();return r?new Me(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield r.read();if(i)break;let a={type:Or.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{r.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):ce(()=>Error("Failed to getReader() from response"))})),iO=(e,t)=>{let n=Wi(t),r=new Zt,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==Or.HEADERS&&a.type===Or.DATA&&a.data){let u=o.decode(a.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)s(g)}},error:a=>r.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),r.complete()}});function s(a){let u=a.split(`
38
+ Patch operations: ${JSON.stringify(v,null,2)}
39
+ Error: ${C}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=yield _e(r,s,a,(v,A,C)=>v.onMessagesSnapshotEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messages:v}=y,A=v.map(b=>{if(b.subagentRunId!==null)return b;let T={...b};return delete T.subagentRunId,T}),C=new Map(A.map(b=>[b.id,b])),w=A.some(b=>b.role==="activity"),k=A.some(b=>b.role==="reasoning"),O=b=>b.role==="activity"&&!w||b.role==="reasoning"&&!k;s=s.filter(b=>O(b)||C.has(b.id)).map(b=>O(b)?b:C.get(b.id));let F=new Set(s.map(b=>b.id));for(let b of A)F.has(b.id)||s.push(b);c({messages:s})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=y,v=s.findIndex(O=>O.id===h.messageId),A=v>=0?s[v]:void 0,C=A?.role==="activity"?A:void 0,w=h.replace??!0,k=yield _e(r,s,a,(O,F,b)=>O.onActivitySnapshotEvent?.({event:h,messages:F,state:b,agent:n,input:e,activityMessage:C,existingMessage:A}));if(c(k),k.stopPropagation!==!0){let O={id:h.messageId,role:"activity",activityType:h.activityType,content:Ee(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},F,b;v===-1?(s.push(O),F=O,b=O):C?(w&&(s[v]={...C,activityType:h.activityType,content:Ee(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete s[v].subagentRunId),b=s[v]):w&&(s[v]=O,F=O,b=O),xt(b,h),c({messages:s}),F&&(yield Promise.all(r.map(T=>T.onNewMessage?.({message:F,messages:s,state:a,agent:n,input:e}))))}return g()}case D.ACTIVITY_DELTA:{let h=y,v=s.findIndex(k=>k.id===h.messageId);if(v===-1)return g();let A=s[v];if(A.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let C=A,w=yield _e(r,s,a,(k,O,F)=>k.onActivityDeltaEvent?.({event:h,messages:O,state:F,agent:n,input:e,activityMessage:C}));if(c(w),w.stopPropagation!==!0)try{xt(C,h)&&c({messages:s});let k=Ee(C.content??{}),O=gc.applyPatch(k,h.patch??[],!0,!1).newDocument;s[v]={...C,content:Ee(O),activityType:h.activityType},c({messages:s})}catch(k){let O=k instanceof Error?k.message:String(k);console.warn(`Failed to apply activity patch for '${h.messageId}': ${O}`)}return g()}case D.RAW:return c(yield _e(r,s,a,(h,v,A)=>h.onRawEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.CUSTOM:return c(yield _e(r,s,a,(h,v,A)=>h.onCustomEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.RUN_STARTED:{let h=yield _e(r,s,a,(v,A,C)=>v.onRunStartedEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let v=y;if(v.input?.messages){for(let A of v.input.messages){let C=A;if(A.subagentRunId===null){let w={...A};delete w.subagentRunId,C=w}s.find(w=>w.id===C.id)||s.push(C)}c({messages:s})}}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},A=yield _e(r,s,a,(C,w,k)=>C.onRunFinishedEvent?.({...v,messages:w,state:k,agent:n,input:e}));return c(A),A.stopPropagation!==!0&&(n.pendingInterrupts=v.outcome==="interrupt"?v.interrupts.map(C=>{if(C.subagentRunId!==null)return C;let w={...C};return delete w.subagentRunId,w}):[]),g()}case D.RUN_ERROR:return c(yield _e(r,s,a,(h,v,A)=>h.onRunErrorEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.STEP_STARTED:return c(yield _e(r,s,a,(h,v,A)=>h.onStepStartedEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.STEP_FINISHED:return c(yield _e(r,s,a,(h,v,A)=>h.onStepFinishedEvent?.({event:y,messages:v,state:A,agent:n,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 _e(r,s,a,(h,v,A)=>h.onReasoningStartEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=yield _e(r,s,a,(v,A,C)=>v.onReasoningMessageStartEvent?.({event:y,messages:A,state:C,agent:n,input:e}));if(c(h),h.stopPropagation!==!0){let{messageId:v,subagentRunId:A}=y,C=s.find(O=>O.id===v),w=C;if(!w){let O={id:v,role:"reasoning",content:"",...(A!=null&&{subagentRunId:A})};s.push(O),w=O}let k=xt(w,y);(!C||k)&&c({messages:s})}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:v}=y,A=s.find(w=>w.id===h);if(!A)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let C=yield _e(r,s,a,(w,k,O)=>w.onReasoningMessageContentEvent?.({event:y,messages:k,state:O,agent:n,input:e,reasoningMessageBuffer:typeof A.content=="string"?A.content:""}));return c(C),C.stopPropagation!==!0&&(A.content=`${typeof A.content=="string"?A.content:""}${v}`,xt(A,y),c({messages:s})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=y,v=s.find(C=>C.id===h);if(!v)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let A=yield _e(r,s,a,(C,w,k)=>C.onReasoningMessageEndEvent?.({event:y,messages:w,state:k,agent:n,input:e,reasoningMessageBuffer:typeof v.content=="string"?v.content:""}));return c(A),A.stopPropagation!==!0&&xt(v,y)&&c({messages:s}),yield Promise.all(r.map(C=>{C.onNewMessage?.({message:v,messages:s,state:a,agent:n,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 _e(r,s,a,(h,v,A)=>h.onReasoningEndEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:v,encryptedValue:A}=y,C=yield _e(r,s,a,(w,k,O)=>w.onReasoningEncryptedValueEvent?.({event:y,messages:k,state:O,agent:n,input:e}));if(c(C),C.stopPropagation!==!0){let w=!1;if(h==="tool-call"){for(let k of s)if(k.role==="assistant"&&k.toolCalls){let O=k.toolCalls.find(F=>F.id===v);if(O){O.encryptedValue=A,w=!0;break}}}else{let k=s.find(O=>O.id===v);k?.role!=="activity"&&k&&(k.encryptedValue=A,w=!0)}w&&(u.messages=s)}return g()}case D.SUBAGENT_STARTED:return c(yield _e(r,s,a,(h,v,A)=>h.onSubagentStartedEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.SUBAGENT_FINISHED:return c(yield _e(r,s,a,(h,v,A)=>h.onSubagentFinishedEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g();case D.SUBAGENT_ERROR:return c(yield _e(r,s,a,(h,v,A)=>h.onSubagentErrorEvent?.({event:y,messages:v,state:A,agent:n,input:e}))),g()}return y.type,g()});return function(_x87){return _ref19.apply(this,arguments)}}()),Pf(),r.length>0?Ff({}):y=>y)},Zf=e=>t=>{let n=ss(e),r=new Set,o=new Set,i=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},a=!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},E=()=>{for(let b of g.values())if(b.size>0)return!0;return!1},h=new Map,v=new Set,A=!1,C=!1,w=!1,k=()=>{r.clear(),o.clear(),i.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),g.clear(),h.clear(),v.clear(),A=!1,C=!1,a=!1,u=!1,w=!0},O=(b,T)=>{let _=b??[];if(Array.isArray(_))for(let P of _){if(!P||typeof P.id!="string")continue;if(P.subagentRunId===null)return new pe(`Cannot send a message (id '${P.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let N=P.role==="reasoning"?s.reasoning:P.role==="activity"?s.activity:s.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||!s.toolCall.has(M.id))&&s.toolCall.set(M.id,{subagentRunId:P.subagentRunId??void 0})}},F=(b,T,_,P,N)=>{if(T!==void 0&&_&&_.subagentRunId!==T)return new pe(`Cannot send '${b}': subagentRunId '${T}' does not match the ${P} '${N}' opener's subagent '${_.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(yt(b=>{let T=b.type;if(n?.event("VERIFY","Event:",b,{type:b.type}),u&&T!==D.RUN_STARTED)return le(()=>new pe(`Cannot send event type '${T}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&T!==D.RUN_ERROR&&T!==D.RUN_STARTED)return le(()=>new pe(`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(w&&!a&&!u)return le(()=>new pe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(a||u)&&k()}}else if(c=!0,T!==D.RUN_STARTED&&T!==D.RUN_ERROR)return le(()=>new pe("First event must be 'RUN_STARTED'"));if(b.subagentRunId===null)return le(()=>new pe(`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 _=T===D.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:T===D.SUBAGENT_FINISHED?["outcome"]:["code"];for(let N of _)if(b[N]===null)return le(()=>new pe(`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 le(()=>new pe(`Cannot send '${T}' with outcome type '${String(P.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(P&&P.interruptIds===null)return le(()=>new pe(`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 le(()=>new pe(`Cannot send '${T}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(T===D.RUN_FINISHED){let _=b.outcome;if(_?.type==="interrupt"&&Array.isArray(_.interrupts)){for(let P of _.interrupts)if(P&&P.subagentRunId===null)return le(()=>new pe(`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 _=b.messageId;if(r.has(_))return le(()=>new pe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${_}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let P=s.message.get(_);if(P){let N=F(T,b.subagentRunId,P,"message",_);if(N)return le(()=>N)}return r.add(_),P||s.message.set(_,{subagentRunId:b.subagentRunId}),ke(b)}case D.TEXT_MESSAGE_CONTENT:{let _=b.messageId;if(!r.has(_))return le(()=>new pe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${_}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let P=F(T,b.subagentRunId,s.message.get(_),"message",_);return P?le(()=>P):ke(b)}case D.TEXT_MESSAGE_END:{let _=b.messageId;if(!r.has(_))return le(()=>new pe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${_}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let P=F(T,b.subagentRunId,s.message.get(_),"message",_);return P?le(()=>P):(r.delete(_),ke(b))}case D.TOOL_CALL_START:{let _=b.toolCallId;if(o.has(_))return le(()=>new pe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${_}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let P=b.parentMessageId,N=b.subagentRunId,M;if(P!==void 0){let q=s.message.get(P);if(q){if(N!==void 0&&N!==q.subagentRunId)return le(()=>new pe(`Cannot send 'TOOL_CALL_START': subagentRunId '${N}' does not match its parent message '${P}' owner '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));M=q}}let B=s.toolCall.get(_);if(B){let q=F(T,N,B,"tool call",_);if(q)return le(()=>q);if(N===void 0&&M&&M.subagentRunId!==B.subagentRunId)return le(()=>new pe(`Cannot send 'TOOL_CALL_START': tool call '${_}' is owned by '${B.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(_),B||s.toolCall.set(_,N===void 0?M??{subagentRunId:void 0}:{subagentRunId:N}),ke(b)}case D.TOOL_CALL_ARGS:{let _=b.toolCallId;if(!o.has(_))return le(()=>new pe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${_}'. Start a tool call with 'TOOL_CALL_START' first.`));let P=F(T,b.subagentRunId,s.toolCall.get(_),"tool call",_);return P?le(()=>P):ke(b)}case D.TOOL_CALL_END:{let _=b.toolCallId;if(!o.has(_))return le(()=>new pe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${_}'. A 'TOOL_CALL_START' event must be sent first.`));let P=F(T,b.subagentRunId,s.toolCall.get(_),"tool call",_);return P?le(()=>P):(o.delete(_),ke(b))}case D.STEP_STARTED:{let _=b.stepName,P=b.subagentRunId;return y(P).has(_)?le(()=>new pe(`Step "${_}" is already active for 'STEP_STARTED'${P===void 0?"":` in subagent '${P}'`}`)):(y(P).set(_,!0),ke(b))}case D.STEP_FINISHED:{let _=b.stepName,P=b.subagentRunId;if(!y(P).has(_)){let N,M=!1;for(let[B,q]of g)if(B!==P&&q.has(_)){N=B,M=!0;break}return le(M?()=>new pe(`Cannot send 'STEP_FINISHED' for step "${_}" 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 pe(`Cannot send 'STEP_FINISHED' for step "${_}" that was not started`))}return y(P).delete(_),ke(b)}case D.ACTIVITY_SNAPSHOT:{let _=b.messageId;return(!s.activity.has(_)||b.replace!==!1)&&s.activity.set(_,{subagentRunId:b.subagentRunId}),ke(b)}case D.TOOL_CALL_RESULT:{let _=b.messageId;return typeof _=="string"&&s.message.set(_,{subagentRunId:b.subagentRunId}),ke(b)}case D.REASONING_START:case D.REASONING_MESSAGE_START:{let _=b.messageId,P=s.reasoning.get(_);if(P){let N=F(T,b.subagentRunId,P,"reasoning message",_);if(N)return le(()=>N)}return i.add(_),P||s.reasoning.set(_,{subagentRunId:b.subagentRunId}),ke(b)}case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:{let _=b.messageId,P=F(T,b.subagentRunId,s.reasoning.get(_),"reasoning message",_);return P?le(()=>P):(T===D.REASONING_END&&i.delete(_),ke(b))}case D.REASONING_ENCRYPTED_VALUE:{let _=b.entityId,P=b.subtype,N=P==="tool-call"?s.toolCall.get(_):P==="message"?s.message.get(_)??s.reasoning.get(_):s.reasoning.get(_),M=P==="tool-call"?"tool call":P==="message"?"message":"reasoning message",B=F(T,b.subagentRunId,N,M,_);return B?le(()=>B):ke(b)}case D.ACTIVITY_DELTA:{let _=b.messageId,P=F(T,b.subagentRunId,s.activity.get(_),"activity",_);return P?le(()=>P):ke(b)}case D.SUBAGENT_STARTED:{if(typeof b.subagentRunId!="string")return le(()=>new pe("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof b.name!="string")return le(()=>new pe("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let _=b.subagentRunId,P=b.parentSubagentRunId;return h.has(_)?le(()=>new pe(`Cannot send 'SUBAGENT_STARTED': subagent '${_}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):v.has(_)?le(()=>new pe(`Cannot send 'SUBAGENT_STARTED': subagent '${_}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):P!==void 0&&!h.has(P)&&!v.has(P)?le(()=>new pe(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${P}' has not been started in this run.`)):(h.set(_,!0),ke(b))}case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{if(typeof b.subagentRunId!="string")return le(()=>new pe(`Cannot send '${T}' without a 'subagentRunId'.`));if(T===D.SUBAGENT_ERROR&&typeof b.message!="string")return le(()=>new pe("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let _=b.subagentRunId;return h.has(_)?(h.delete(_),v.add(_),ke(b)):le(()=>new pe(`Cannot send '${T}': no active subagent found with ID '${_}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case D.MESSAGES_SNAPSHOT:{let _=O(b.messages,!0);if(_)return le(()=>_)}return ke(b);case D.RUN_STARTED:w=!0;{let _=O((b.input??{}).messages,!1);if(_)return le(()=>_)}return ke(b);case D.RUN_FINISHED:if(E()){let _=[];for(let[N,M]of g)for(let B of M.keys())_.push(N===void 0?B:`${B} (subagent '${N}')`);let P=_.join(", ");return le(()=>new pe(`Cannot send 'RUN_FINISHED' while steps are still active: ${P}`))}if(r.size>0){let _=Array.from(r.keys()).join(", ");return le(()=>new pe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${_}`))}if(o.size>0){let _=Array.from(o.keys()).join(", ");return le(()=>new pe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${_}`))}if(h.size>0){let _=Array.from(h.keys()).join(", ");return le(()=>new pe(`Cannot send 'RUN_FINISHED' while subagents are still active: ${_}`))}return a=!0,ke(b);case D.RUN_ERROR:return u=!0,ke(b);case D.CUSTOM:return ke(b);case D.THINKING_TEXT_MESSAGE_START:return A?C?le(()=>new pe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(C=!0,ke(b)):le(()=>new pe("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 C?ke(b):le(()=>new pe("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 C?(C=!1,ke(b)):le(()=>new pe("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 A?le(()=>new pe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(A=!0,ke(b));case D.THINKING_END:return A?(A=!1,ke(b)):le(()=>new pe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return ke(b)}}))},Mr=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),PO=e=>jc(()=>Nr(e())).pipe(Df(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Nr(t.text()).pipe(yt(i=>{let s=i;if(o.includes("application/json"))try{s=JSON.parse(i)}catch{}let a=Error(`HTTP ${t.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return a.status=t.status,a.payload=s,le(()=>a)}))}let n={type:Mr.HEADERS,status:t.status,headers:t.headers},r=t.body?.getReader();return r?new je(o=>(o.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:s}=yield r.read();if(i)break;let a={type:Mr.DATA,data:s};o.next(a)}o.complete()}catch(i){o.error(i)}})(),()=>{r.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):le(()=>Error("Failed to getReader() from response"))})),NO=(e,t)=>{let n=ss(t),r=new en,o=new TextDecoder("utf-8",{fatal:!1}),i="";e.subscribe({next:a=>{if(a.type!==Mr.HEADERS&&a.type===Mr.DATA&&a.data){let u=o.decode(a.data,{stream:!0});i+=u;let c=i.split(/\n\n/);i=c.pop()||"";for(let g of c)s(g)}},error:a=>r.error(a),complete:()=>{i&&(i+=o.decode(),s(i)),r.complete()}});function s(a){let u=a.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
- `),v=JSON.parse(g);n?.event("SSE","Event received:",v,{type:v.type}),r.next(v)}catch(g){r.error(g)}}return r.asObservable()},sO=e=>{let t=new Zt,n=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Or.HEADERS&&o.type===Or.DATA&&o.data){let i=new Uint8Array(n.length+o.data.length);i.set(n,0),i.set(o.data,n.length),n=i,r()}},error:o=>t.error(o),complete:()=>{if(n.length>0)try{r()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function r(){for(;n.length>=4;){let o=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length<o)break;try{let i=n.slice(4,o),s=FS(i);t.next(s),n=n.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},aO=(e,t)=>{let n=Wi(t),r=new Zt,o=new lc,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===Or.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");n?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===Fp?"protobuf":"sse"}),a===Fp?sO(o).subscribe({next:u=>r.next(u),error:u=>r.error(u),complete:()=>r.complete()}):iO(o,n).subscribe({next:u=>{try{let c=Wa.parse(u);n?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),r.next(c)}catch(c){n?.event("HTTP","Event invalid:",{json:u,error:String(c)}),r.error(c)}},error:u=>{if(u?.name==="AbortError"){r.next({type:F.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),r.complete();return}return r.error(u)},complete:()=>r.complete()})}else i||r.error(Error("No headers event received before data events"))},error:s=>{o.error(s),r.error(s)},complete:()=>{o.complete()}}),r.asObservable()},De=S.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),cO=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),uO=S.object({type:S.literal(De.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),lO=S.object({type:S.literal(De.enum.TextMessageContent),messageId:S.string(),content:S.string()}),dO=S.object({type:S.literal(De.enum.TextMessageEnd),messageId:S.string()}),pO=S.object({type:S.literal(De.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),fO=S.object({type:S.literal(De.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),mO=S.object({type:S.literal(De.enum.ActionExecutionEnd),actionExecutionId:S.string()}),gO=S.object({type:S.literal(De.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),hO=S.object({type:S.literal(De.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()}),yO=S.object({type:S.literal(De.enum.MetaEvent),name:cO,value:S.any()}),vO=S.object({type:S.literal(De.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[uO,lO,dO,pO,fO,mO,gO,hO,yO,vO]),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 SO=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(n=>n.type==="text").map(n=>n.text).filter(n=>n.length>0);if(t.length!==0)return t.join(`
42
- `)},bO=(e,t,n)=>r=>{let o={},i=!0,s=!0,a="",u=null,c=null,g=[],v={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return r.pipe(ft(h=>{switch(h.type){case F.TEXT_MESSAGE_START:{let y=h;return[{type:De.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:De.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=h;return[{type:De.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:""}}),s=!0,v[y.toolCallId]=y.toolCallName,[{type:De.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=h,b=g.find(R=>R.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 w=!1;if(c){let R=c.find(N=>N.tool==b.function.name);if(R)try{let N=JSON.parse(kc(b.function.arguments));R.tool_argument&&R.tool_argument in N?(x({...o,[R.state_key]:N[R.tool_argument]}),w=!0):R.tool_argument||(x({...o,[R.state_key]:N}),w=!0)}catch{}}return[{type:De.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case F.TOOL_CALL_END:{let y=h;return[{type:De.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=h;return[{type:De.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:De.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return x(h.snapshot),[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case F.STATE_DELTA:{let y=h,b=nc.applyPatch(o,y.delta,!0,!1);return b?(x(b.newDocument),[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case F.MESSAGES_SNAPSHOT:return u=h.messages,[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,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:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:AO(u)}:{})}),active:!1}];case F.RUN_ERROR:{let y=h;return[{type:De.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return a=h.stepName,g=[],c=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return g=[],c=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function AO(e){let t=[];for(let n of e)if(n.role==="assistant"||n.role==="user"||n.role==="system"){let r=SO(n.content);if(r){let o={id:n.id,role:n.role,content:r};t.push(o)}if(n.role==="assistant"&&n.toolCalls&&n.toolCalls.length>0)for(let o of n.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:n.id};t.push(i)}}else if(n.role==="tool"){let r="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let s of i.toolCalls)if(s.id===n.toolCallId){r=s.function.name;break}}let o={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(o)}return t}var wO=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,CO=e=>e==="tool"?"toolCallId":"messageId",Fo=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},fu=e=>t=>{let n=Wi(e),r=new Map,o=u=>{let c=r.get(u);if(!c)return[];switch(r.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 n?.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 n?.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 n?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...r.keys()].flatMap(u=>o(u)),s=(u,c)=>{for(let[g,v]of r)if(v.kind===u&&wO(v)===c)return{owner:g}},a=(u,c,g,v,x)=>{if(c!==void 0){let y=s(u,c);if(y){if(g!==void 0&&g!==y.owner)throw Error(`Cannot continue ${x} '${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(r.get(void 0)?.kind===u)return;let h=[...r.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 ${CO(u)} nor a subagentRunId, but ${h.length} lanes have an open ${x}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(ft(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=a("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),v=r.get(g),x=[],h;if(v?.kind==="text"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(x.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},r.set(g,{kind:"text",fields:h});let y=Fo({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);x.push(y),n?.event("TRANSFORM","TEXT_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Fo({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);x.push(b),n?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(x.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;x.push({type:F.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return x}case F.TOOL_CALL_CHUNK:{let c=u,g=a("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),v=r.get(g),x=[],h;if(v?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===v.fields.toolCallId))h=v.fields;else{if(x.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},r.set(g,{kind:"tool",fields:h});let y=Fo({type:F.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);x.push(y),n?.event("TRANSFORM","TOOL_CALL_START",y,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Fo({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);x.push(b),n?.event("TRANSFORM","TOOL_CALL_ARGS",b,{toolCallId:h.toolCallId})}if(x.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;x.push({type:F.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return x}case F.REASONING_MESSAGE_CHUNK:{let c=u,g=a("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),v=r.get(g),x=[],h;if(v?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===v.fields.messageId))h=v.fields;else{if(x.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},r.set(g,{kind:"reasoning",fields:h});let y=Fo({type:F.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);x.push(y),n?.event("TRANSFORM","REASONING_MESSAGE_START",y,{messageId:c.messageId})}if(c.delta!==void 0){let y=c.subagentRunId??h.subagentRunId,b=Fo({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(y!=null&&{subagentRunId:y})},c);x.push(b),n?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",b,{messageId:h.messageId})}if(x.length===0&&c.metadata!==void 0){let y=c.subagentRunId??h.subagentRunId;x.push({type:F.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(y!=null&&{subagentRunId:y})})}return x}}return u.type,[]}),kr(()=>{i()}))};function EO(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Ki=class{runNext(e,t){return t.run(e).pipe(fu(!1))}runNextWithState(e,t){let n=Ee(e.messages||[]),r=Ee(e.state||{}),o=new lc;return WS(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(n=i.messages),i.state!==void 0&&(r=i.state)}),this.runNext(e,t).pipe(Ic(/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:Ee(n),state:Ee(r)}});return function(_x88){return _ref21.apply(this,arguments)}}()))}},xO=class extends Ki{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function IO(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(r=>typeof r=="object"&&!!r&&"type"in r&&r.type==="text"&&typeof r.text=="string").map(r=>r.text).join("");return{...e,content:n}}return typeof t=="string"?e:{...e,content:""}}var RO=class extends Ki{run(e,t){let{parentRunId:n,...r}=e,o={...r,messages:r.messages.map(IO)};return this.runNext(o,t)}},US="THINKING_START",qS="THINKING_END",VS="THINKING_TEXT_MESSAGE_START",GS="THINKING_TEXT_MESSAGE_CONTENT",BS="THINKING_TEXT_MESSAGE_END",TO=class extends Ki{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Nn(n=>this.transformEvent(n)))}transformEvent(e){switch(e.type){case US:{this.currentReasoningId=zi();let{title:t,...n}=e;return this.warnAboutTransformation(US,F.REASONING_START),{...n,type:F.REASONING_START,messageId:this.currentReasoningId}}case VS:return this.currentMessageId=zi(),this.warnAboutTransformation(VS,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case GS:{let{delta:t,...n}=e;return this.warnAboutTransformation(GS,F.REASONING_MESSAGE_CONTENT),{...n,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??zi(),delta:t}}case BS:{let t=this.currentMessageId??zi();return this.warnAboutTransformation(BS,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case qS:{let t=this.currentReasoningId??zi();return this.warnAboutTransformation(qS,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}};function kO(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function _O(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function OO(e){let t=kO(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 PO(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(r=>_O(r)?OO(r):r);return{...e,content:n}}var NO=class extends Ki{run(e,t){let n={...e,messages:e.messages.map(PO)};return this.runNext(n,t)}},$S="SUBAGENT_STARTED",HS="SUBAGENT_FINISHED",QS="SUBAGENT_ERROR";function mu(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...n}=e;return n}return e}function zS(e){return e.map(t=>mu(t))}var FO=class extends Ki{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 n={...e,messages:(e.messages??[]).map(r=>mu(r))};return this.runNext(n,t).pipe(Tc(r=>{let o=r.type;(o===$S||o===HS||o===QS)&&this.warnDroppedLifecycleEvent(o)}),Sp(r=>{let o=r.type;return o!==$S&&o!==HS&&o!==QS}),Nn(r=>{let o=mu(r);if(o.type===F.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:zS(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(s=>mu(s))}}}if(o.type===F.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:zS(i.input.messages)}}}return o}))}},DO="0.0.59",MO=class{get maxVersion(){return DO}get debug(){return this._debug}set debug(e){this._debug=pu(e),this._debugLogger=Lp(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Lp(pu(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=n??Tn(),this.messages=Ee(r??[]),this.state=Ee(o??{}),this._debug=pu(i),this._debugLogger=Lp(this._debug),No(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new RO),No(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new TO),No(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new NO),No(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new FO)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(n=>typeof n=="function"?new xO(n):n);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??Tn();let n=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let r,o=new Set(_this1.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(r=u.result)}},..._this1.subscribers,t??{}];yield _this1.onInitialize(n,i),_this1.activeRunDetach$=new Zt;let s;_this1.activeRunCompletionPromise=new Promise(u=>{s=u}),yield Ec(uc(()=>_this1.middlewares.length===0?_this1.run(n):_this1.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this1).run(n),fu(_this1.debugLogger),jp(_this1.debugLogger),u=>u.pipe(Rc(_this1.activeRunDetach$)),u=>_this1.apply(n,u,i),u=>_this1.processApplyEvents(n,u,i),$i(u=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:u instanceof Error?u.message:String(u)}),_this1.isRunning=!1,_this1.onError(n,u,i))),kr(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(n,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(Te(null)));let a=Ee(_this1.messages).filter(u=>!o.has(u.id));return{result:r,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new ip}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??Tn();let n=_this10.prepareRunAgentInput(e),r,o=new Set(_this10.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(r=u.result)}},..._this10.subscribers,t??{}];yield _this10.onInitialize(n,i),_this10.activeRunDetach$=new Zt;let s;_this10.activeRunCompletionPromise=new Promise(u=>{s=u}),yield Ec(uc(()=>xc(()=>_this10.connect(n)),fu(_this10.debugLogger),jp(_this10.debugLogger),u=>u.pipe(Rc(_this10.activeRunDetach$)),u=>_this10.apply(n,u,i),u=>_this10.processApplyEvents(n,u,i),$i(u=>(_this10.isRunning=!1,u instanceof ip?dc:_this10.onError(n,u,i))),kr(()=>{_this10.isRunning=!1,_this10.onFinalize(n,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(Te(null)),{defaultValue:void 0});let a=Ee(_this10.messages).filter(u=>!o.has(u.id));return{result:r,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,n){return WS(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Tc(r=>{r.messages&&(this.messages=r.messages,n.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),r.state&&(this.state=r.state,n.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ee(this.messages);for(let r of t)r.subagentRunId===null&&delete r.subagentRunId;let n=t.filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Tn(),tools:Ee(e?.tools??[]),context:Ee(e?.context??[]),forwardedProps:Ee(e?.forwardedProps??{}),state:Ee(this.state),messages:n,...(e?.resume===void 0?{}:{resume:Ee(e.resume)})}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){if(_this12.pendingInterrupts.length>0){let r=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this12.pendingInterrupts.map(i=>i.id).filter(i=>!r.has(i));if(o.length>0)throw new pe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this12.pendingInterrupts)if(EO(i))throw new pe(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let n=yield ke(t,_this12.messages,_this12.state,(r,o,i)=>r.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){_this12.messages=n.messages;for(let r of n.messages)r.subagentRunId===null&&delete r.subagentRunId;e.messages=n.messages,t.forEach(r=>{r.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})}n.state&&(_this12.state=n.state,e.state=n.state,t.forEach(r=>{r.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})}))}})()}onError(e,t,n){return Tr(ke(n,this.messages,this.state,(r,o,i)=>r.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Nn(r=>{let o=r;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,n.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,n.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 _this13=this;return _asyncToGenerator(function*(){let n=yield ke(t,_this13.messages,_this13.state,(r,o,i)=>r.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(_this13.messages=n.messages,t.forEach(r=>{r.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),n.state!==void 0&&(_this13.state=n.state,t.forEach(r=>{r.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=Ee(this.messages),e.state=Ee(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ee(this.pendingInterrupts),e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let n of _this14.subscribers)yield n.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let n of _this15.subscribers)yield n.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let n of t.toolCalls)for(let r of _this15.subscribers)yield r.onNewToolCall?.({toolCall:n,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=Ee(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=Ee(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Tn();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((n,r)=>({run:o=>r.run(o,n),get messages(){return n.messages},get state(){return n.state}}),this).run(t)).pipe(fu(this.debugLogger),jp(this.debugLogger),bO(this.threadId,t.runId,this.agentId),n=>n.pipe(Nn(r=>(this.debugLogger?.event("LEGACY","Event:",r,{type:r.type}),r))))}};function LO(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(r=>{if(r.subagentRunId===null){t=!0;let o={...r};return delete o.subagentRunId,o}return r});return t?{...e,messages:n}:e}var KS=class extends MO{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(LO(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=Ee(e.headers??{}),this.fetch=e.fetch??((t,n)=>E(t,n))}run(e){return aO(oO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ee(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}};m();d();f();p();var YS=(e,t,n)=>{let r=it(t,n),o=e?.trim();if(!r||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${r}${i}/${o}`};var Vp=class extends KS{requestInit(t){let{params:n,accessToken:r,recordDebugSession:o}=t.forwardedProps||{},i={...n,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},XS=(e,t,n)=>new Vp({url:`${YS(e,t,n)}/answer`});m();d();f();p();m();d();f();p();var jO=new te({required:!0}),ZS=new te({required:!0,constrainTo:Na}),JS=e=>({...e,name:Fa(e.name)}),eb=V("followUpAnswers/setIsEnabled",e=>W(e,new Ue({required:!0}))),tb=V("followUpAnswers/setFollowUpAnswersConversationId",e=>W(e,J)),nb=V("followUpAnswers/setFollowUpAnswersConversationToken",e=>W(e,J)),rb=V("followUpAnswers/clearFollowUpAnswersConversationToken"),tte=V("followUpAnswers/createFollowUpAnswer",e=>W(e,{question:J})),nte=V("followUpAnswers/setActiveFollowUpAnswerId",e=>W(e,J)),rte=V("followUpAnswers/setFollowUpAnswerContentFormat",e=>W(e,{contentFormat:Ma,answerId:J})),ote=V("followUpAnswers/setFollowUpIsLoading",e=>W(e,{isLoading:new Ue({required:!0}),answerId:J})),ite=V("followUpAnswers/setFollowUpIsStreaming",e=>W(e,{isStreaming:new Ue({required:!0}),answerId:J})),ste=V("followUpAnswers/followUpMessageChunkReceived",e=>W(e,{textDelta:jO,answerId:J})),ate=V("followUpAnswers/followUpCitationsReceived",e=>W(e,{citations:new Mt({required:!0,each:new Re({values:Hd})}),answerId:J})),cte=V("followUpAnswers/followUpCompleted",e=>W(e,{answerId:J,cannotAnswer:new Ue({required:!1})})),ute=V("followUpAnswers/followUpFailed",e=>W(e,{message:new te,code:new Le({min:0}),answerId:J})),lte=V("followUpAnswers/activeFollowUpStartFailed",e=>W(e,{message:new te})),dte=V("followUpAnswers/likeFollowUp",e=>W(e,{answerId:J})),pte=V("followUpAnswers/dislikeFollowUp",e=>W(e,{answerId:J})),fte=V("followUpAnswers/submitFollowUpFeedback",e=>W(e,{answerId:J})),ob=V("followUpAnswers/resetFollowUpAnswers"),mte=V("followUpAnswers/stepStarted",e=>W(JS(e),{answerId:J,name:ZS,startedAt:new Le({min:0,required:!0})})),gte=V("followUpAnswers/stepFinished",e=>W(JS(e),{answerId:J,name:ZS,finishedAt:new Le({min:0,required:!0})})),hte=V("followUpAnswers/startToolCall",e=>W(e,{answerId:J,toolCallName:J,startedAt:new Le({min:0,required:!0}),toolCallId:J})),yte=V("followUpAnswers/finishToolCall",e=>W(e,{answerId:J,finishedAt:new Le({min:0,required:!0}),toolCallId:J})),vte=V("followUpAnswers/toolCallArgs",e=>W(e,{answerId:J,toolCallId:J,args:new Re({options:{required:!0}}),type:new te({required:!0,constrainTo:Da})}));m();d();f();p();var UO={"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 ib(e){return e?UO[e]??1004:1004}var sb=e=>{let t="",n=!1;return{onRunStartedEvent:({event:r})=>{t=r.runId,n=!1,e(La(r.runId)),e(Rn(!1)),e(ki(!0)),e(tb(r.threadId)),e(rb())},onStepStartedEvent:({event:r,agent:o})=>{o.isRunning!==!1&&e(by({name:r.stepName,startedAt:r.timestamp??Date.now()}))},onStepFinishedEvent:({event:r,agent:o})=>{o.isRunning!==!1&&e(Ay({name:r.stepName,finishedAt:r.timestamp??Date.now()}))},onToolCallStartEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=r;e(wy({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=r;e(Cy({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=r;try{let a=JSON.parse(s);typeof a?.q=="string"?e(Ua({toolCallId:i,args:a,type:"search"})):e(Ua({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(Ua({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:r,agent:o})=>{o.isRunning!==!1&&(r.delta.length>0&&(n=!0),e(_i({textDelta:r.delta})))},onCustomEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=r;switch(i){case"header":{s?.contentFormat&&e(Ni(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(eb(s.followUpEnabled)),s?.conversationToken&&e(nb(s.conversationToken));return}case"citations":{e(Oi({citations:s.citations}));return}}},onRunErrorEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let i=ib(r.code);e(Pi({message:r.message,code:i}))},onRunFinishedEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let i=r.result?.completionReason==="ANSWERED",s=i?!n:void 0;e(Qd(i)),e(Fi(!i)),e(ki(!1)),e(Id(i,t,s)),e(lo())}}};var ab=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _run=_asyncToGenerator(function*(r,o,i){t();let s=Aa(r),a=bh(r),u=Ah(r),c=Sh(r),g=wh(r),v=XS(s,a,u);e=v;let x=sb(o),h=fy(r,i());try{o(Rn(!0)),yield v.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},x)}catch(y){o(Rn(!1)),o(Pi({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});function run(_x89,_x90,_x91){return _run.apply(this,arguments)}return run}(),abortRun:t}};m();d();f();p();m();d();f();p();var cb=V("breadcrumb/deselectAll"),ub=V("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var lb=V("facet/updateFacetAutoSelection",e=>W(e,{allow:new Ue({required:!0})}));m();d();f();p();m();d();f();p();var gu=class extends Cn{constructor(n){super(n);se(this,"getState",n)}get activeInstantResultQuery(){let n=this.getState().instantResults;for(let r in n)for(let o in n[r].cache)if(n[r].cache[o].isActive)return n[r].q;return null}get activeInstantResultCache(){let n=this.getState().instantResults;for(let r in n)for(let o in n[r].cache)if(n[r].cache[o].isActive)return n[r].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??jt().q}get responseTime(){return this.activeInstantResultCache?.duration??Qt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Qt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var db=()=>Oe("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new gu(e)),pb=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var Gp={id:J},qO={...Gp,q:Lt},Rne=V("instantResults/register",e=>W(e,Gp)),hu=V("instantResults/updateQuery",e=>W(e,qO)),Tne=V("instantResults/clearExpired",e=>W(e,Gp));m();d();f();p();var yu=new Le({required:!0,min:0}),Lne=V("pagination/registerNumberOfResults",e=>W(e,yu)),jne=V("pagination/updateNumberOfResults",e=>W(e,yu)),Une=V("pagination/registerPage",e=>W(e,yu)),fb=V("pagination/updatePage",e=>W(e,yu)),qne=V("pagination/nextPage"),Vne=V("pagination/previousPage");m();d();f();p();var Do=V("query/updateQuery",e=>W(e,{q:new te,enableQuerySyntax:new Ue}));m();d();f();p();m();d();f();p();m();d();f();p();var Mo=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Bp=()=>Oe("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Dn=e=>Oe("search/queryError",(t,n)=>t.makeQueryError({query:n.query?.q||jt().q,aq:n.advancedSearchQueries?.aq||Mo().aq,cq:n.advancedSearchQueries?.cq||Mo().cq,dq:n.advancedSearchQueries?.dq||Mo().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();m();d();f();p();var vu=e=>e.success!==void 0,mt=e=>e.error!==void 0;m();d();f();p();var jre=V("didYouMean/enable"),Ure=V("didYouMean/disable"),qre=V("didYouMean/automaticCorrections/disable"),Vre=V("didYouMean/automaticCorrections/enable"),Su=V("didYouMean/correction",e=>W(e,J)),Gre=V("didYouMean/automaticCorrections/mode",e=>W(e,new te({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var $p=()=>Oe("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var mb=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function gb(){return{contextValues:{}}}m();d();f();p();function hb(){return{contextValues:{}}}m();d();f();p();function yb(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function vb(){return[]}m();d();f();p();function Sb(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function bb(){return{}}m();d();f();p();function Ab(){return{}}m();d();f();p();function wb(){return{}}function Jt(e){return{context:e.context||gb(),dictionaryFieldContext:e.dictionaryFieldContext||hb(),facetSet:e.facetSet||ba(),numericFacetSet:e.numericFacetSet||Sa(),dateFacetSet:e.dateFacetSet||va(),categoryFacetSet:e.categoryFacetSet||ya(),automaticFacetSet:e.automaticFacetSet??ha(),pagination:e.pagination||Sb(),query:e.query||jt(),tabSet:e.tabSet||wb(),advancedSearchQueries:e.advancedSearchQueries||Mo(),staticFilterSet:e.staticFilterSet||Ab(),querySet:e.querySet||bb(),sortCriteria:e.sortCriteria||wa(),pipeline:e.pipeline||uo(),searchHub:e.searchHub||Zr(),facetOptions:e.facetOptions||yb(),facetOrder:e.facetOrder??vb(),debug:e.debug??Vs()}}m();d();f();p();var mie=new Re({values:{undoneQuery:Lt},options:{required:!0}}),Cb=()=>Oe("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var bu=V("trigger/query/ignore",e=>W(e,new te({emptyAllowed:!0,required:!0}))),Au=V("trigger/query/modification",e=>W(e,new Re({values:{originalQuery:ze,modification:ze}})));m();d();f();p();var Mn=/*#__PURE__*/function(){var _Mn=_asyncToGenerator(function*(e,t){let n=BO(e),r=_a(e),o=VO(e),i=yield po(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return En({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(r.length&&{facets:r}),...(e.pagination&&{numberOfResults:s(),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 Mn(_x92,_x93){return _Mn.apply(this,arguments)}return Mn}();function VO(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(n=>n.response).map(GO).filter(n=>n.currentValues.length>0):void 0}function GO(e){let{field:t,label:n,values:r}=e,o=r.filter(i=>i.state==="selected");return{field:t,label:n,currentValues:o}}function BO(e){let t=e.advancedSearchQueries?.cq.trim()||"",r=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=$O(e);return[t,r,...o].filter(i=>!!i).join(" AND ")}function $O(e){return Object.values(e.staticFilterSet||{}).map(n=>{let r=n.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=r.map(i=>i.expression).join(" OR ");return r.length>1?`(${o})`:o})}var Ln=class{constructor(t,n=r=>{this.dispatch(Do({q:r}))}){se(this,"config",t);se(this,"onUpdateQueryForCorrection",n)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:n},r){let o=Date.now(),i=ka(yield _this18.extra.apiClient.search(n,r),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:n}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return mt(t.response)?(this.dispatch(Dn(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let n=_this20.getState(),r=_this20.getSuccessResponse(t);if(!r||!n.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=n.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=r;if(!o||!i)return null;let c=s.length===0&&a&&a.length!==0,g=!ae(u)&&!ae(u.correctedQuery);if(!c&&!g)return null;let x=c?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch($t(Jt(_this20.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let n=_this21.getCurrentQuery(),r=_this21.getSuccessResponse(t);if(!r.queryCorrections)return null;let{correctedQuery:o}=r.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return mt(i.response)?(_this21.dispatch(Dn(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch($t(Jt(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:r.queryCorrections},automaticallyCorrected:!0,originalQuery:n,analyticsAction:$p()})})()}processModernDidYouMeanAutoCorrection(t){let n=this.getSuccessResponse(t),{correctedQuery:r,originalQuery:o}=n.queryCorrection;return this.onUpdateQueryForCorrection(r),{...t,response:{...n},queryExecuted:r,automaticallyCorrected:!0,originalQuery:o,analyticsAction:$p()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let n=this.getState(),r=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,r),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let n=_this22.getSuccessResponse(t);if(!n)return null;let r=n.triggers.find(a=>a.type==="query")?.content||"";if(!r)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===r)return _this22.dispatch(bu("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(r);return mt(s.response)?(_this22.dispatch(Dn(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch($t(Jt(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Cb()})})()}getStateAfterResponse(t,n,r,o){return{...r,query:{q:t,enableQuerySyntax:r.query?.enableQuerySyntax??jt().enableQuerySyntax},search:{...Qt(),duration:n,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch($t(Jt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return vu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let n=yield _this23.fetchFromAPI(yield Mn(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(Su(t)),n})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(Au({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield Mn(_this24.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 mse=Ie("search/executeSearch",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let n=t.getState();return yield wu(n,t,e)});return function(_x96,_x97){return _ref26.apply(this,arguments)}}()),gse=Ie("search/fetchPage",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let n=t.getState();return yield Qp(n,t,e)});return function(_x98,_x99){return _ref27.apply(this,arguments)}}()),hse=Ie("search/fetchMoreResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let n=t.getState();return yield zp(t,n)});return function(_x100,_x101){return _ref28.apply(this,arguments)}}()),yse=Ie("search/fetchFacetValues",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let n=t.getState();return yield WO(t,e,n)});return function(_x102,_x103){return _ref29.apply(this,arguments)}}()),vse=Ie("search/fetchInstantResults",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){return Hp(e,t)});return function(_x104,_x105){return _ref30.apply(this,arguments)}}()),HO=/*#__PURE__*/function(){var _HO=_asyncToGenerator(function*(e,t){let n=yield Mn(e,t);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});function HO(_x106,_x107){return _HO.apply(this,arguments)}return HO}(),QO=/*#__PURE__*/function(){var _QO=_asyncToGenerator(function*(e,t,n){let r=yield po(e);return En({...r,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:t})});function QO(_x108,_x109,_x110){return _QO.apply(this,arguments)}return QO}(),zO=/*#__PURE__*/function(){var _zO=_asyncToGenerator(function*(e,t){let n=yield Mn(e,t);return n.request.numberOfResults=0,n});function zO(_x111,_x112){return _zO.apply(this,arguments)}return zO}(),Eb=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Hp(_x113,_x114){return _Hp.apply(this,arguments)}function _Hp(){_Hp=_asyncToGenerator(function*(e,t){W(e,{id:J,q:J,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:n,maxResultsPerQuery:r}=e,o=t.getState(),i=new Ln({...t,analyticsAction:db()},c=>{t.dispatch(hu({q:c,id:e.id}))}),s=yield QO(o,n,r),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(a);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _Hp.apply(this,arguments)}function Qp(_x115,_x116,_x117){return _Qp.apply(this,arguments)}function _Qp(){_Qp=_asyncToGenerator(function*(e,t,n){Eb(e);let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=new Ln({...t,analyticsAction:n}),u=yield Mn(e,s),c=yield a.fetchFromAPI(u,{origin:"mainSearch"});return yield a.process(c)});return _Qp.apply(this,arguments)}function zp(_x118,_x119){return _zp.apply(this,arguments)}function _zp(){_zp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:n,preprocessRequest:r,logger:o}=e.extra,{description:i}=yield Bp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:r,logger:o}),s=new Ln({...e,analyticsAction:Bp()}),a=yield HO(t,i),u=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(u)});return _zp.apply(this,arguments)}function WO(_x120,_x121,_x122){return _WO.apply(this,arguments)}function _WO(){_WO=_asyncToGenerator(function*(e,t,n){let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=new Ln({...e,analyticsAction:t}),u=yield zO(n,s),c=yield a.fetchFromAPI(u,{origin:"facetValues"});return yield a.process(c)});return _WO.apply(this,arguments)}function wu(_x123,_x124,_x125){return _wu.apply(this,arguments)}function _wu(){_wu=_asyncToGenerator(function*(e,t,n){Eb(e);let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=yield Mn(e,s),u=new Ln({...t,analyticsAction:n}),c=yield u.fetchFromAPI(a,{origin:"mainSearch"});return yield u.process(c)});return _wu.apply(this,arguments)}m();d();f();p();var jn=class{constructor(t,n=r=>{this.dispatch(Do({q:r}))}){se(this,"config",t);se(this,"onUpdateQueryForCorrection",n)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:n},r){let o=Date.now(),i=ka(yield _this25.extra.apiClient.search(n,r),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:n}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return mt(t.response)?(this.dispatch(Dn(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let n=_this27.getState(),r=_this27.getSuccessResponse(t);if(!r||!n.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=n.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=r;if(!o)return null;if(!i)return!ae(u)&&!ae(u.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let c=s.length===0&&a&&a.length!==0,g=!ae(u)&&!ae(u.correctedQuery);if(!c&&!g)return null;let x=c?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch($t(Jt(_this27.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let n=_this28.getCurrentQuery(),r=_this28.getSuccessResponse(t);if(!r.queryCorrections)return null;let{correctedQuery:o}=r.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return mt(i.response)?(_this28.dispatch(Dn(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch($t(Jt(_this28.getState()))),{...i,response:{...i.response.success,queryCorrections:r.queryCorrections},automaticallyCorrected:!0,originalQuery:n})})()}processModernDidYouMeanAutoCorrection(t){let n=this.getSuccessResponse(t),{correctedQuery:r,originalQuery:o}=n.queryCorrection;return this.onUpdateQueryForCorrection(r),{...t,response:{...n},queryExecuted:r,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let n=_this29.getSuccessResponse(t);if(!n)return null;let r=n.triggers.find(a=>a.type==="query")?.content||"";if(!r)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===r)return _this29.dispatch(bu("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(r);return mt(s.response)?(_this29.dispatch(Dn(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch($t(Jt(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch($t(Jt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return vu(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let n=_this30.getState(),{actionCause:r}=mb(),o=yield _this30.fetchFromAPI(yield In(n,_this30.extra.navigatorContext,{actionCause:r}),{origin:"mainSearch"});return _this30.dispatch(Su(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(Au({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield In(_this31.getState(),_this31.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 oae=Ie("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:n}=t;W(e,{q:new te,enableQuerySyntax:new Ue,clearFilters:new Ue}),e.clearFilters&&(n(cb()),n(ub())),n(lb({allow:!0})),n(Do({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),n(fb(1))}),iae=V("search/updateSearchAction"),Cu=Ie("search/executeSearch",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return wu(n,t,e.legacy);Rb(n);let r=e.next?Tb(e.next):void 0,o=yield In(n,t.extra.navigatorContext,r),i=new jn({...t,analyticsAction:r??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref31.apply(this,arguments)}}()),xb=Ie("search/fetchPage",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let n=t.getState();if(Rb(n),n.configuration.analytics.analyticsMode==="legacy"||!e.next)return Qp(n,t,e.legacy);let r=new jn({...t,analyticsAction:e.next}),o=yield In(n,t.extra.navigatorContext,e.next),i=yield r.fetchFromAPI(o,{origin:"mainSearch"});return yield r.process(i)});return function(_x130,_x131){return _ref32.apply(this,arguments)}}()),Ib=Ie("search/fetchMoreResults",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return zp(t,n);let r=Fh("browseResults",t.getState),o=new jn({...t,analyticsAction:r}),i=yield KO(n,t.extra.navigatorContext,r),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref33.apply(this,arguments)}}()),sae=Ie("search/fetchFacetValues",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return wu(n,t,e.legacy);let r=new jn({...t,analyticsAction:{}}),o=yield XO(n,t.extra.navigatorContext),i=yield r.fetchFromAPI(o,{origin:"facetValues"});return yield r.process(i)});return function(_x134,_x135){return _ref34.apply(this,arguments)}}()),aae=Ie("search/fetchInstantResults",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return Hp(e,t);W(e,{id:J,q:J,maxResultsPerQuery:new Le({required:!0,min:1}),cacheTimeout:new Le});let{q:r,maxResultsPerQuery:o}=e,i=Tb(pb()),s=yield YO(n,t.extra.navigatorContext,r,o,i),a=new jn({...t,analyticsAction:i},g=>{t.dispatch(hu({q:g,id:e.id}))}),u=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield a.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x136,_x137){return _ref35.apply(this,arguments)}}()),KO=/*#__PURE__*/function(){var _KO=_asyncToGenerator(function*(e,t,n){let r=yield In(e,t,n);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});function KO(_x138,_x139,_x140){return _KO.apply(this,arguments)}return KO}(),YO=/*#__PURE__*/function(){var _YO=_asyncToGenerator(function*(e,t,n,r,o){let i=Oa(e,t,o);return En({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:n})});function YO(_x141,_x142,_x143,_x144,_x145){return _YO.apply(this,arguments)}return YO}(),XO=/*#__PURE__*/function(){var _XO=_asyncToGenerator(function*(e,t,n){let r=yield In(e,t,n);return r.request.numberOfResults=0,r});function XO(_x146,_x147,_x148){return _XO.apply(this,arguments)}return XO}(),Rb=e=>{e.configuration.analytics.enabled&&vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Tb=e=>({actionCause:e.actionCause,type:e.actionCause});var kb=e=>{let t=Vm({extra:e}),n=ab();return t.startListening({actionCreator:Cu.pending,effect:function(){var _effect=_asyncToGenerator(function*(r,o){let i=o.getState();if(!hd(i)||(n.abortRun(),o.dispatch(ja()),o.dispatch(ob()),i.generatedAnswer.isEnabled===!1))return;let s=nr(i)?.q;!s||s.trim()===""||n.run(i,o.dispatch,e.getNavigatorContext)});function effect(_x149,_x150){return _effect.apply(this,arguments)}return effect}()}),t};m();d();f();p();var _b=e=>()=>t=>n=>{let r=n;if(!r.error)return t(n);let o=r.error;if(r.payload?.ignored||e.error({error:o,action:n},`Action dispatch error ${r.type}`),r.error.name!=="SchemaValidationError")return t(n)},Ob=e=>t=>n=>r=>(e.debug({action:r,nextState:t.getState()},`Action dispatched: ${r.type}`),n(r));m();d();f();p();var Wp=(e,t)=>{let{referrer:n,userAgent:r,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:n,userAgent:r,location:o,clientId:i}};m();d();f();p();function Pb(e,t){let n={...e},r,o=i=>(s,a)=>{let u=i(s,a);return r?r(u,a):u};return{get combinedReducer(){let i=Lf(Object.entries(t).filter(([s])=>!(s in n)).map(([s,a])=>[s,()=>a]));return o(Hn({...i,...n}))},containsAll(i){return Object.keys(i).every(a=>a in n)},add(i){Object.keys(i).filter(s=>!(s in n)).forEach(s=>{n[s]=i[s]})},addCrossReducer(i){r=i}}}m();d();f();p();m();d();f();p();var Lo=V("app/setError");m();d();f();p();function ZO(e){if(!e||!JO(e))return null;try{let n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),o=decodeURIComponent(r.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Nb(e,t=60){if(!e)return!1;let n=ZO(e);if(!n||typeof n.exp!="number")return!1;let r=Math.floor(Date.now()/1e3);return n.exp<=r+t}function JO(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Db(e,t){let n=0,r=null,o=os(()=>{n=0},500),i=/*#__PURE__*/function(){var _i2=_asyncToGenerator(function*(v,x=!1){let h=!r;h&&t&&(r=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!x)throw b;return null}})().finally(()=>{r=null}));let y=yield r;return h&&y&&v.dispatch(Xr({accessToken:y})),y});function i(_x151){return _i2.apply(this,arguments)}return i}(),s=v=>{let x=nP(v.getState());return!!x&&Nb(x)},a=/*#__PURE__*/function(){var _a3=_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(x){e.warn(x,"Access token renewal failed. A retry will occur if necessary.")}});function a(_x152){return _a3.apply(this,arguments)}return a}(),u=/*#__PURE__*/function(){var _u2=_asyncToGenerator(function*(v,x,h){if(n>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Fb(v,x.error),x;!r&&(n++,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(_x153,_x154,_x155){return _u2.apply(this,arguments)}return u}(),c=(v,x,h)=>tP(h)?t?u(v,h,x):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Fb(v,h.error),h):h,g=(v,x,h)=>eP(h)?Promise.resolve(h).then(y=>c(v,x,y)):c(v,x,h);return v=>x=>h=>{if(!(typeof h=="function"))return x(h);let b=()=>g(v,h,x(h));return typeof t=="function"&&s(v)?a(v).then(b):b()}}function eP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function tP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new jr().name}function Fb(e,t){e.dispatch(Lo({status:401,statusCode:401,message:t.message,type:t.name}))}function nP(e){return e.configuration.accessToken}m();d();f();p();function Mb({reducer:e,preloadedState:t,middlewares:n=[],thunkExtraArguments:r,name:o}){return Rm({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:r}}).prepend(...n).concat(Ob(r.logger))})}function rP(e,t){let{analytics:n}=e,{analyticsClientMiddleware:r,disableBrowserPrivacySignals:o,...i}=n??{},s={...i,...(n?.proxyBaseUrl&&{apiBaseUrl:n.proxyBaseUrl,nexApiBaseUrl:n.proxyBaseUrl})},a=s.analyticsMode!=="next",u=s.analyticsMode==="legacy"&&o===!0;return a&&Zu()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&Zu()&&u&&s.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."),s)}function Lb(e,t){let n={...e.reducers,configuration:bt,version:Ny},r=oP({...e,reducers:n},t,bt),{accessToken:o,environment:i,organizationId:s}=e.configuration;r.dispatch(Xr({accessToken:o,environment:i,organizationId:s}));let a=rP(e.configuration,r.logger);return a&&r.dispatch($s(a)),r}function oP(e,t,n){let{reducers:r,navigatorContextProvider:o}=e,i=Pb({...r,configurationReducer:n},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return fi(c.state,o)},get navigatorContext(){return Wp(this.relay,o)}},u=iP(e,a,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(Qs())},disableAnalytics(){u.dispatch(Hs())},get state(){return u.getState()},get relay(){return fi(this.state,o)},get navigatorContext(){return Wp(this.relay,o)},logger:s,store:u};return c}function iP(e,t,n){let{preloadedState:r,configuration:o}=e,i=o.name||"coveo-headless",s=sP(e,t.logger,()=>t.navigatorContext);return Mb({preloadedState:r,reducer:n.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function sP(e,t,n){let{renewAccessToken:r}=e.configuration,o=Db(t,r),i=kb({getNavigatorContext:n});return[Hy,o,_b(t),Dy].concat(Wd.middleware,i.middleware,e.middlewares||[])}var aP=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
41
+ `),y=JSON.parse(g);n?.event("SSE","Event received:",y,{type:y.type}),r.next(y)}catch(g){r.error(g)}}return r.asObservable()},FO=e=>{let t=new en,n=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Mr.HEADERS&&o.type===Mr.DATA&&o.data){let i=new Uint8Array(n.length+o.data.length);i.set(n,0),i.set(o.data,n.length),n=i,r()}},error:o=>t.error(o),complete:()=>{if(n.length>0)try{r()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function r(){for(;n.length>=4;){let o=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length<o)break;try{let i=n.slice(4,o),s=ZS(i);t.next(s),n=n.slice(o)}catch(i){let s=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${s}`));return}}}return t.asObservable()},DO=(e,t)=>{let n=ss(t),r=new en,o=new Cc,i=!1;return e.subscribe({next:s=>{if(o.next(s),s.type===Mr.HEADERS&&!i){i=!0;let a=s.headers.get("content-type");n?.lifecycle("HTTP","Stream format detected:",{contentType:a,parser:a===Wf?"protobuf":"sse"}),a===Wf?FO(o).subscribe({next:u=>r.next(u),error:u=>r.error(u),complete:()=>r.complete()}):NO(o,n).subscribe({next:u=>{try{let c=ac.parse(u);n?.event("HTTP","Event validated:",c,{type:c.type,valid:!0}),r.next(c)}catch(c){n?.event("HTTP","Event invalid:",{json:u,error:String(c)}),r.error(c)}},error:u=>{if(u?.name==="AbortError"){r.next({type:D.RUN_ERROR,message:u.message||"Request aborted",code:"abort",rawEvent:u}),r.complete();return}return r.error(u)},complete:()=>r.complete()})}else i||r.error(Error("No headers event received before data events"))},error:s=>{o.error(s),r.error(s)},complete:()=>{o.complete()}}),r.asObservable()},Le=S.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),MO=S.enum(["LangGraphInterruptEvent","PredictState","Exit"]),LO=S.object({type:S.literal(Le.enum.TextMessageStart),messageId:S.string(),parentMessageId:S.string().optional(),role:S.string().optional()}),jO=S.object({type:S.literal(Le.enum.TextMessageContent),messageId:S.string(),content:S.string()}),qO=S.object({type:S.literal(Le.enum.TextMessageEnd),messageId:S.string()}),UO=S.object({type:S.literal(Le.enum.ActionExecutionStart),actionExecutionId:S.string(),actionName:S.string(),parentMessageId:S.string().optional()}),VO=S.object({type:S.literal(Le.enum.ActionExecutionArgs),actionExecutionId:S.string(),args:S.string()}),GO=S.object({type:S.literal(Le.enum.ActionExecutionEnd),actionExecutionId:S.string()}),BO=S.object({type:S.literal(Le.enum.ActionExecutionResult),actionName:S.string(),actionExecutionId:S.string(),result:S.string()}),$O=S.object({type:S.literal(Le.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()}),HO=S.object({type:S.literal(Le.enum.MetaEvent),name:MO,value:S.any()}),QO=S.object({type:S.literal(Le.enum.RunError),message:S.string(),code:S.string().optional()});S.discriminatedUnion("type",[LO,jO,qO,UO,VO,GO,BO,$O,HO,QO]),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 zO=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(n=>n.type==="text").map(n=>n.text).filter(n=>n.length>0);if(t.length!==0)return t.join(`
42
+ `)},WO=(e,t,n)=>r=>{let o={},i=!0,s=!0,a="",u=null,c=null,g=[],y={},E=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return r.pipe(yt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let v=h;return[{type:Le.enum.TextMessageStart,messageId:v.messageId,role:v.role}]}case D.TEXT_MESSAGE_CONTENT:{let v=h;return[{type:Le.enum.TextMessageContent,messageId:v.messageId,content:v.delta}]}case D.TEXT_MESSAGE_END:{let v=h;return[{type:Le.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:""}}),s=!0,y[v.toolCallId]=v.toolCallName,[{type:Le.enum.ActionExecutionStart,actionExecutionId:v.toolCallId,actionName:v.toolCallName,parentMessageId:v.parentMessageId}]}case D.TOOL_CALL_ARGS:{let v=h,A=g.find(w=>w.id===v.toolCallId);if(!A)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v.toolCallId}'`),[];A.function.arguments+=v.delta;let C=!1;if(c){let w=c.find(k=>k.tool==A.function.name);if(w)try{let k=JSON.parse(Gc(A.function.arguments));w.tool_argument&&w.tool_argument in k?(E({...o,[w.state_key]:k[w.tool_argument]}),C=!0):w.tool_argument||(E({...o,[w.state_key]:k}),C=!0)}catch{}}return[{type:Le.enum.ActionExecutionArgs,actionExecutionId:v.toolCallId,args:v.delta},...(C?[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]:[])]}case D.TOOL_CALL_END:{let v=h;return[{type:Le.enum.ActionExecutionEnd,actionExecutionId:v.toolCallId}]}case D.TOOL_CALL_RESULT:{let v=h;return[{type:Le.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:Le.enum.MetaEvent,name:v.name,value:v.value}]}case D.STATE_SNAPSHOT:return E(h.snapshot),[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}];case D.STATE_DELTA:{let v=h,A=gc.applyPatch(o,v.delta,!0,!1);return A?(E(A.newDocument),[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:s}]):[]}case D.MESSAGES_SNAPSHOT:return u=h.messages,[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,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:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(u?{messages:KO(u)}:{})}),active:!1}];case D.RUN_ERROR:{let v=h;return[{type:Le.enum.RunError,message:v.message,code:v.code}]}case D.STEP_STARTED:return a=h.stepName,g=[],c=null,[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],c=null,[{type:Le.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:a,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function KO(e){let t=[];for(let n of e)if(n.role==="assistant"||n.role==="user"||n.role==="system"){let r=zO(n.content);if(r){let o={id:n.id,role:n.role,content:r};t.push(o)}if(n.role==="assistant"&&n.toolCalls&&n.toolCalls.length>0)for(let o of n.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:n.id};t.push(i)}}else if(n.role==="tool"){let r="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let s of i.toolCalls)if(s.id===n.toolCallId){r=s.function.name;break}}let o={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(o)}return t}var YO=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,XO=e=>e==="tool"?"toolCallId":"messageId",Go=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Iu=e=>t=>{let n=ss(e),r=new Map,o=u=>{let c=r.get(u);if(!c)return[];switch(r.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 n?.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 n?.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 n?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},i=()=>[...r.keys()].flatMap(u=>o(u)),s=(u,c)=>{for(let[g,y]of r)if(y.kind===u&&YO(y)===c)return{owner:g}},a=(u,c,g,y,E)=>{if(c!==void 0){let v=s(u,c);if(v){if(g!==void 0&&g!==v.owner)throw Error(`Cannot continue ${E} '${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(r.get(void 0)?.kind===u)return;let h=[...r.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 ${XO(u)} nor a subagentRunId, but ${h.length} lanes have an open ${E}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yt(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=a("text",c.messageId,c.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=r.get(g),E=[],h;if(y?.kind==="text"&&(c.messageId===void 0||c.messageId===y.fields.messageId))h=y.fields;else{if(E.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},r.set(g,{kind:"text",fields:h});let v=Go({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);E.push(v),n?.event("TRANSFORM","TEXT_MESSAGE_START",v,{messageId:c.messageId})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,A=Go({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);E.push(A),n?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",A,{messageId:h.messageId})}if(E.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;E.push({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return E}case D.TOOL_CALL_CHUNK:{let c=u,g=a("tool",c.toolCallId,c.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=r.get(g),E=[],h;if(y?.kind==="tool"&&(c.toolCallId===void 0||c.toolCallId===y.fields.toolCallId))h=y.fields;else{if(E.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},r.set(g,{kind:"tool",fields:h});let v=Go({type:D.TOOL_CALL_START,toolCallId:c.toolCallId,toolCallName:c.toolCallName,parentMessageId:c.parentMessageId,...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);E.push(v),n?.event("TRANSFORM","TOOL_CALL_START",v,{toolCallId:c.toolCallId,toolCallName:c.toolCallName})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,A=Go({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);E.push(A),n?.event("TRANSFORM","TOOL_CALL_ARGS",A,{toolCallId:h.toolCallId})}if(E.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;E.push({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return E}case D.REASONING_MESSAGE_CHUNK:{let c=u,g=a("reasoning",c.messageId,c.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=r.get(g),E=[],h;if(y?.kind==="reasoning"&&(c.messageId===void 0||c.messageId===y.fields.messageId))h=y.fields;else{if(E.push(...o(g)),c.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:c.messageId,subagentRunId:c.subagentRunId},r.set(g,{kind:"reasoning",fields:h});let v=Go({type:D.REASONING_MESSAGE_START,messageId:c.messageId,role:"reasoning",...(c.subagentRunId!=null&&{subagentRunId:c.subagentRunId})},c);E.push(v),n?.event("TRANSFORM","REASONING_MESSAGE_START",v,{messageId:c.messageId})}if(c.delta!==void 0){let v=c.subagentRunId??h.subagentRunId,A=Go({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:c.delta,...(v!=null&&{subagentRunId:v})},c);E.push(A),n?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",A,{messageId:h.messageId})}if(E.length===0&&c.metadata!==void 0){let v=c.subagentRunId??h.subagentRunId;E.push({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:c.metadata,...(v!=null&&{subagentRunId:v})})}return E}}return u.type,[]}),Fr(()=>{i()}))};function ZO(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var as=class{runNext(e,t){return t.run(e).pipe(Iu(!1))}runNextWithState(e,t){let n=Ee(e.messages||[]),r=Ee(e.state||{}),o=new Cc;return fb(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(n=i.messages),i.state!==void 0&&(r=i.state)}),this.runNext(e,t).pipe(qc(/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(s=>setTimeout(s,0)),{event:i,messages:Ee(n),state:Ee(r)}});return function(_x88){return _ref21.apply(this,arguments)}}()))}},JO=class extends as{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function eP(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(r=>typeof r=="object"&&!!r&&"type"in r&&r.type==="text"&&typeof r.text=="string").map(r=>r.text).join("");return{...e,content:n}}return typeof t=="string"?e:{...e,content:""}}var tP=class extends as{run(e,t){let{parentRunId:n,...r}=e,o={...r,messages:r.messages.map(eP)};return this.runNext(o,t)}},rb="THINKING_START",ob="THINKING_END",ib="THINKING_TEXT_MESSAGE_START",sb="THINKING_TEXT_MESSAGE_CONTENT",ab="THINKING_TEXT_MESSAGE_END",nP=class extends as{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(Mn(n=>this.transformEvent(n)))}transformEvent(e){switch(e.type){case rb:{this.currentReasoningId=is();let{title:t,...n}=e;return this.warnAboutTransformation(rb,D.REASONING_START),{...n,type:D.REASONING_START,messageId:this.currentReasoningId}}case ib:return this.currentMessageId=is(),this.warnAboutTransformation(ib,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case sb:{let{delta:t,...n}=e;return this.warnAboutTransformation(sb,D.REASONING_MESSAGE_CONTENT),{...n,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??is(),delta:t}}case ab:{let t=this.currentMessageId??is();return this.warnAboutTransformation(ab,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case ob:{let t=this.currentReasoningId??is();return this.warnAboutTransformation(ob,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function rP(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function oP(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function iP(e){let t=rP(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 sP(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(r=>oP(r)?iP(r):r);return{...e,content:n}}var aP=class extends as{run(e,t){let n={...e,messages:e.messages.map(sP)};return this.runNext(n,t)}},cb="SUBAGENT_STARTED",ub="SUBAGENT_FINISHED",lb="SUBAGENT_ERROR";function Ru(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...n}=e;return n}return e}function db(e){return e.map(t=>Ru(t))}var cP=class extends as{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 n={...e,messages:(e.messages??[]).map(r=>Ru(r))};return this.runNext(n,t).pipe(Vc(r=>{let o=r.type;(o===cb||o===ub||o===lb)&&this.warnDroppedLifecycleEvent(o)}),Nf(r=>{let o=r.type;return o!==cb&&o!==ub&&o!==lb}),Mn(r=>{let o=Ru(r);if(o.type===D.MESSAGES_SNAPSHOT){let i=o;if(Array.isArray(i.messages))return{...i,messages:db(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(s=>Ru(s))}}}if(o.type===D.RUN_STARTED){let i=o;if(i.input&&Array.isArray(i.input.messages))return{...i,input:{...i.input,messages:db(i.input.messages)}}}return o}))}},uP="0.0.59",lP=class{get maxVersion(){return uP}get debug(){return this._debug}set debug(e){this._debug=xu(e),this._debugLogger=Xf(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?Xf(xu(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:o,debug:i}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=n??On(),this.messages=Ee(r??[]),this.state=Ee(o??{}),this._debug=xu(i),this._debugLogger=Xf(this._debug),Vo(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new tP),Vo(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new nP),Vo(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new aP),Vo(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new cP)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(n=>typeof n=="function"?new JO(n):n);return this.middlewares.push(...t),this}runAgent(e,t){var _this1=this;return _asyncToGenerator(function*(){try{_this1.isRunning=!0,_this1.agentId=_this1.agentId??On();let n=_this1.prepareRunAgentInput(e);_this1.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this1.agentId,threadId:_this1.threadId});let r,o=new Set(_this1.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(r=u.result)}},..._this1.subscribers,t??{}];yield _this1.onInitialize(n,i),_this1.activeRunDetach$=new en;let s;_this1.activeRunCompletionPromise=new Promise(u=>{s=u}),yield Lc(wc(()=>_this1.middlewares.length===0?_this1.run(n):_this1.middlewares.reduceRight((u,c)=>({run:g=>c.run(g,u),get messages(){return u.messages},get state(){return u.state}}),_this1).run(n),Iu(_this1.debugLogger),Zf(_this1.debugLogger),u=>u.pipe(Uc(_this1.activeRunDetach$)),u=>_this1.apply(n,u,i),u=>_this1.processApplyEvents(n,u,i),ns(u=>(_this1.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this1.agentId,error:u instanceof Error?u.message:String(u)}),_this1.isRunning=!1,_this1.onError(n,u,i))),Fr(()=>{_this1.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this1.agentId,threadId:_this1.threadId}),_this1.isRunning=!1,_this1.onFinalize(n,i),s?.(),s=void 0,_this1.activeRunCompletionPromise=void 0,_this1.activeRunDetach$=void 0}))(ke(null)));let a=Ee(_this1.messages).filter(u=>!o.has(u.id));return{result:r,newMessages:a}}finally{_this1.isRunning=!1}})()}connect(e){throw new Sf}connectAgent(e,t){var _this10=this;return _asyncToGenerator(function*(){try{_this10.isRunning=!0,_this10.agentId=_this10.agentId??On();let n=_this10.prepareRunAgentInput(e),r,o=new Set(_this10.messages.map(u=>u.id)),i=[{onRunFinishedEvent:u=>{u.outcome==="success"&&(r=u.result)}},..._this10.subscribers,t??{}];yield _this10.onInitialize(n,i),_this10.activeRunDetach$=new en;let s;_this10.activeRunCompletionPromise=new Promise(u=>{s=u}),yield Lc(wc(()=>jc(()=>_this10.connect(n)),Iu(_this10.debugLogger),Zf(_this10.debugLogger),u=>u.pipe(Uc(_this10.activeRunDetach$)),u=>_this10.apply(n,u,i),u=>_this10.processApplyEvents(n,u,i),ns(u=>(_this10.isRunning=!1,u instanceof Sf?Ec:_this10.onError(n,u,i))),Fr(()=>{_this10.isRunning=!1,_this10.onFinalize(n,i),s?.(),s=void 0,_this10.activeRunCompletionPromise=void 0,_this10.activeRunDetach$=void 0}))(ke(null)),{defaultValue:void 0});let a=Ee(_this10.messages).filter(u=>!o.has(u.id));return{result:r,newMessages:a}}finally{_this10.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this11=this;return _asyncToGenerator(function*(){if(!_this11.activeRunDetach$)return;let e=_this11.activeRunCompletionPromise??Promise.resolve();_this11.activeRunDetach$.next(),_this11.activeRunDetach$?.complete(),yield e})()}apply(e,t,n){return fb(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Vc(r=>{r.messages&&(this.messages=r.messages,n.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),r.state&&(this.state=r.state,n.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ee(this.messages);for(let r of t)r.subagentRunId===null&&delete r.subagentRunId;let n=t.filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||On(),tools:Ee(e?.tools??[]),context:Ee(e?.context??[]),forwardedProps:Ee(e?.forwardedProps??{}),state:Ee(this.state),messages:n,...(e?.resume===void 0?{}:{resume:Ee(e.resume)})}}onInitialize(e,t){var _this12=this;return _asyncToGenerator(function*(){if(_this12.pendingInterrupts.length>0){let r=new Set((e.resume??[]).map(i=>i.interruptId)),o=_this12.pendingInterrupts.map(i=>i.id).filter(i=>!r.has(i));if(o.length>0)throw new pe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let i of _this12.pendingInterrupts)if(ZO(i))throw new pe(`Interrupt ${i.id} expired at ${i.expiresAt}`)}let n=yield _e(t,_this12.messages,_this12.state,(r,o,i)=>r.onRunInitialized?.({messages:o,state:i,agent:_this12,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){_this12.messages=n.messages;for(let r of n.messages)r.subagentRunId===null&&delete r.subagentRunId;e.messages=n.messages,t.forEach(r=>{r.onMessagesChanged?.({messages:_this12.messages,state:_this12.state,agent:_this12,input:e})})}n.state&&(_this12.state=n.state,e.state=n.state,t.forEach(r=>{r.onStateChanged?.({state:_this12.state,messages:_this12.messages,agent:_this12,input:e})}))}})()}onError(e,t,n){return Nr(_e(n,this.messages,this.state,(r,o,i)=>r.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Mn(r=>{let o=r;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,n.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,n.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 _this13=this;return _asyncToGenerator(function*(){let n=yield _e(t,_this13.messages,_this13.state,(r,o,i)=>r.onRunFinalized?.({messages:o,state:i,agent:_this13,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(_this13.messages=n.messages,t.forEach(r=>{r.onMessagesChanged?.({messages:_this13.messages,state:_this13.state,agent:_this13,input:e})})),n.state!==void 0&&(_this13.state=n.state,t.forEach(r=>{r.onStateChanged?.({state:_this13.state,messages:_this13.messages,agent:_this13,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=Ee(this.messages),e.state=Ee(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ee(this.pendingInterrupts),e}addMessage(e){var _this14=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this14.subscribers)yield t.onNewMessage?.({message:e,messages:_this14.messages,state:_this14.state,agent:_this14});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let n of _this14.subscribers)yield n.onNewToolCall?.({toolCall:t,messages:_this14.messages,state:_this14.state,agent:_this14});for(let t of _this14.subscribers)yield t.onMessagesChanged?.({messages:_this14.messages,state:_this14.state,agent:_this14})})()}addMessages(e){var _this15=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let n of _this15.subscribers)yield n.onNewMessage?.({message:t,messages:_this15.messages,state:_this15.state,agent:_this15});if(t.role==="assistant"&&t.toolCalls)for(let n of t.toolCalls)for(let r of _this15.subscribers)yield r.onNewToolCall?.({toolCall:n,messages:_this15.messages,state:_this15.state,agent:_this15})}for(let t of _this15.subscribers)yield t.onMessagesChanged?.({messages:_this15.messages,state:_this15.state,agent:_this15})})()}setMessages(e){var _this16=this;this.messages=Ee(e),_asyncToGenerator(function*(){for(let t of _this16.subscribers)yield t.onMessagesChanged?.({messages:_this16.messages,state:_this16.state,agent:_this16})})()}setState(e){var _this17=this;this.state=Ee(e),_asyncToGenerator(function*(){for(let t of _this17.subscribers)yield t.onStateChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??On();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((n,r)=>({run:o=>r.run(o,n),get messages(){return n.messages},get state(){return n.state}}),this).run(t)).pipe(Iu(this.debugLogger),Zf(this.debugLogger),WO(this.threadId,t.runId,this.agentId),n=>n.pipe(Mn(r=>(this.debugLogger?.event("LEGACY","Event:",r,{type:r.type}),r))))}};function dP(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(r=>{if(r.subagentRunId===null){t=!0;let o={...r};return delete o.subagentRunId,o}return r});return t?{...e,messages:n}:e}var pb=class extends lP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(dP(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=Ee(e.headers??{}),this.fetch=e.fetch??((t,n)=>I(t,n))}run(e){return DO(PO(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ee(this.headers??{}),e.fetch=this.fetch;let t=new l.AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}};m();d();p();f();var mb=(e,t,n)=>{let r=at(t,n),o=e?.trim();if(!r||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/v1/organizations/${t}/agents`;return`${r}${i}/${o}`};var tp=class extends pb{requestInit(t){let{params:n,accessToken:r,recordDebugSession:o}=t.forwardedProps||{},i={...n,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},gb=(e,t,n)=>new tp({url:`${mb(e,t,n)}/answer`});m();d();p();f();m();d();p();f();var fP=new te({required:!0}),hb=new te({required:!0,constrainTo:Qa}),yb=e=>({...e,name:za(e.name)}),vb=$("followUpAnswers/setIsEnabled",e=>K(e,new Ve({required:!0}))),Sb=$("followUpAnswers/setFollowUpAnswersConversationId",e=>K(e,J)),bb=$("followUpAnswers/setFollowUpAnswersConversationToken",e=>K(e,J)),Ab=$("followUpAnswers/clearFollowUpAnswersConversationToken"),Vte=$("followUpAnswers/createFollowUpAnswer",e=>K(e,{question:J})),Gte=$("followUpAnswers/setActiveFollowUpAnswerId",e=>K(e,J)),Bte=$("followUpAnswers/setFollowUpAnswerContentFormat",e=>K(e,{contentFormat:Ka,answerId:J})),$te=$("followUpAnswers/setFollowUpIsLoading",e=>K(e,{isLoading:new Ve({required:!0}),answerId:J})),Hte=$("followUpAnswers/setFollowUpIsStreaming",e=>K(e,{isStreaming:new Ve({required:!0}),answerId:J})),Qte=$("followUpAnswers/followUpMessageChunkReceived",e=>K(e,{textDelta:fP,answerId:J})),zte=$("followUpAnswers/followUpCitationsReceived",e=>K(e,{citations:new Lt({required:!0,each:new Re({values:of})}),answerId:J})),Wte=$("followUpAnswers/followUpCompleted",e=>K(e,{answerId:J,cannotAnswer:new Ve({required:!1})})),Kte=$("followUpAnswers/followUpFailed",e=>K(e,{message:new te,code:new qe({min:0}),answerId:J})),Yte=$("followUpAnswers/activeFollowUpStartFailed",e=>K(e,{message:new te})),Xte=$("followUpAnswers/likeFollowUp",e=>K(e,{answerId:J})),Zte=$("followUpAnswers/dislikeFollowUp",e=>K(e,{answerId:J})),Jte=$("followUpAnswers/submitFollowUpFeedback",e=>K(e,{answerId:J})),wb=$("followUpAnswers/resetFollowUpAnswers"),ene=$("followUpAnswers/stepStarted",e=>K(yb(e),{answerId:J,name:hb,startedAt:new qe({min:0,required:!0})})),tne=$("followUpAnswers/stepFinished",e=>K(yb(e),{answerId:J,name:hb,finishedAt:new qe({min:0,required:!0})})),nne=$("followUpAnswers/startToolCall",e=>K(e,{answerId:J,toolCallName:J,startedAt:new qe({min:0,required:!0}),toolCallId:J})),rne=$("followUpAnswers/finishToolCall",e=>K(e,{answerId:J,finishedAt:new qe({min:0,required:!0}),toolCallId:J})),one=$("followUpAnswers/toolCallArgs",e=>K(e,{answerId:J,toolCallId:J,args:new Re({options:{required:!0}}),type:new te({required:!0,constrainTo:Wa})}));m();d();p();f();var pP={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Cb(e){return e?pP[e]??1004:1004}var Eb=e=>{let t="",n=!1;return{onRunStartedEvent:({event:r})=>{t=r.runId,n=!1,e(Ya(r.runId)),e(_n(!1)),e(Vi(!0)),e(Sb(r.threadId)),e(Ab())},onStepStartedEvent:({event:r,agent:o})=>{o.isRunning!==!1&&e(jy({name:r.stepName,startedAt:r.timestamp??Date.now()}))},onStepFinishedEvent:({event:r,agent:o})=>{o.isRunning!==!1&&e(qy({name:r.stepName,finishedAt:r.timestamp??Date.now()}))},onToolCallStartEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:i,toolCallId:s,timestamp:a}=r;e(Uy({toolCallId:s,toolCallName:i,startedAt:a??Date.now()}))},onToolCallEndEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,timestamp:s}=r;e(Vy({toolCallId:i,finishedAt:s??Date.now()}))},onToolCallArgsEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:i,delta:s}=r;try{let a=JSON.parse(s);typeof a?.q=="string"?e(Za({toolCallId:i,args:a,type:"search"})):e(Za({toolCallId:i,args:{raw:s},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${s}`),e(Za({toolCallId:i,args:{raw:s},type:"generic"}))}},onTextMessageContentEvent:({event:r,agent:o})=>{o.isRunning!==!1&&(r.delta.length>0&&(n=!0),e(Gi({textDelta:r.delta})))},onCustomEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let{name:i,value:s}=r;switch(i){case"header":{s?.contentFormat&&e(Hi(s.contentFormat)),typeof s?.followUpEnabled=="boolean"&&e(vb(s.followUpEnabled)),s?.conversationToken&&e(bb(s.conversationToken));return}case"citations":{e(Bi({citations:s.citations}));return}}},onRunErrorEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let i=Cb(r.code);e($i({message:r.message,code:i}))},onRunFinishedEvent:({event:r,agent:o})=>{if(o.isRunning===!1)return;let i=r.result?.completionReason==="ANSWERED",s=i?!n:void 0;e(sf(i)),e(Qi(!i)),e(Vi(!1)),e(qd(i,t,s)),e(So())}}};var xb=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _run=_asyncToGenerator(function*(r,o,i){t();let s=Fa(r),a=jh(r),u=qh(r),c=Lh(r),g=Uh(r),y=gb(s,a,u);e=y;let E=Eb(o),h=Oy(r,i());try{o(_n(!0)),yield y.runAgent({forwardedProps:{params:h,accessToken:c,recordDebugSession:g}},E)}catch(v){o(_n(!1)),o($i({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",v)}});function run(_x89,_x90,_x91){return _run.apply(this,arguments)}return run}(),abortRun:t}};m();d();p();f();m();d();p();f();var Ib=$("breadcrumb/deselectAll"),Rb=$("breadcrumb/deselectAllNonBreadcrumbs");m();d();p();f();var Tb=$("facet/updateFacetAutoSelection",e=>K(e,{allow:new Ve({required:!0})}));m();d();p();f();m();d();p();f();var Tu=class extends In{constructor(n){super(n);ce(this,"getState",n)}get activeInstantResultQuery(){let n=this.getState().instantResults;for(let r in n)for(let o in n[r].cache)if(n[r].cache[o].isActive)return n[r].q;return null}get activeInstantResultCache(){let n=this.getState().instantResults;for(let r in n)for(let o in n[r].cache)if(n[r].cache[o].isActive)return n[r].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??qt().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 kb=()=>Ne("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Tu(e)),_b=()=>({actionCause:"searchboxAsYouType"});m();d();p();f();var np={id:J},mP={...np,q:jt},pre=$("instantResults/register",e=>K(e,np)),ku=$("instantResults/updateQuery",e=>K(e,mP)),mre=$("instantResults/clearExpired",e=>K(e,np));m();d();p();f();var _u=new qe({required:!0,min:0}),Cre=$("pagination/registerNumberOfResults",e=>K(e,_u)),Ere=$("pagination/updateNumberOfResults",e=>K(e,_u)),xre=$("pagination/registerPage",e=>K(e,_u)),Ob=$("pagination/updatePage",e=>K(e,_u)),Ire=$("pagination/nextPage"),Rre=$("pagination/previousPage");m();d();p();f();var Bo=$("query/updateQuery",e=>K(e,{q:new te,enableQuerySyntax:new Ve}));m();d();p();f();m();d();p();f();m();d();p();f();var $o=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var rp=()=>Ne("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),jn=e=>Ne("search/queryError",(t,n)=>t.makeQueryError({query:n.query?.q||qt().q,aq:n.advancedSearchQueries?.aq||$o().aq,cq:n.advancedSearchQueries?.cq||$o().cq,dq:n.advancedSearchQueries?.dq||$o().dq,errorType:e.type,errorMessage:e.message}));m();d();p();f();m();d();p();f();m();d();p();f();var Ou=e=>e.success!==void 0,vt=e=>e.error!==void 0;m();d();p();f();var Eoe=$("didYouMean/enable"),xoe=$("didYouMean/disable"),Ioe=$("didYouMean/automaticCorrections/disable"),Roe=$("didYouMean/automaticCorrections/enable"),Pu=$("didYouMean/correction",e=>K(e,J)),Toe=$("didYouMean/automaticCorrections/mode",e=>K(e,new te({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();p();f();var op=()=>Ne("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Pb=()=>({actionCause:"didYouMeanAutomatic"});m();d();p();f();m();d();p();f();function Nb(){return{contextValues:{}}}m();d();p();f();function Fb(){return{contextValues:{}}}m();d();p();f();function Db(){return{freezeFacetOrder:!1,facets:{}}}m();d();p();f();function Mb(){return[]}m();d();p();f();function Lb(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();p();f();function jb(){return{}}m();d();p();f();function qb(){return{}}m();d();p();f();function Ub(){return{}}function tn(e){return{context:e.context||Nb(),dictionaryFieldContext:e.dictionaryFieldContext||Fb(),facetSet:e.facetSet||Na(),numericFacetSet:e.numericFacetSet||Pa(),dateFacetSet:e.dateFacetSet||Oa(),categoryFacetSet:e.categoryFacetSet||_a(),automaticFacetSet:e.automaticFacetSet??ka(),pagination:e.pagination||Lb(),query:e.query||qt(),tabSet:e.tabSet||Ub(),advancedSearchQueries:e.advancedSearchQueries||$o(),staticFilterSet:e.staticFilterSet||qb(),querySet:e.querySet||jb(),sortCriteria:e.sortCriteria||Da(),pipeline:e.pipeline||vo(),searchHub:e.searchHub||io(),facetOptions:e.facetOptions||Db(),facetOrder:e.facetOrder??Mb(),debug:e.debug??Js()}}m();d();p();f();var ese=new Re({values:{undoneQuery:jt},options:{required:!0}}),Vb=()=>Ne("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();p();f();var Nu=$("trigger/query/ignore",e=>K(e,new te({emptyAllowed:!0,required:!0}))),Fu=$("trigger/query/modification",e=>K(e,new Re({values:{originalQuery:Ye,modification:Ye}})));m();d();p();f();var qn=/*#__PURE__*/function(){var _qn=_asyncToGenerator(function*(e,t){let n=yP(e),r=Ba(e),o=gP(e),i=yield bo(e,t),s=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Rn({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(r.length&&{facets:r}),...(e.pagination&&{numberOfResults:s(),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 qn(_x92,_x93){return _qn.apply(this,arguments)}return qn}();function gP(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(n=>n.response).map(hP).filter(n=>n.currentValues.length>0):void 0}function hP(e){let{field:t,label:n,values:r}=e,o=r.filter(i=>i.state==="selected");return{field:t,label:n,currentValues:o}}function yP(e){let t=e.advancedSearchQueries?.cq.trim()||"",r=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=vP(e);return[t,r,...o].filter(i=>!!i).join(" AND ")}function vP(e){return Object.values(e.staticFilterSet||{}).map(n=>{let r=n.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=r.map(i=>i.expression).join(" OR ");return r.length>1?`(${o})`:o})}var Un=class{constructor(t,n=r=>{this.dispatch(Bo({q:r}))}){ce(this,"config",t);ce(this,"onUpdateQueryForCorrection",n)}fetchFromAPI(_x94,_x95){var _this18=this;return _asyncToGenerator(function*({mappings:t,request:n},r){let o=Date.now(),i=Ga(yield _this18.extra.apiClient.search(n,r),t),s=Date.now()-o,a=_this18.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:n}}).apply(this,arguments)}process(t){var _this19=this;return _asyncToGenerator(function*(){return _this19.processQueryErrorOrContinue(t)??(yield _this19.processQueryCorrectionsOrContinue(t))??(yield _this19.processQueryTriggersOrContinue(t))??_this19.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(jn(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this20=this;return _asyncToGenerator(function*(){let n=_this20.getState(),r=_this20.getSuccessResponse(t);if(!r||!n.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=n.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=r;if(!o||!i)return null;let c=s.length===0&&a&&a.length!==0,g=!ue(u)&&!ue(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this20.processLegacyDidYouMeanAutoCorrection(t):_this20.processModernDidYouMeanAutoCorrection(t);return _this20.dispatch(Qt(tn(_this20.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this21=this;return _asyncToGenerator(function*(){let n=_this21.getCurrentQuery(),r=_this21.getSuccessResponse(t);if(!r.queryCorrections)return null;let{correctedQuery:o}=r.queryCorrections[0],i=yield _this21.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this21.dispatch(jn(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this21.dispatch(Qt(tn(_this21.getState()))),{...i,response:{...i.response.success,queryCorrections:r.queryCorrections},automaticallyCorrected:!0,originalQuery:n,analyticsAction:op()})})()}processModernDidYouMeanAutoCorrection(t){let n=this.getSuccessResponse(t),{correctedQuery:r,originalQuery:o}=n.queryCorrection;return this.onUpdateQueryForCorrection(r),{...t,response:{...n},queryExecuted:r,automaticallyCorrected:!0,originalQuery:o,analyticsAction:op()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let n=this.getState(),r=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,r),this.extra)}processQueryTriggersOrContinue(t){var _this22=this;return _asyncToGenerator(function*(){let n=_this22.getSuccessResponse(t);if(!n)return null;let r=n.triggers.find(a=>a.type==="query")?.content||"";if(!r)return null;if(_this22.getState().triggers?.queryModification.queryToIgnore===r)return _this22.dispatch(Nu("")),null;_this22.analyticsAction&&(yield _this22.dispatch(_this22.analyticsAction));let i=_this22.getCurrentQuery(),s=yield _this22.automaticallyRetryQueryWithTriggerModification(r);return vt(s.response)?(_this22.dispatch(jn(s.response.error)),_this22.rejectWithValue(s.response.error)):(_this22.dispatch(Qt(tn(_this22.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Vb()})})()}getStateAfterResponse(t,n,r,o){return{...r,query:{q:t,enableQuerySyntax:r.query?.enableQuerySyntax??qt().enableQuerySyntax},search:{...Wt(),duration:n,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Qt(tn(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Ou(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this23=this;return _asyncToGenerator(function*(){_this23.onUpdateQueryForCorrection(t);let n=yield _this23.fetchFromAPI(yield qn(_this23.getState()),{origin:"mainSearch"});return _this23.dispatch(Pu(t)),n})()}automaticallyRetryQueryWithTriggerModification(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.dispatch(Fu({newQuery:t,originalQuery:_this24.getCurrentQuery()})),_this24.onUpdateQueryForCorrection(t),yield _this24.fetchFromAPI(yield qn(_this24.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 eae=Te("search/executeSearch",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let n=t.getState();return yield Du(n,t,e)});return function(_x96,_x97){return _ref26.apply(this,arguments)}}()),tae=Te("search/fetchPage",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let n=t.getState();return yield sp(n,t,e)});return function(_x98,_x99){return _ref27.apply(this,arguments)}}()),nae=Te("search/fetchMoreResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let n=t.getState();return yield ap(t,n)});return function(_x100,_x101){return _ref28.apply(this,arguments)}}()),rae=Te("search/fetchFacetValues",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let n=t.getState();return yield wP(t,e,n)});return function(_x102,_x103){return _ref29.apply(this,arguments)}}()),oae=Te("search/fetchInstantResults",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){return ip(e,t)});return function(_x104,_x105){return _ref30.apply(this,arguments)}}()),SP=/*#__PURE__*/function(){var _SP=_asyncToGenerator(function*(e,t){let n=yield qn(e,t);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});function SP(_x106,_x107){return _SP.apply(this,arguments)}return SP}(),bP=/*#__PURE__*/function(){var _bP=_asyncToGenerator(function*(e,t,n){let r=yield bo(e);return Rn({...r,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:t})});function bP(_x108,_x109,_x110){return _bP.apply(this,arguments)}return bP}(),AP=/*#__PURE__*/function(){var _AP=_asyncToGenerator(function*(e,t){let n=yield qn(e,t);return n.request.numberOfResults=0,n});function AP(_x111,_x112){return _AP.apply(this,arguments)}return AP}(),Gb=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function ip(_x113,_x114){return _ip.apply(this,arguments)}function _ip(){_ip=_asyncToGenerator(function*(e,t){K(e,{id:J,q:J,maxResultsPerQuery:new qe({required:!0,min:1}),cacheTimeout:new qe});let{q:n,maxResultsPerQuery:r}=e,o=t.getState(),i=new Un({...t,analyticsAction:kb()},c=>{t.dispatch(ku({q:c,id:e.id}))}),s=yield bP(o,n,r),a=yield i.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),u=yield i.process(a);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,analyticsAction:u.analyticsAction,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return _ip.apply(this,arguments)}function sp(_x115,_x116,_x117){return _sp.apply(this,arguments)}function _sp(){_sp=_asyncToGenerator(function*(e,t,n){Gb(e);let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=new Un({...t,analyticsAction:n}),u=yield qn(e,s),c=yield a.fetchFromAPI(u,{origin:"mainSearch"});return yield a.process(c)});return _sp.apply(this,arguments)}function ap(_x118,_x119){return _ap.apply(this,arguments)}function _ap(){_ap=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:n,preprocessRequest:r,logger:o}=e.extra,{description:i}=yield rp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:r,logger:o}),s=new Un({...e,analyticsAction:rp()}),a=yield SP(t,i),u=yield s.fetchFromAPI(a,{origin:"mainSearch"});return yield s.process(u)});return _ap.apply(this,arguments)}function wP(_x120,_x121,_x122){return _wP.apply(this,arguments)}function _wP(){_wP=_asyncToGenerator(function*(e,t,n){let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=e.extra,{description:s}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=new Un({...e,analyticsAction:t}),u=yield AP(n,s),c=yield a.fetchFromAPI(u,{origin:"facetValues"});return yield a.process(c)});return _wP.apply(this,arguments)}function Du(_x123,_x124,_x125){return _Du.apply(this,arguments)}function _Du(){_Du=_asyncToGenerator(function*(e,t,n){Gb(e);let{analyticsClientMiddleware:r,preprocessRequest:o,logger:i}=t.extra,{description:s}=yield n.prepare({getState:()=>t.getState(),analyticsClientMiddleware:r,preprocessRequest:o,logger:i}),a=yield qn(e,s),u=new Un({...t,analyticsAction:n}),c=yield u.fetchFromAPI(a,{origin:"mainSearch"});return yield u.process(c)});return _Du.apply(this,arguments)}m();d();p();f();var Vn=class{constructor(t,n=r=>{this.dispatch(Bo({q:r}))}){ce(this,"config",t);ce(this,"onUpdateQueryForCorrection",n)}fetchFromAPI(_x126,_x127){var _this25=this;return _asyncToGenerator(function*({mappings:t,request:n},r){let o=Date.now(),i=Ga(yield _this25.extra.apiClient.search(n,r),t),s=Date.now()-o,a=_this25.getState().query?.q||"";return{response:i,duration:s,queryExecuted:a,requestExecuted:n}}).apply(this,arguments)}process(t){var _this26=this;return _asyncToGenerator(function*(){return _this26.processQueryErrorOrContinue(t)??(yield _this26.processQueryCorrectionsOrContinue(t))??(yield _this26.processQueryTriggersOrContinue(t))??_this26.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return vt(t.response)?(this.dispatch(jn(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let n=_this27.getState(),r=_this27.getSuccessResponse(t);if(!r||!n.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=n.didYouMean,{results:s,queryCorrections:a,queryCorrection:u}=r;if(!o)return null;if(!i)return!ue(u)&&!ue(u.correctedQuery)?_this27.processModernDidYouMeanAutoCorrection(t):null;let c=s.length===0&&a&&a.length!==0,g=!ue(u)&&!ue(u.correctedQuery);if(!c&&!g)return null;let E=c?yield _this27.processLegacyDidYouMeanAutoCorrection(t):_this27.processModernDidYouMeanAutoCorrection(t);return _this27.dispatch(Qt(tn(_this27.getState()))),E})()}processLegacyDidYouMeanAutoCorrection(t){var _this28=this;return _asyncToGenerator(function*(){let n=_this28.getCurrentQuery(),r=_this28.getSuccessResponse(t);if(!r.queryCorrections)return null;let{correctedQuery:o}=r.queryCorrections[0],i=yield _this28.automaticallyRetryQueryWithCorrection(o);return vt(i.response)?(_this28.dispatch(jn(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(Qt(tn(_this28.getState()))),{...i,response:{...i.response.success,queryCorrections:r.queryCorrections},automaticallyCorrected:!0,originalQuery:n})})()}processModernDidYouMeanAutoCorrection(t){let n=this.getSuccessResponse(t),{correctedQuery:r,originalQuery:o}=n.queryCorrection;return this.onUpdateQueryForCorrection(r),{...t,response:{...n},queryExecuted:r,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this29=this;return _asyncToGenerator(function*(){let n=_this29.getSuccessResponse(t);if(!n)return null;let r=n.triggers.find(a=>a.type==="query")?.content||"";if(!r)return null;if(_this29.getState().triggers?.queryModification.queryToIgnore===r)return _this29.dispatch(Nu("")),null;let i=_this29.getCurrentQuery(),s=yield _this29.automaticallyRetryQueryWithTriggerModification(r);return vt(s.response)?(_this29.dispatch(jn(s.response.error)),_this29.rejectWithValue(s.response.error)):(_this29.dispatch(Qt(tn(_this29.getState()))),{...s,response:{...s.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Qt(tn(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Ou(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this30=this;return _asyncToGenerator(function*(){_this30.onUpdateQueryForCorrection(t);let n=_this30.getState(),{actionCause:r}=Pb(),o=yield _this30.fetchFromAPI(yield kn(n,_this30.extra.navigatorContext,{actionCause:r}),{origin:"mainSearch"});return _this30.dispatch(Pu(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.dispatch(Fu({newQuery:t,originalQuery:_this31.getCurrentQuery()})),_this31.onUpdateQueryForCorrection(t),yield _this31.fetchFromAPI(yield kn(_this31.getState(),_this31.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 $ae=Te("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:n}=t;K(e,{q:new te,enableQuerySyntax:new Ve,clearFilters:new Ve}),e.clearFilters&&(n(Ib()),n(Rb())),n(Tb({allow:!0})),n(Bo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),n(Ob(1))}),Hae=$("search/updateSearchAction"),Mu=Te("search/executeSearch",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return Du(n,t,e.legacy);Hb(n);let r=e.next?Qb(e.next):void 0,o=yield kn(n,t.extra.navigatorContext,r),i=new Vn({...t,analyticsAction:r??{}}),s=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(s)});return function(_x128,_x129){return _ref31.apply(this,arguments)}}()),Bb=Te("search/fetchPage",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let n=t.getState();if(Hb(n),n.configuration.analytics.analyticsMode==="legacy"||!e.next)return sp(n,t,e.legacy);let r=new Vn({...t,analyticsAction:e.next}),o=yield kn(n,t.extra.navigatorContext,e.next),i=yield r.fetchFromAPI(o,{origin:"mainSearch"});return yield r.process(i)});return function(_x130,_x131){return _ref32.apply(this,arguments)}}()),$b=Te("search/fetchMoreResults",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return ap(t,n);let r=Zh("browseResults",t.getState),o=new Vn({...t,analyticsAction:r}),i=yield CP(n,t.extra.navigatorContext,r),s=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(s)});return function(_x132,_x133){return _ref33.apply(this,arguments)}}()),Qae=Te("search/fetchFacetValues",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return Du(n,t,e.legacy);let r=new Vn({...t,analyticsAction:{}}),o=yield xP(n,t.extra.navigatorContext),i=yield r.fetchFromAPI(o,{origin:"facetValues"});return yield r.process(i)});return function(_x134,_x135){return _ref34.apply(this,arguments)}}()),zae=Te("search/fetchInstantResults",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let n=t.getState();if(n.configuration.analytics.analyticsMode==="legacy")return ip(e,t);K(e,{id:J,q:J,maxResultsPerQuery:new qe({required:!0,min:1}),cacheTimeout:new qe});let{q:r,maxResultsPerQuery:o}=e,i=Qb(_b()),s=yield EP(n,t.extra.navigatorContext,r,o,i),a=new Vn({...t,analyticsAction:i},g=>{t.dispatch(ku({q:g,id:e.id}))}),u=yield a.fetchFromAPI(s,{origin:"instantResults",disableAbortWarning:!0}),c=yield a.process(u);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return function(_x136,_x137){return _ref35.apply(this,arguments)}}()),CP=/*#__PURE__*/function(){var _CP=_asyncToGenerator(function*(e,t,n){let r=yield kn(e,t,n);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});function CP(_x138,_x139,_x140){return _CP.apply(this,arguments)}return CP}(),EP=/*#__PURE__*/function(){var _EP=_asyncToGenerator(function*(e,t,n,r,o){let i=$a(e,t,o);return Rn({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:n})});function EP(_x141,_x142,_x143,_x144,_x145){return _EP.apply(this,arguments)}return EP}(),xP=/*#__PURE__*/function(){var _xP=_asyncToGenerator(function*(e,t,n){let r=yield kn(e,t,n);return r.request.numberOfResults=0,r});function xP(_x146,_x147,_x148){return _xP.apply(this,arguments)}return xP}(),Hb=e=>{e.configuration.analytics.enabled&&At.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Qb=e=>({actionCause:e.actionCause,type:e.actionCause});var zb=e=>{let t=tg({extra:e}),n=xb();return t.startListening({actionCreator:Mu.pending,effect:function(){var _effect=_asyncToGenerator(function*(r,o){let i=o.getState();if(!kd(i)||(n.abortRun(),o.dispatch(Xa()),o.dispatch(wb()),i.generatedAnswer.isEnabled===!1))return;let s=ar(i)?.q;!s||s.trim()===""||n.run(i,o.dispatch,e.getNavigatorContext)});function effect(_x149,_x150){return _effect.apply(this,arguments)}return effect}()}),t};m();d();p();f();var Wb=e=>()=>t=>n=>{let r=n;if(!r.error)return t(n);let o=r.error;if(r.payload?.ignored||e.error({error:o,action:n},`Action dispatch error ${r.type}`),r.error.name!=="SchemaValidationError")return t(n)},Kb=e=>t=>n=>r=>(e.debug({action:r,nextState:t.getState()},`Action dispatched: ${r.type}`),n(r));m();d();p();f();var cp=(e,t)=>{let{referrer:n,userAgent:r,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:n,userAgent:r,location:o,clientId:i}};m();d();p();f();function Yb(e,t){let n={...e},r,o=i=>(s,a)=>{let u=i(s,a);return r?r(u,a):u};return{get combinedReducer(){let i=Zp(Object.entries(t).filter(([s])=>!(s in n)).map(([s,a])=>[s,()=>a]));return o(Yn({...i,...n}))},containsAll(i){return Object.keys(i).every(a=>a in n)},add(i){Object.keys(i).filter(s=>!(s in n)).forEach(s=>{n[s]=i[s]})},addCrossReducer(i){r=i}}}m();d();p();f();m();d();p();f();var Ho=$("app/setError");m();d();p();f();function IP(e){if(!e||!RP(e))return null;try{let n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),o=decodeURIComponent(r.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Xb(e,t=60){if(!e)return!1;let n=IP(e);if(!n||typeof n.exp!="number")return!1;let r=Math.floor(Date.now()/1e3);return n.exp<=r+t}function RP(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Jb(e,t){let n=0,r=null,o=hs(()=>{n=0},500),i=/*#__PURE__*/function(){var _i2=_asyncToGenerator(function*(y,E=!1){let h=!r;h&&t&&(r=_asyncToGenerator(function*(){try{return yield t()}catch(A){if(!E)throw A;return null}})().finally(()=>{r=null}));let v=yield r;return h&&v&&y.dispatch(oo({accessToken:v})),v});function i(_x151){return _i2.apply(this,arguments)}return i}(),s=y=>{let E=_P(y.getState());return!!E&&Xb(E)},a=/*#__PURE__*/function(){var _a3=_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(E){e.warn(E,"Access token renewal failed. A retry will occur if necessary.")}});function a(_x152){return _a3.apply(this,arguments)}return a}(),u=/*#__PURE__*/function(){var _u2=_asyncToGenerator(function*(y,E,h){if(n>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Zb(y,E.error),E;!r&&(n++,o());try{yield i(y,!0)}catch(A){e.debug(A,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}y.dispatch(h)});function u(_x153,_x154,_x155){return _u2.apply(this,arguments)}return u}(),c=(y,E,h)=>kP(h)?t?u(y,h,E):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Zb(y,h.error),h):h,g=(y,E,h)=>TP(h)?Promise.resolve(h).then(v=>c(y,E,v)):c(y,E,h);return y=>E=>h=>{if(!(typeof h=="function"))return E(h);let A=()=>g(y,h,E(h));return typeof t=="function"&&s(y)?a(y).then(A):A()}}function TP(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function kP(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===(new $r).name}function Zb(e,t){e.dispatch(Ho({status:401,statusCode:401,message:t.message,type:t.name}))}function _P(e){return e.configuration.accessToken}m();d();p();f();function eA({reducer:e,preloadedState:t,middlewares:n=[],thunkExtraArguments:r,name:o}){return Bm({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:r}}).prepend(...n).concat(Kb(r.logger))})}function OP(e,t){let{analytics:n}=e,{analyticsClientMiddleware:r,disableBrowserPrivacySignals:o,...i}=n??{},s={...i,...(n?.proxyBaseUrl&&{apiBaseUrl:n.proxyBaseUrl,nexApiBaseUrl:n.proxyBaseUrl})},a=s.analyticsMode!=="next",u=s.analyticsMode==="legacy"&&o===!0;return a&&dl()&&!u?(t.info("Analytics disabled since doNotTrack is active."),{...s,enabled:!1}):(a&&dl()&&u&&s.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."),s)}function tA(e,t){let n={...e.reducers,configuration:Ct,version:Xy},r=PP({...e,reducers:n},t,Ct),{accessToken:o,environment:i,organizationId:s}=e.configuration;r.dispatch(oo({accessToken:o,environment:i,organizationId:s}));let a=OP(e.configuration,r.logger);return a&&r.dispatch(na(a)),r}function PP(e,t,n){let{reducers:r,navigatorContextProvider:o}=e,i=Yb({...r,configurationReducer:n},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let s=t.logger,a={...t,get relay(){return wi(c.state,o)},get navigatorContext(){return cp(this.relay,o)}},u=NP(e,a,i),c={addReducers(g){i.containsAll(g)||(i.add(g),u.replaceReducer(i.combinedReducer))},dispatch:u.dispatch,subscribe:u.subscribe,enableAnalytics(){u.dispatch(oa())},disableAnalytics(){u.dispatch(ra())},get state(){return u.getState()},get relay(){return wi(this.state,o)},get navigatorContext(){return cp(this.relay,o)},logger:s,store:u};return c}function NP(e,t,n){let{preloadedState:r,configuration:o}=e,i=o.name||"coveo-headless",s=FP(e,t.logger,()=>t.navigatorContext);return eA({preloadedState:r,reducer:n.combinedReducer,middlewares:s,thunkExtraArguments:t,name:i})}function FP(e,t,n){let{renewAccessToken:r}=e.configuration,o=Jb(t,r),i=zb({getNavigatorContext:n});return[uv,o,Wb(t),Jy].concat(cf.middleware,i.middleware,e.middlewares||[])}var DP=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function jb(e){e==="next"&&console.warn(aP)}m();d();f();p();var Wb=Ft(zb(),1);function Kb(e){return(0,Wb.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function Yb(e,t){let n=xP(e),r=Rl,o=IP(e);return{analyticsClientMiddleware:n,validatePayload:r,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function xP(e){let{analytics:t}=e,n=(r,o)=>o;return t?.analyticsClientMiddleware||n}function IP(e){return e.preprocessRequest||ss}m();d();f();p();m();d();f();p();var Xb={organizationId:J,accessToken:J,name:new te({required:!1,emptyAllowed:!1}),analytics:new Re({options:{required:!1},values:{enabled:new Ue({required:!1}),originContext:new te({required:!1}),originLevel2:new te({required:!1}),originLevel3:new te({required:!1}),analyticsMode:new te({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new te({required:!1,url:!0}),trackingId:new te({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new Ue({required:!1})}}),environment:new te({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var Zb=new Dt({...Xb,caseAssistId:J,locale:ze});var RP={debug:Ym,caseAssistConfiguration:bn,searchHub:ng};function Jb(e){let t=Kb(e.loggerOptions);TP(e.configuration,t);let n=kP(e.configuration,t),r={...Yb(e.configuration,t),apiClient:n},o={...e,reducers:RP},i=Lb(o,r);jb(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:u,proxyBaseUrl:c}=e.configuration;return i.dispatch(Us({caseAssistId:s,locale:a,proxyBaseUrl:c})),ae(u)||i.dispatch(Gs(u)),{...i,get state(){return i.state}}}function TP(e,t){try{Zb.validate(e)}catch(n){throw t.error(n,"Case Assist engine configuration error"),n}}function kP(e,t){return new ds({logger:t,preprocessRequest:e.preprocessRequest||ss})}m();d();f();p();m();d();f();p();m();d();f();p();var eA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(eA||{}),tA=e=>!Object.values(eA).includes(e),gt=e=>{let t=n=>_P(e,n)??PP(e,n);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...OP(e),...NP(e)}}},_P=(e,t)=>e?.caseInput?.[t]?.value,OP=e=>Object.keys(e?.caseInput??[]).reduce((t,n)=>{if(tA(n)){let r=e?.caseInput?.[n]?.value;if(r)return{...t,[n]:r}}return t},{}),PP=(e,t)=>e?.caseField?.fields[t]?.value,NP=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,n)=>{if(tA(n)){let r=e?.caseField?.fields?.[n]?.value;if(r)return{...t,[n]:r}}return t},{}),ef=(e,t,n=!1)=>{let r=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(u=>u.id===t));if(!r)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[r]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:r,classification:{value:i?.value??"",confidence:i?.confidence??0}};return n?{...s,autoSelection:n}:s},vn=(e,t,n=!1,r=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,u)=>{let c=a.uniqueId===t;return c&&(o=u+1),c});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return n?{...s,fromQuickview:n}:r?{...s,openDocument:r}:s};var nA=()=>St({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:gt(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),rA=e=>St("analytics/caseAssist/case/nextStage",(t,n)=>t.logMoveToNextCaseStep({ticket:gt(n),stage:e?.stageName})),oA=()=>St({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:gt(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:n,subject:r,description:o,productId:i}=gt(e);return{ticket:{id:t,category:n,subject:r,description:o,system:i}}}}),iA=()=>St({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:gt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),sA=()=>St({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:gt(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Uo=e=>St({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,n)=>t.logUpdateCaseField({fieldName:e,ticket:gt(n)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let n=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:n}}}),aA=e=>St({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,n)=>t.logSelectFieldSuggestion({suggestion:ef(n,e,!0),ticket:gt(n)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let n=t.caseField?.status?.lastResponseId;if(n)return{autoselected:!0,classificationId:e,responseId:n}}}),Iu=e=>St({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,n)=>t.logSelectFieldSuggestion({suggestion:ef(n,e),ticket:gt(n)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let n=t.caseField?.status?.lastResponseId;if(n)return{autoselected:!1,classificationId:e,responseId:n}}}),cA=e=>St({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logSelectDocumentSuggestion({suggestion:vn(n,e),ticket:gt(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=vn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),Ru=e=>St({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logQuickviewDocumentSuggestion({suggestion:vn(n,e),ticket:gt(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=vn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),uA=e=>St({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logSelectDocumentSuggestion({suggestion:vn(n,e,!1,!0),ticket:gt(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=vn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),lA=(e,t)=>St({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(n,r)=>n.logRateDocumentSuggestion({rating:t,suggestion:vn(r,e),ticket:gt(r)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:n=>{let r=n.documentSuggestion?.status?.lastResponseId,o=vn(n,e);if(r)return{responseId:r,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();f();p();var qo=V("caseAssist/caseField/register",e=>W(e,{fieldName:J,fieldValue:Lt})),Vo=V("caseAssist/caseField/update",e=>W(e,{fieldName:J,fieldValue:Lt})),en=Ie("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:n,extra:{apiClient:r}}){let o=t(),i=yield r.getCaseClassifications(yield FP(o));return mt(i)?n(i.error):{response:i.success}});return function(_x156,_x157){return _ref37.apply(this,arguments)}}()),FP=/*#__PURE__*/function(){var _FP=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??it(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ao(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?ls(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});function FP(_x158){return _FP.apply(this,arguments)}return FP}();m();d();f();p();m();d();f();p();var dA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var qn=Qe(dA(),e=>{e.addCase(qo,(t,n)=>{let{fieldName:r,fieldValue:o}=n.payload;t.fields[r]={value:o,suggestions:[]}}).addCase(Vo,(t,n)=>{let{fieldName:r,fieldValue:o}=n.payload;t.fields[r].value=o}).addCase(en.rejected,(t,n)=>{t.status.error=n.payload??null,t.status.loading=!1}).addCase(en.fulfilled,(t,n)=>{let r={value:"",suggestions:[]};Object.entries(n.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...r}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=n.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(en.pending,t=>{t.status.loading=!0}).addCase(Lo,(t,n)=>{t.status.error=n.payload,t.status.loading=!1})});m();d();f();p();m();d();f();p();var Nr=V("caseAssist/caseInput/update",e=>W(e,{fieldName:J,fieldValue:Lt}));m();d();f();p();var pA=()=>({});var Vn=Qe(pA(),e=>{e.addCase(Nr,(t,n)=>{t[n.payload.fieldName]={value:n.payload.fieldValue}})});m();d();f();p();var Pt=Ie("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:n,extra:{apiClient:r,navigatorContext:o}}){let i=t(),s=yield r.getDocumentSuggestions(yield DP(i,o));return mt(s)?n(s.error):{response:s.success}});return function(_x159,_x160){return _ref38.apply(this,arguments)}}()),DP=/*#__PURE__*/function(){var _DP=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??it(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ao(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&ar(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?ls(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});function DP(_x161,_x162){return _DP.apply(this,arguments)}return DP}();m();d();f();p();m();d();f();p();var fA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var tn=Qe(fA(),e=>{e.addCase(Pt.rejected,(t,n)=>{t.status.error=n.payload??null,t.status.loading=!1}).addCase(Pt.fulfilled,(t,n)=>{t.documents=n.payload.response.documents,t.status.lastResponseId=n.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Pt.pending,t=>{t.status.loading=!0}).addCase(Lo,(t,n)=>{t.status.error=n.payload,t.status.loading=!1})});m();d();f();p();function nn(e){let t,n=new Map,r=()=>n.size===0,o,i=s=>{try{let a=JSON.stringify(s),u=t!==a;return t=a,u}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(s){s();let a=Symbol();return r()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&n.forEach(u=>u())})),n.set(a,s),()=>{n.delete(a),r()&&(o?.(),o=void 0)}},get state(){return{}}}}var MP=new Dt({field:J});function mA(e,t={}){if(!LP(e))throw xt;let n=nn(e),{dispatch:r}=e,o=js(e,MP,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||r(qo({fieldName:o.field,fieldValue:""})),{...n,get state(){let a=i().caseField?.status?.loading??!1,u=i().caseField?.status?.error??null,c=i().caseField?.fields?.[o.field],g=c?.value??"",v=c?.suggestions??[];return{loading:a,error:u,value:g,suggestions:v}},update(a,u,c){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(v=>v.value===a)?.id;g&&r(c?aA(g):Iu(g)),r(Vo({fieldName:o.field,fieldValue:a})),!c&&r(Uo(o.field)),u?.caseClassifications&&r(en()),u?.documentSuggestions&&r(Pt())}}}function LP(e){return e.addReducers({configuration:bt,caseAssistConfiguration:bn,caseInput:Vn,caseField:qn,documentSuggestion:tn}),!0}m();d();f();p();function jP(e,t){let n=new Dt({field:J});js(e,n,t,"buildCaseInput")}function gA(e,t){if(!UP(e))throw xt;let n=nn(e),{dispatch:r}=e,o=()=>e.state;jP(e,t.options);let i=t.options.field;return o().caseInput?.[i]||r(Nr({fieldName:i,fieldValue:""})),{...n,update(a,u){r(Nr({fieldName:i,fieldValue:a})),r(Uo(i)),u?.caseClassifications&&r(en()),u?.documentSuggestions&&r(Pt())},get state(){return o().caseInput[i]}}}function UP(e){return e.addReducers({configuration:bt,caseAssistConfiguration:bn,caseInput:Vn,caseField:qn,documentSuggestion:tn}),!0}m();d();f();p();m();d();f();p();function hA(e,t,n){if(!qP(e))throw xt;let r=1e3,o={selectionDelay:r,debounceWait:r,...t.options},i;return{select:os(n,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(n,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function qP(e){return e.addReducers({configuration:bt}),!0}function yA(e,t){let n=!1;return hA(e,t,()=>{n||(n=!0,e.dispatch(uA(t.options.result.uniqueId)))})}m();d();f();p();function tf(e){if(!VP(e))throw xt;let t=nn(e),{dispatch:n}=e,r=()=>e.state;return{...t,fetch(){n(Pt())},get state(){let o=r().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function VP(e){return e.addReducers({configuration:bt,caseAssistConfiguration:bn,caseInput:Vn,caseField:qn,documentSuggestion:tn}),!0}m();d();f();p();m();d();f();p();m();d();f();p();function Tu(_x163,_x164){return _Tu.apply(this,arguments)}function _Tu(){_Tu=_asyncToGenerator(function*(e,t){let{search:n,accessToken:r,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:n.apiBaseUrl??qr(e.configuration.organizationId,e.configuration.environment),accessToken:r,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(n.authenticationProviders.length&&{authentication:n.authenticationProviders.join(",")})}});return _Tu.apply(this,arguments)}var Xi=Ie("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,{extra:t,getState:n,rejectWithValue:r}){let o=n(),i=yield Tu(o,e),s=yield t.apiClient.html(i);return mt(s)?r(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x165,_x166){return _ref39.apply(this,arguments)}}()),ku=V("resultPreview/next"),_u=V("resultPreview/previous"),Ou=V("resultPreview/prepare",e=>W(e,{results:new Mt({required:!0})})),vA=2048,Pu=Ie("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,{getState:t,extra:n}){let r=t(),o=Wf(yield e.buildResultPreviewRequest(r,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>vA&&n.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${vA} characters.`),{contentURL:o}});return function(_x167,_x168){return _ref40.apply(this,arguments)}}());m();d();f();p();m();d();f();p();m();d();f();p();function nf(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var rf=e=>{let{content:t,isLoading:n,uniqueId:r,contentURL:o}=nf();e.content=t,e.isLoading=n,e.uniqueId=r,e.contentURL=o},of=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),SA=Qe(nf(),e=>{e.addCase(Xi.pending,t=>{t.isLoading=!0}).addCase(Xi.fulfilled,(t,n)=>{let{content:r,uniqueId:o}=n.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=r,t.uniqueId=o,t.isLoading=!1}).addCase(Cu.fulfilled,(t,n)=>{rf(t),t.resultsWithPreview=of(n.payload.response.results)}).addCase(Ib.fulfilled,(t,n)=>{rf(t),t.resultsWithPreview=t.resultsWithPreview.concat(of(n.payload.response.results))}).addCase(xb.fulfilled,rf).addCase(Ou,(t,n)=>{t.resultsWithPreview=of(n.payload.results)}).addCase(ku,t=>{if(t.isLoading)return;let n=t.position+1;n>t.resultsWithPreview.length-1&&(n=0),t.position=n}).addCase(_u,t=>{if(t.isLoading)return;let n=t.position-1;n<0&&(n=t.resultsWithPreview.length-1),t.position=n}).addCase(Pu.fulfilled,(t,n)=>{t.contentURL=n.payload.contentURL})});function bA(e,t,n,r,o){if(!GP(e))throw xt;let{dispatch:i}=e,s=()=>e.state,a=nn(e),{result:u,maximumPreviewSize:c}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=s().resultPreview;return x[h]},v=x=>{i(Pu({uniqueId:x,requestedOutputSize:c,buildResultPreviewRequest:n,path:r})),t.options.onlyContentURL||i(Xi({uniqueId:x,requestedOutputSize:c})),o&&o()};return{...a,fetchResultContent(){v(u.uniqueId)},next(){i(ku()),v(g())},previous(){i(_u()),v(g())},get state(){let x=s(),h=u.hasHtmlVersion,y=x.resultPreview,b=u.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,R=y.contentURL,N=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:R,currentResultUniqueId:N}}}}function GP(e){return e.addReducers({configuration:bt,resultPreview:SA}),!0}function AA(e,t){if(!BP(e))throw xt;let{dispatch:n}=e,r=()=>e.state,o=()=>r().documentSuggestion.documents,a=bA(e,t,Tu,"/html",()=>{e.dispatch(Ru(t.options.result.uniqueId))});return n(Ou({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(u=>u.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function BP(e){return e.addReducers({documentSuggestion:tn}),!0}m();d();f();p();m();d();f();p();var sf=e=>W(e,{evt:J,type:ze}),wA=e=>Oe("analytics/generic/search",t=>{sf(e);let{evt:n,meta:r}=e;return t.makeSearchEvent(n,r)}),CA=e=>Oe("analytics/generic/click",(t,n)=>(xd(e.result),sf(e),t.makeClickEvent(e.evt,Cd(e.result,n),Ed(e.result),e.meta))),EA=e=>Oe("analytics/generic/custom",t=>(sf(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function $P(e){return e.addReducers({}),{logSearchEvent:wA,logClickEvent:CA,logCustomEvent:EA}}m();d();f();p();function HP(e){return e.addReducers({}),{logCaseStart:nA,logCaseNextStage:rA,logCreateCase:oA,logSolveCase:iA,logAbandonCase:sA,logUpdateCaseField:Uo,logClassificationClick:Iu,logDocumentSuggestionClick:cA,logDocumentSuggestionRating:lA,logQuickviewDocumentSuggestionClick:Ru}}m();d();f();p();function QP(e){return e.addReducers({caseField:qn}),{registerCaseField:qo,updateCaseField:Vo,fetchCaseClassifications:en}}m();d();f();p();function zP(e){return e.addReducers({caseInput:Vn}),{updateCaseInput:Nr}}m();d();f();p();function WP(e){return e.addReducers({documentSuggestion:tn}),{fetchDocumentSuggestions:Pt}}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function nA(e){e==="next"&&console.warn(DP)}m();d();p();f();var SA=Dt(vA(),1);function bA(e){return(0,SA.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();p();f();function AA(e,t){let n=dN(e),r=Ul,o=fN(e);return{analyticsClientMiddleware:n,validatePayload:r,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function dN(e){let{analytics:t}=e,n=(r,o)=>o;return t?.analyticsClientMiddleware||n}function fN(e){return e.preprocessRequest||vs}m();d();p();f();m();d();p();f();var wA={organizationId:J,accessToken:J,name:new te({required:!1,emptyAllowed:!1}),analytics:new Re({options:{required:!1},values:{enabled:new Ve({required:!1}),originContext:new te({required:!1}),originLevel2:new te({required:!1}),originLevel3:new te({required:!1}),analyticsMode:new te({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new te({required:!1,url:!0}),trackingId:new te({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new Ve({required:!1})}}),environment:new te({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var CA=new Mt({...wA,caseAssistId:J,locale:Ye});var pN={debug:lg,caseAssistConfiguration:Cn,searchHub:hg};function EA(e){let t=bA(e.loggerOptions);mN(e.configuration,t);let n=gN(e.configuration,t),r={...AA(e.configuration,t),apiClient:n},o={...e,reducers:pN},i=tA(o,r);nA(i.state.configuration.analytics.analyticsMode);let{caseAssistId:s,locale:a,searchHub:u,proxyBaseUrl:c}=e.configuration;return i.dispatch(Xs({caseAssistId:s,locale:a,proxyBaseUrl:c})),ue(u)||i.dispatch(ea(u)),{...i,get state(){return i.state}}}function mN(e,t){try{CA.validate(e)}catch(n){throw t.error(n,"Case Assist engine configuration error"),n}}function gN(e,t){return new Cs({logger:t,preprocessRequest:e.preprocessRequest||vs})}m();d();p();f();m();d();p();f();m();d();p();f();var xA=(i=>(i.id="id",i.subject="subject",i.description="description",i.category="category",i.productId="productId",i))(xA||{}),IA=e=>!Object.values(xA).includes(e),St=e=>{let t=n=>hN(e,n)??vN(e,n);return{id:t("id"),subject:t("subject"),description:t("description"),category:t("category"),productId:t("productId"),custom:{...yN(e),...SN(e)}}},hN=(e,t)=>e?.caseInput?.[t]?.value,yN=e=>Object.keys(e?.caseInput??[]).reduce((t,n)=>{if(IA(n)){let r=e?.caseInput?.[n]?.value;if(r)return{...t,[n]:r}}return t},{}),vN=(e,t)=>e?.caseField?.fields[t]?.value,SN=e=>Object.keys(e?.caseField?.fields??[]).reduce((t,n)=>{if(IA(n)){let r=e?.caseField?.fields?.[n]?.value;if(r)return{...t,[n]:r}}return t},{}),gp=(e,t,n=!1)=>{let r=Object.keys(e?.caseField?.fields??{}).find(a=>e?.caseField?.fields[a].suggestions.some(u=>u.id===t));if(!r)throw new Error(`Classification with ID '${t}' could not be found.`);let i=e?.caseField?.fields[r]?.suggestions.find(a=>a.id===t),s={classificationId:i?.id??"",responseId:e.caseField?.status.lastResponseId??"",fieldName:r,classification:{value:i?.value??"",confidence:i?.confidence??0}};return n?{...s,autoSelection:n}:s},bn=(e,t,n=!1,r=!1)=>{let o,i=e.documentSuggestion?.documents.find((a,u)=>{let c=a.uniqueId===t;return c&&(o=u+1),c});if(!i)throw new Error(`Document Suggestion with ID '${t}' could not be found.`);let s={suggestionId:i.uniqueId,permanentId:i.fields.permanentid,responseId:e.documentSuggestion?.status.lastResponseId??"",suggestion:{documentUri:i.fields.uri,documentUriHash:i.fields.urihash,documentTitle:i.title,documentUrl:i.clickUri,documentPosition:o??0,sourceName:i.fields.source}};return n?{...s,fromQuickview:n}:r?{...s,openDocument:r}:s};var RA=()=>wt({prefix:"analytics/caseAssist/case/start",__legacy__getBuilder:(e,t)=>e.logEnterInterface({ticket:St(t)}),analyticsType:"CaseAssist.Start",analyticsPayloadBuilder:()=>({})}),TA=e=>wt("analytics/caseAssist/case/nextStage",(t,n)=>t.logMoveToNextCaseStep({ticket:St(n),stage:e?.stageName})),kA=()=>wt({prefix:"analytics/caseAssist/case/create",__legacy__getBuilder:(e,t)=>e.logCaseCreated({ticket:St(t)}),analyticsType:"CaseAssist.CreateTicket",analyticsPayloadBuilder:e=>{let{id:t,category:n,subject:r,description:o,productId:i}=St(e);return{ticket:{id:t,category:n,subject:r,description:o,system:i}}}}),_A=()=>wt({prefix:"analytics/caseAssist/case/solve",__legacy__getBuilder:(e,t)=>e.logCaseSolved({ticket:St(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"solved"})}),OA=()=>wt({prefix:"analytics/caseAssist/case/abandon",__legacy__getBuilder:(e,t)=>e.logCaseCancelled({ticket:St(t)}),analyticsType:"CaseAssist.Cancel",analyticsPayloadBuilder:()=>({reason:"quit"})}),Wo=e=>wt({prefix:"analytics/caseAssist/case/field/update",__legacy__getBuilder:(t,n)=>t.logUpdateCaseField({fieldName:e,ticket:St(n)}),analyticsType:"CaseAssist.UpdateField",analyticsPayloadBuilder:t=>{let n=t.caseField?.fields?.[e]?.value||t.caseInput?.[e]?.value||"";return{fieldName:e,fieldValue:n}}}),PA=e=>wt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,n)=>t.logSelectFieldSuggestion({suggestion:gp(n,e,!0),ticket:St(n)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let n=t.caseField?.status?.lastResponseId;if(n)return{autoselected:!0,classificationId:e,responseId:n}}}),Uu=e=>wt({prefix:"analytics/caseAssist/classification/click",__legacy__getBuilder:(t,n)=>t.logSelectFieldSuggestion({suggestion:gp(n,e),ticket:St(n)}),analyticsType:"CaseAssist.SelectFieldClassification",analyticsPayloadBuilder:t=>{let n=t.caseField?.status?.lastResponseId;if(n)return{autoselected:!1,classificationId:e,responseId:n}}}),NA=e=>wt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logSelectDocumentSuggestion({suggestion:bn(n,e),ticket:St(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=bn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),Vu=e=>wt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logQuickviewDocumentSuggestion({suggestion:bn(n,e),ticket:St(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=bn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),FA=e=>wt({prefix:"analytics/caseAssist/documentSuggestion/click",__legacy__getBuilder:(t,n)=>t.logSelectDocumentSuggestion({suggestion:bn(n,e,!1,!0),ticket:St(n)}),analyticsType:"CaseAssist.DocumentSuggestionClick",analyticsPayloadBuilder:t=>{let n=t.documentSuggestion?.status?.lastResponseId,r=bn(t,e);if(n)return{responseId:n,position:r.suggestion.documentPosition,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:r.suggestionId,url:r.suggestion.documentUri,title:r.suggestion.documentTitle}}}}),DA=(e,t)=>wt({prefix:"analytics/caseAssist/documentSuggestion/rate",__legacy__getBuilder:(n,r)=>n.logRateDocumentSuggestion({rating:t,suggestion:bn(r,e),ticket:St(r)}),analyticsType:"CaseAssist.DocumentSuggestionFeedback",analyticsPayloadBuilder:n=>{let r=n.documentSuggestion?.status?.lastResponseId,o=bn(n,e);if(r)return{responseId:r,itemMetadata:{uniqueFieldName:"uniqueId",uniqueFieldValue:o.suggestionId,url:o.suggestion.documentUri,title:o.suggestion.documentTitle},liked:!!t}}});m();d();p();f();var Ko=$("caseAssist/caseField/register",e=>K(e,{fieldName:J,fieldValue:jt})),Yo=$("caseAssist/caseField/update",e=>K(e,{fieldName:J,fieldValue:jt})),nn=Te("caseAssist/classifications/fetch",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:n,extra:{apiClient:r}}){let o=t(),i=yield r.getCaseClassifications(yield bN(o));return vt(i)?n(i.error):{response:i.success}});return function(_x156,_x157){return _ref37.apply(this,arguments)}}()),bN=/*#__PURE__*/function(){var _bN=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??at(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ho(e.configuration.analytics)}),fields:e.caseInput,context:e.caseField?ws(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});function bN(_x158){return _bN.apply(this,arguments)}return bN}();m();d();p();f();m();d();p();f();var MA=()=>({status:{loading:!1,error:null,lastResponseId:""},fields:{}});var Bn=Ke(MA(),e=>{e.addCase(Ko,(t,n)=>{let{fieldName:r,fieldValue:o}=n.payload;t.fields[r]={value:o,suggestions:[]}}).addCase(Yo,(t,n)=>{let{fieldName:r,fieldValue:o}=n.payload;t.fields[r].value=o}).addCase(nn.rejected,(t,n)=>{t.status.error=n.payload??null,t.status.loading=!1}).addCase(nn.fulfilled,(t,n)=>{let r={value:"",suggestions:[]};Object.entries(n.payload.response.fields).forEach(([o,i])=>{t.fields[o]||(t.fields[o]={...r}),t.fields[o].suggestions=i.predictions}),t.status.lastResponseId=n.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(nn.pending,t=>{t.status.loading=!0}).addCase(Ho,(t,n)=>{t.status.error=n.payload,t.status.loading=!1})});m();d();p();f();m();d();p();f();var qr=$("caseAssist/caseInput/update",e=>K(e,{fieldName:J,fieldValue:jt}));m();d();p();f();var LA=()=>({});var $n=Ke(LA(),e=>{e.addCase(qr,(t,n)=>{t[n.payload.fieldName]={value:n.payload.fieldValue}})});m();d();p();f();var Ft=Te("caseAssist/documentSuggestions/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:n,extra:{apiClient:r,navigatorContext:o}}){let i=t(),s=yield r.getDocumentSuggestions(yield AN(i,o));return vt(s)?n(s.error):{response:s.success}});return function(_x159,_x160){return _ref38.apply(this,arguments)}}()),AN=/*#__PURE__*/function(){var _AN=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.caseAssistConfiguration.apiBaseUrl??at(e.configuration.organizationId,e.configuration.environment),caseAssistId:e.caseAssistConfiguration.caseAssistId,...(e.configuration.analytics.enabled&&{clientId:yield ho(e.configuration.analytics)}),...(e.configuration.analytics.enabled&&fr(e.configuration.analytics,t,{actionCause:"documentSuggestion"})),fields:e.caseInput,context:e.caseField?ws(e.caseField.fields):void 0,locale:e.caseAssistConfiguration.locale,debug:e.debug}});function AN(_x161,_x162){return _AN.apply(this,arguments)}return AN}();m();d();p();f();m();d();p();f();var jA=()=>({status:{loading:!1,error:null,lastResponseId:""},documents:[]});var rn=Ke(jA(),e=>{e.addCase(Ft.rejected,(t,n)=>{t.status.error=n.payload??null,t.status.loading=!1}).addCase(Ft.fulfilled,(t,n)=>{t.documents=n.payload.response.documents,t.status.lastResponseId=n.payload.response.responseId,t.status.error=null,t.status.loading=!1}).addCase(Ft.pending,t=>{t.status.loading=!0}).addCase(Ho,(t,n)=>{t.status.error=n.payload,t.status.loading=!1})});m();d();p();f();function on(e){let t,n=new Map,r=()=>n.size===0,o,i=s=>{try{let a=JSON.stringify(s),u=t!==a;return t=a,u}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(s){s();let a=Symbol();return r()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{i(this.state)&&n.forEach(u=>u())})),n.set(a,s),()=>{n.delete(a),r()&&(o?.(),o=void 0)}},get state(){return{}}}}var wN=new Mt({field:J});function qA(e,t={}){if(!CN(e))throw Rt;let n=on(e),{dispatch:r}=e,o=Ys(e,wN,t.options,"buildCaseField"),i=()=>e.state;return i().caseField?.fields?.[o.field]||r(Ko({fieldName:o.field,fieldValue:""})),{...n,get state(){let a=i().caseField?.status?.loading??!1,u=i().caseField?.status?.error??null,c=i().caseField?.fields?.[o.field],g=c?.value??"",y=c?.suggestions??[];return{loading:a,error:u,value:g,suggestions:y}},update(a,u,c){let g=i().caseField?.fields?.[o.field]?.suggestions?.find(y=>y.value===a)?.id;g&&r(c?PA(g):Uu(g)),r(Yo({fieldName:o.field,fieldValue:a})),!c&&r(Wo(o.field)),u?.caseClassifications&&r(nn()),u?.documentSuggestions&&r(Ft())}}}function CN(e){return e.addReducers({configuration:Ct,caseAssistConfiguration:Cn,caseInput:$n,caseField:Bn,documentSuggestion:rn}),!0}m();d();p();f();function EN(e,t){let n=new Mt({field:J});Ys(e,n,t,"buildCaseInput")}function UA(e,t){if(!xN(e))throw Rt;let n=on(e),{dispatch:r}=e,o=()=>e.state;EN(e,t.options);let i=t.options.field;return o().caseInput?.[i]||r(qr({fieldName:i,fieldValue:""})),{...n,update(a,u){r(qr({fieldName:i,fieldValue:a})),r(Wo(i)),u?.caseClassifications&&r(nn()),u?.documentSuggestions&&r(Ft())},get state(){return o().caseInput[i]}}}function xN(e){return e.addReducers({configuration:Ct,caseAssistConfiguration:Cn,caseInput:$n,caseField:Bn,documentSuggestion:rn}),!0}m();d();p();f();m();d();p();f();function VA(e,t,n){if(!IN(e))throw Rt;let r=1e3,o={selectionDelay:r,debounceWait:r,...t.options},i;return{select:hs(n,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(n,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function IN(e){return e.addReducers({configuration:Ct}),!0}function GA(e,t){let n=!1;return VA(e,t,()=>{n||(n=!0,e.dispatch(FA(t.options.result.uniqueId)))})}m();d();p();f();function hp(e){if(!RN(e))throw Rt;let t=on(e),{dispatch:n}=e,r=()=>e.state;return{...t,fetch(){n(Ft())},get state(){let o=r().documentSuggestion;return{loading:o.status.loading,error:o.status.error,documents:o.documents}}}}function RN(e){return e.addReducers({configuration:Ct,caseAssistConfiguration:Cn,caseInput:$n,caseField:Bn,documentSuggestion:rn}),!0}m();d();p();f();m();d();p();f();m();d();p();f();function Gu(_x163,_x164){return _Gu.apply(this,arguments)}function _Gu(){_Gu=_asyncToGenerator(function*(e,t){let{search:n,accessToken:r,organizationId:o}=e.configuration,i=e.query?.q||"";return{url:n.apiBaseUrl??Qr(e.configuration.organizationId,e.configuration.environment),accessToken:r,organizationId:o,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0,...(n.authenticationProviders.length&&{authentication:n.authenticationProviders.join(",")})}});return _Gu.apply(this,arguments)}var us=Te("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,{extra:t,getState:n,rejectWithValue:r}){let o=n(),i=yield Gu(o,e),s=yield t.apiClient.html(i);return vt(s)?r(s.error):{content:s.success,uniqueId:e.uniqueId}});return function(_x165,_x166){return _ref39.apply(this,arguments)}}()),Bu=$("resultPreview/next"),$u=$("resultPreview/previous"),Hu=$("resultPreview/prepare",e=>K(e,{results:new Lt({required:!0})})),BA=2048,Qu=Te("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,{getState:t,extra:n}){let r=t(),o=um(yield e.buildResultPreviewRequest(r,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>BA&&n.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${BA} characters.`),{contentURL:o}});return function(_x167,_x168){return _ref40.apply(this,arguments)}}());m();d();p();f();m();d();p();f();m();d();p();f();function yp(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var vp=e=>{let{content:t,isLoading:n,uniqueId:r,contentURL:o}=yp();e.content=t,e.isLoading=n,e.uniqueId=r,e.contentURL=o},Sp=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),$A=Ke(yp(),e=>{e.addCase(us.pending,t=>{t.isLoading=!0}).addCase(us.fulfilled,(t,n)=>{let{content:r,uniqueId:o}=n.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=r,t.uniqueId=o,t.isLoading=!1}).addCase(Mu.fulfilled,(t,n)=>{vp(t),t.resultsWithPreview=Sp(n.payload.response.results)}).addCase($b.fulfilled,(t,n)=>{vp(t),t.resultsWithPreview=t.resultsWithPreview.concat(Sp(n.payload.response.results))}).addCase(Bb.fulfilled,vp).addCase(Hu,(t,n)=>{t.resultsWithPreview=Sp(n.payload.results)}).addCase(Bu,t=>{if(t.isLoading)return;let n=t.position+1;n>t.resultsWithPreview.length-1&&(n=0),t.position=n}).addCase($u,t=>{if(t.isLoading)return;let n=t.position-1;n<0&&(n=t.resultsWithPreview.length-1),t.position=n}).addCase(Qu.fulfilled,(t,n)=>{t.contentURL=n.payload.contentURL})});function HA(e,t,n,r,o){if(!TN(e))throw Rt;let{dispatch:i}=e,s=()=>e.state,a=on(e),{result:u,maximumPreviewSize:c}=t.options,g=()=>{let{resultsWithPreview:E,position:h}=s().resultPreview;return E[h]},y=E=>{i(Qu({uniqueId:E,requestedOutputSize:c,buildResultPreviewRequest:n,path:r})),t.options.onlyContentURL||i(us({uniqueId:E,requestedOutputSize:c})),o&&o()};return{...a,fetchResultContent(){y(u.uniqueId)},next(){i(Bu()),y(g())},previous(){i($u()),y(g())},get state(){let E=s(),h=u.hasHtmlVersion,v=E.resultPreview,A=u.uniqueId===v.uniqueId?v.content:"",C=v.isLoading,w=v.contentURL,k=g();return{content:A,resultHasPreview:h,isLoading:C,contentURL:w,currentResultUniqueId:k}}}}function TN(e){return e.addReducers({configuration:Ct,resultPreview:$A}),!0}function QA(e,t){if(!kN(e))throw Rt;let{dispatch:n}=e,r=()=>e.state,o=()=>r().documentSuggestion.documents,a=HA(e,t,Gu,"/html",()=>{e.dispatch(Vu(t.options.result.uniqueId))});return n(Hu({results:o()})),{...a,get state(){return{...a.state,currentDocument:o().findIndex(u=>u.uniqueId===a.state.currentResultUniqueId)+1,totalDocuments:o().length}}}}function kN(e){return e.addReducers({documentSuggestion:rn}),!0}m();d();p();f();m();d();p();f();var bp=e=>K(e,{evt:J,type:Ye}),zA=e=>Ne("analytics/generic/search",t=>{bp(e);let{evt:n,meta:r}=e;return t.makeSearchEvent(n,r)}),WA=e=>Ne("analytics/generic/click",(t,n)=>(jd(e.result),bp(e),t.makeClickEvent(e.evt,Md(e.result,n),Ld(e.result),e.meta))),KA=e=>Ne("analytics/generic/custom",t=>(bp(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));function _N(e){return e.addReducers({}),{logSearchEvent:zA,logClickEvent:WA,logCustomEvent:KA}}m();d();p();f();function ON(e){return e.addReducers({}),{logCaseStart:RA,logCaseNextStage:TA,logCreateCase:kA,logSolveCase:_A,logAbandonCase:OA,logUpdateCaseField:Wo,logClassificationClick:Uu,logDocumentSuggestionClick:NA,logDocumentSuggestionRating:DA,logQuickviewDocumentSuggestionClick:Vu}}m();d();p();f();function PN(e){return e.addReducers({caseField:Bn}),{registerCaseField:Ko,updateCaseField:Yo,fetchCaseClassifications:nn}}m();d();p();f();function NN(e){return e.addReducers({caseInput:$n}),{updateCaseInput:qr}}m();d();p();f();function FN(e){return e.addReducers({documentSuggestion:rn}),{fetchDocumentSuggestions:Ft}}/**
46
46
  * @license
47
47
  *
48
48
  * Copyright 2026 Coveo Solutions Inc.
@@ -75,4 +75,4 @@ fast-json-patch/module/duplex.mjs:
75
75
  *)
76
76
  */if(__exports!=exports)module.exports=exports;return module.exports});//# sourceMappingURL=headless.js.map
77
77
 
78
- window.coveoQuanticVersion = '3.45.7';
78
+ window.coveoQuanticVersion = '3.45.8';