@coveo/quantic 3.36.8 → 3.36.9

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 (122) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +14 -14
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +1 -1
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +35 -36
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/breadcrumb-manager/headless-breadcrumb-manager.d.ts +1 -1
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/sort/headless-core-commerce-sort.d.ts +2 -2
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/url-manager/headless-core-url-manager.d.ts +1 -1
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +1 -1
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/did-you-mean/headless-did-you-mean.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search-box/headless-search-box.d.ts +1 -1
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/context/headless-context.d.ts +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/category-facet/headless-core-category-facet.d.ts +1 -1
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-core-numeric-facet.d.ts +1 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/search-box/headless-core-search-box.d.ts +1 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/did-you-mean/headless-did-you-mean.d.ts +1 -1
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facet-manager/headless-facet-manager.d.ts +1 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/category-facet/headless-category-facet.d.ts +1 -1
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/facet/headless-facet.d.ts +1 -1
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/date-facet/headless-date-facet.d.ts +1 -1
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/date-facet/headless-date-filter.d.ts +1 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/numeric-facet/headless-numeric-facet.d.ts +1 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/range-facet/numeric-facet/headless-numeric-filter.d.ts +1 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/folded-result-list/headless-folded-result-list.d.ts +1 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/headless-generated-answer.d.ts +1 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/headless-interactive-citation.d.ts +1 -1
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/breadcrumb-manager/headless-insight-breadcrumb-manager.d.ts +1 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/did-you-mean/headless-insight-did-you-mean.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facet-conditions-manager/headless-facet-conditions-manager.d.ts +1 -1
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facet-manager/headless-insight-facet-manager.d.ts +1 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/category-facet/headless-insight-category-facet.d.ts +1 -1
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/facet/headless-insight-facet-options.d.ts +1 -1
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/facet/headless-insight-facet.d.ts +1 -1
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/date-facet/headless-insight-date-facet.d.ts +1 -1
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/date-facet/headless-insight-date-filter.d.ts +1 -1
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/numeric-facet/headless-insight-numeric-facet.d.ts +1 -1
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/facets/range-facet/numeric-facet/headless-insight-numeric-filter.d.ts +1 -1
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/folded-result-list/headless-insight-folded-result-list.d.ts +1 -1
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/generated-answer/headless-insight-generated-answer.d.ts +1 -1
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/generated-answer/headless-insight-interactive-citation.d.ts +1 -1
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/pager/headless-insight-pager.d.ts +1 -1
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/recent-queries-list/headless-insight-recent-queries-list.d.ts +1 -1
  42. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/result-list/headless-insight-interactive-result.d.ts +1 -1
  43. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/result-list/headless-insight-result-list.d.ts +1 -1
  44. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/results-per-page/headless-insight-results-per-page.d.ts +1 -1
  45. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/search-box/headless-insight-search-box.d.ts +1 -1
  46. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/search-parameter-manager/headless-insight-search-parameter-manager.d.ts +1 -1
  47. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/sort/headless-insight-sort.d.ts +1 -1
  48. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/tab/headless-insight-tab.d.ts +1 -1
  49. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/pager/headless-pager.d.ts +1 -1
  50. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/quickview/headless-quickview.d.ts +1 -1
  51. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +1 -1
  52. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recommendation/result-list/headless-recommendation-interactive-result.d.ts +1 -1
  53. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/relevance-inspector/headless-relevance-inspector.d.ts +1 -1
  54. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/result-list/headless-result-list.d.ts +1 -1
  55. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/results-per-page/headless-results-per-page.d.ts +1 -1
  56. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-box/headless-search-box.d.ts +1 -1
  57. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-parameter-manager/headless-search-parameter-manager.d.ts +1 -1
  58. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/search-status/headless-search-status.d.ts +1 -1
  59. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/smart-snippet/headless-smart-snippet.d.ts +1 -1
  60. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/sort/headless-sort.d.ts +1 -1
  61. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/standalone-search-box/headless-standalone-search-box.d.ts +1 -1
  62. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/static-filter/headless-static-filter.d.ts +1 -1
  63. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/tab/headless-tab.d.ts +1 -1
  64. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/generic-analytics-actions-loader.d.ts +1 -1
  65. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/insight-analytics-actions-loader.d.ts +1 -1
  66. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-analytics-actions-loader.d.ts +1 -1
  67. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/date-facet/date-facet-actions-loader.d.ts +1 -1
  68. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/numeric-facet-actions-loader.d.ts +1 -1
  69. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-actions-loader.d.ts +1 -1
  70. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions-loader.d.ts +1 -1
  71. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions-loader.d.ts +1 -1
  72. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions-loader.d.ts +1 -1
  73. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort.d.ts +1 -1
  74. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-actions-loader.d.ts +1 -1
  75. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-actions-loader.d.ts +1 -1
  76. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-actions-loader.d.ts +1 -1
  77. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions-loader.d.ts +1 -1
  78. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions-loader.d.ts +1 -1
  79. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
  80. package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answers-actions.d.ts +10 -6
  81. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +10 -6
  82. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-state.d.ts +7 -0
  83. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/sse-generated-answer-errors.d.ts +22 -1
  84. package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-actions-loader.d.ts +1 -1
  85. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-parameters/search-parameter-actions.d.ts +0 -1
  86. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions-loader.d.ts +1 -1
  87. package/force-app/main/default/staticresources/coveoheadless/definitions/index.d.ts +25 -25
  88. package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +5 -5
  89. package/force-app/main/default/staticresources/coveoheadless/definitions/recommendation.index.d.ts +1 -1
  90. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +1 -1
  91. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +1 -1
  92. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/instant-products/headless-instant-products.ssr.d.ts +1 -1
  93. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +1 -1
  94. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +1 -1
  95. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +1 -1
  96. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-list/headless-product-list.ssr.d.ts +1 -1
  97. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/recent-queries-list/headless-recent-queries-list.ssr.d.ts +1 -1
  98. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/search-box/headless-search-box.ssr.d.ts +1 -1
  99. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/standalone-search-box/headless-standalone-search-box.ssr.d.ts +1 -1
  100. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/summary/headless-core-summary.ssr.d.ts +1 -1
  101. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-definitions.d.ts +1 -1
  102. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/engine.d.ts +1 -1
  103. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +1 -1
  104. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +1 -1
  105. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/instant-products/headless-instant-products.ssr.d.ts +1 -1
  106. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +1 -1
  107. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +1 -1
  108. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +1 -1
  109. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-list/headless-product-list.ssr.d.ts +1 -1
  110. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/recent-queries-list/headless-recent-queries-list.ssr.d.ts +1 -1
  111. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/search-box/headless-search-box.ssr.d.ts +1 -1
  112. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/standalone-search-box/headless-standalone-search-box.ssr.d.ts +1 -1
  113. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/summary/headless-core-summary.ssr.d.ts +1 -1
  114. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-inference.d.ts +1 -1
  115. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +1 -1
  116. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/controller-definition.d.ts +1 -1
  117. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/query-expression/query-expression.d.ts +1 -1
  118. package/force-app/main/default/staticresources/coveoheadless/headless.js +16 -16
  119. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  120. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +13 -13
  121. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  122. package/package.json +17 -18
@@ -14,31 +14,31 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var ZS=Object.create;var Ho=Object.defineProperty;var eb=Object.getOwnPropertyDescriptor;var tb=Object.getOwnPropertyNames;var rb=Object.getPrototypeOf,nb=Object.prototype.hasOwnProperty;var ob=(e,t,r)=>t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var zo=(e,t)=>()=>(e&&(t=e(e=0)),t);var He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wo=(e,t)=>{for(var r in t)Ho(e,r,{get:t[r],enumerable:!0})},Ef=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tb(t))!nb.call(e,o)&&o!==r&&Ho(e,o,{get:()=>t[o],enumerable:!(n=eb(t,o))||n.enumerable});return e};var _t=(e,t,r)=>(r=e!=null?ZS(rb(e)):{},Ef(t||!e||!e.__esModule?Ho(r,"default",{value:e,enumerable:!0}):r,e)),ib=e=>Ef(Ho({},"__esModule",{value:!0}),e);var we=(e,t,r)=>ob(e,typeof t!="symbol"?t+"":t,r);var b,d=zo(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function ra(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ra=function(t){return typeof t}:ra=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ra(e)}function cb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=ub.bind(this))}function ub(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),ab(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):sb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var ab,sb,f=zo(()=>{"use strict";ab=function(t){return typeof t=="string"},sb=function(t){return t instanceof Blob};cb.call((typeof window>"u"?"undefined":ra(window))==="object"?window:{})});var yu=He(Ko=>{"use strict";m();d();p();f();Object.defineProperty(Ko,"__esModule",{value:!0});function Rf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function lb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function db(e,t,r){return t=On(t),pb(e,kf()?Reflect.construct(t,r||[],On(e).constructor):t.apply(e,r))}function mu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function If(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,yb(n.key),n)}}function gu(e,t,r){return t&&If(e.prototype,t),r&&If(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=vb(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return a=c.done,c},e:function(c){s=!0,i=c},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function fu(){return fu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=mb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},fu.apply(null,arguments)}function On(e){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(e)}function fb(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&&pu(e,t)}function kf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kf=function(){return!!e})()}function pb(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 lb(e)}function pu(e,t){return pu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},pu(e,t)}function mb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=On(e))!==null;);return e}function gb(e,t,r,n){var o=fu(On(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function hb(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yb(e){var t=hb(e,"string");return typeof t=="symbol"?t:t+""}function vb(e,t){if(e){if(typeof e=="string")return Rf(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rf(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Sb(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 bb(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 _f=function(){function e(){mu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return gu(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var h=i[s];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},s=0,c=i.length;s<c;s++)a();return!r.defaultPrevented}}}])}(),hu=function(e){function t(){var r;return mu(this,t),r=db(this,t),r.listeners||_f.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return fb(t,e),gu(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),gb(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new na;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new na;function i(){o.abort(this.reason),a()}function a(){var h=Tf(n),v;try{for(h.s();!(v=h.n()).done;){var S=v.value;S.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var s=Tf(n),c;try{for(s.s();!(c=s.n()).done;){var u=c.value;if(u.aborted){o.abort(u.reason);break}else u.addEventListener("abort",i)}}catch(h){s.e(h)}finally{s.f()}return o.signal}}])}(_f),na=function(){function e(){mu(this,e),Object.defineProperty(this,"signal",{value:new hu,writable:!0,configurable:!0})}return gu(e,[{key:"abort",value:function(r){var n=bb(r),o=Sb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(na.prototype[Symbol.toStringTag]="AbortController",hu.prototype[Symbol.toStringTag]="AbortSignal");function Ab(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 wb(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Ab({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:c};var c=o;(c&&!c.prototype.hasOwnProperty("signal")||s)&&(c=function(S,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var x=new o(S,g);return y&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),x},c.prototype=o.prototype);var u=r,h=function(S,g){var y=c&&c.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(y){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(y.aborted)return Promise.reject(x);var E=new Promise(function(C,I){y.addEventListener("abort",function(){return I(x)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([E,u(S,g)])}return u(S,g)};return{fetch:h,Request:c}}Ko.AbortController=na;Ko.AbortSignal=hu;Ko.abortableFetch=wb});var Of,l,A,p=zo(()=>{"use strict";Of=_t(yu(),1),l=_t(yu(),1),{fetch:A}=(0,Of.abortableFetch)({fetch})});function Yo(e){if(Pb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function vu(e){return e.replace(Nb,"")}function Xo(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Fb(r))return!1}return!0}function Fb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Nf(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var xb,jf,Cb,Lf,Eb,Rb,Ib,Tb,_b,kb,Ob,Pb,Pf,Nb,Pn,Su,Ff,Df,Mf,qf,w,Uf=zo(()=>{"use strict";m();d();p();f();xb=Object.create,jf=Object.defineProperty,Cb=Object.getOwnPropertyDescriptor,Lf=Object.getOwnPropertyNames,Eb=Object.getPrototypeOf,Rb=Object.prototype.hasOwnProperty,Ib=(e,t)=>function(){return t||(0,e[Lf(e)[0]])((t={exports:{}}).exports,t),t.exports},Tb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Lf(t))!Rb.call(e,o)&&o!==r&&jf(e,o,{get:()=>t[o],enumerable:!(n=Cb(t,o))||n.enumerable});return e},_b=(e,t,r)=>(r=e!=null?xb(Eb(e)):{},Tb(t||!e||!e.__esModule?jf(r,"default",{value:e,enumerable:!0}):r,e)),kb=Ib({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){"use strict";var r={decodeValues:!0,map:!1,silent:!1};function n(c){return typeof c=="string"&&!!c.trim()}function o(c,u){var h=c.split(";").filter(n),v=h.shift(),S=i(v),g=S.name,y=S.value;u=u?Object.assign({},r,u):r;try{y=u.decodeValues?decodeURIComponent(y):y}catch(E){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+y+"'. Set options.decodeValues to false to disable this feature.",E)}var x={name:g,value:y};return h.forEach(function(E){var C=E.split("="),I=C.shift().trimLeft().toLowerCase(),T=C.join("=");I==="expires"?x.expires=new Date(T):I==="max-age"?x.maxAge=parseInt(T,10):I==="secure"?x.secure=!0:I==="httponly"?x.httpOnly=!0:I==="samesite"?x.sameSite=T:x[I]=T}),x}function i(c){var u="",h="",v=c.split("=");return v.length>1?(u=v.shift(),h=v.join("=")):h=c,{name:u,value:h}}function a(c,u){if(u=u?Object.assign({},r,u):r,!c)return u.map?{}:[];if(c.headers)if(typeof c.headers.getSetCookie=="function")c=c.headers.getSetCookie();else if(c.headers["set-cookie"])c=c.headers["set-cookie"];else{var h=c.headers[Object.keys(c.headers).find(function(S){return S.toLowerCase()==="set-cookie"})];!h&&c.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),c=h}if(Array.isArray(c)||(c=[c]),u=u?Object.assign({},r,u):r,u.map){var v={};return c.filter(n).reduce(function(S,g){var y=o(g,u);return S[y.name]=y,S},v)}else return c.filter(n).map(function(S){return o(S,u)})}function s(c){if(Array.isArray(c))return c;if(typeof c!="string")return[];var u=[],h=0,v,S,g,y,x;function E(){for(;h<c.length&&/\s/.test(c.charAt(h));)h+=1;return h<c.length}function C(){return S=c.charAt(h),S!=="="&&S!==";"&&S!==","}for(;h<c.length;){for(v=h,x=!1;E();)if(S=c.charAt(h),S===","){for(g=h,h+=1,E(),y=h;h<c.length&&C();)h+=1;h<c.length&&c.charAt(h)==="="?(x=!0,h=y,u.push(c.substring(v,g)),v=h):h=g+1}else h+=1;(!x||h>=c.length)&&u.push(c.substring(v,c.length))}return u}t.exports=a,t.exports.parse=a,t.exports.parseString=o,t.exports.splitCookiesString=s}}),Ob=_b(kb()),Pb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Pf=[`
19
- `,"\r","\t"," "],Nb=new RegExp(`(^[${Pf.join("")}]|$[${Pf.join("")}])`,"g");Pn=Symbol("normalizedHeaders"),Su=Symbol("rawHeaderNames"),Ff=", ",w=class Vf{constructor(t){this[Df]={},this[Mf]=new Map,this[qf]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor.name)||t instanceof Vf||typeof b.Headers<"u"&&t instanceof b.Headers?t.forEach((n,o)=>{this.append(o,n)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Ff):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Ff):n)})}[(Df=Pn,Mf=Su,qf=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[Pn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Xo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Pn].hasOwnProperty(Yo(t))}get(t){if(!Xo(t))throw TypeError(`Invalid header name "${t}"`);return this[Pn][Yo(t)]??null}set(t,r){if(!Xo(t)||!Nf(r))return;let n=Yo(t),o=vu(r);this[Pn][n]=vu(o),this[Su].set(n,t)}append(t,r){if(!Xo(t)||!Nf(r))return;let n=Yo(t),o=vu(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Xo(t)||!this.has(t))return;let r=Yo(t);delete this[Pn][r],this[Su].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,Ob.splitCookiesString)(t)}}});var m=zo(()=>{"use strict";Uf()});var Kf=He(ei=>{"use strict";m();d();p();f();var sa=ei&&ei.__assign||function(){return sa=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},sa.apply(this,arguments)};Object.defineProperty(ei,"__esModule",{value:!0});var $b={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Gb(e){var t=sa(sa({},$b),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ei.getSanitizedOptions=Gb});var Yf=He(xu=>{"use strict";m();d();p();f();Object.defineProperty(xu,"__esModule",{value:!0});function Qb(e){var t=Math.random()*e;return Math.round(t)}xu.fullJitter=Qb});var Xf=He(Cu=>{"use strict";m();d();p();f();Object.defineProperty(Cu,"__esModule",{value:!0});function Hb(e){return e}Cu.noJitter=Hb});var Jf=He(Eu=>{"use strict";m();d();p();f();Object.defineProperty(Eu,"__esModule",{value:!0});var zb=Yf(),Wb=Xf();function Kb(e){switch(e.jitter){case"full":return zb.fullJitter;case"none":default:return Wb.noJitter}}Eu.JitterFactory=Kb});var Iu=He(Ru=>{"use strict";m();d();p();f();Object.defineProperty(Ru,"__esModule",{value:!0});var Yb=Jf(),Xb=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=Yb.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Ru.Delay=Xb});var Zf=He(Kt=>{"use strict";m();d();p();f();var Jb=Kt&&Kt.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zb=Kt&&Kt.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},eA=Kt&&Kt.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Kt,"__esModule",{value:!0});var tA=Iu(),rA=function(e){Jb(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return Zb(this,void 0,void 0,function(){return eA(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(tA.Delay);Kt.SkipFirstDelay=rA});var ep=He(ti=>{"use strict";m();d();p();f();var nA=ti&&ti.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(ti,"__esModule",{value:!0});var oA=Iu(),iA=function(e){nA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(oA.Delay);ti.AlwaysDelay=iA});var tp=He(Tu=>{"use strict";m();d();p();f();Object.defineProperty(Tu,"__esModule",{value:!0});var aA=Zf(),sA=ep();function cA(e,t){var r=uA(e);return r.setAttemptNumber(t),r}Tu.DelayFactory=cA;function uA(e){return e.delayFirstAttempt?new sA.AlwaysDelay(e):new aA.SkipFirstDelay(e)}});var rp=He(Ur=>{"use strict";m();d();p();f();var _u=Ur&&Ur.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},ku=Ur&&Ur.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Ur,"__esModule",{value:!0});var lA=Kf(),dA=tp();function fA(e,t){return t===void 0&&(t={}),_u(this,void 0,void 0,function(){var r,n;return ku(this,function(o){switch(o.label){case 0:return r=lA.getSanitizedOptions(t),n=new pA(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Ur.backOff=fA;var pA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return _u(this,void 0,void 0,function(){var t,r;return ku(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return _u(this,void 0,void 0,function(){var t;return ku(this,function(r){switch(r.label){case 0:return t=dA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var ms=He((Wl,Kl)=>{"use strict";m();d();p();f();(function(e,t){typeof Wl=="object"&&typeof Kl<"u"?Kl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(Wl,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(G){var B=["th","st","nd","rd"],U=G%100;return"["+G+(B[(U-20)%10]||B[U]||B[0])+"]"}},C=function(G,B,U){var Q=String(G);return!Q||Q.length>=B?G:""+Array(B+1-Q.length).join(U)+G},I={s:C,z:function(G){var B=-G.utcOffset(),U=Math.abs(B),Q=Math.floor(U/60),$=U%60;return(B<=0?"+":"-")+C(Q,2,"0")+":"+C($,2,"0")},m:function G(B,U){if(B.date()<U.date())return-G(U,B);var Q=12*(U.year()-B.year())+(U.month()-B.month()),$=B.clone().add(Q,u),K=U-$<0,Y=B.clone().add(Q+(K?-1:1),u);return+(-(Q+(U-$)/(K?$-Y:Y-$))||0)},a:function(G){return G<0?Math.ceil(G)||0:Math.floor(G)},p:function(G){return{M:u,y:v,w:c,d:s,D:S,h:a,m:i,s:o,ms:n,Q:h}[G]||String(G||"").toLowerCase().replace(/s$/,"")},u:function(G){return G===void 0}},T="en",_={};_[T]=E;var j="$isDayjsObject",N=function(G){return G instanceof V||!(!G||!G[j])},k=function G(B,U,Q){var $;if(!B)return T;if(typeof B=="string"){var K=B.toLowerCase();_[K]&&($=K),U&&(_[K]=U,$=K);var Y=B.split("-");if(!$&&Y.length>1)return G(Y[0])}else{var ne=B.name;_[ne]=B,$=ne}return!Q&&$&&(T=$),$||!Q&&T},O=function(G,B){if(N(G))return G.clone();var U=typeof B=="object"?B:{};return U.date=G,U.args=arguments,new V(U)},D=I;D.l=k,D.i=N,D.w=function(G,B){return O(G,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var V=function(){function G(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[j]=!0}var B=G.prototype;return B.parse=function(U){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 Y=$.match(y);if(Y){var ne=Y[2]-1||0,fe=(Y[7]||"0").substring(0,3);return K?new Date(Date.UTC(Y[1],ne,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,fe)):new Date(Y[1],ne,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,fe)}}return new Date($)}(U),this.init()},B.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==g},B.isSame=function(U,Q){var $=O(U);return this.startOf(Q)<=$&&$<=this.endOf(Q)},B.isAfter=function(U,Q){return O(U)<this.startOf(Q)},B.isBefore=function(U,Q){return this.endOf(Q)<O(U)},B.$g=function(U,Q,$){return D.u(U)?this[Q]:this.set($,U)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(U,Q){var $=this,K=!!D.u(Q)||Q,Y=D.p(U),ne=function(Ce,De){var Be=D.w($.$u?Date.UTC($.$y,De,Ce):new Date($.$y,De,Ce),$);return K?Be:Be.endOf(s)},fe=function(Ce,De){return D.w($.toDate()[Ce].apply($.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(De)),$)},be=this.$W,de=this.$M,pe=this.$D,le="set"+(this.$u?"UTC":"");switch(Y){case v:return K?ne(1,0):ne(31,11);case u:return K?ne(1,de):ne(0,de+1);case c:var he=this.$locale().weekStart||0,Le=(be<he?be+7:be)-he;return ne(K?pe-Le:pe+(6-Le),de);case s:case S:return fe(le+"Hours",0);case a:return fe(le+"Minutes",1);case i:return fe(le+"Seconds",2);case o:return fe(le+"Milliseconds",3);default:return this.clone()}},B.endOf=function(U){return this.startOf(U,!1)},B.$set=function(U,Q){var $,K=D.p(U),Y="set"+(this.$u?"UTC":""),ne=($={},$[s]=Y+"Date",$[S]=Y+"Date",$[u]=Y+"Month",$[v]=Y+"FullYear",$[a]=Y+"Hours",$[i]=Y+"Minutes",$[o]=Y+"Seconds",$[n]=Y+"Milliseconds",$)[K],fe=K===s?this.$D+(Q-this.$W):Q;if(K===u||K===v){var be=this.clone().set(S,1);be.$d[ne](fe),be.init(),this.$d=be.set(S,Math.min(this.$D,be.daysInMonth())).$d}else ne&&this.$d[ne](fe);return this.init(),this},B.set=function(U,Q){return this.clone().$set(U,Q)},B.get=function(U){return this[D.p(U)]()},B.add=function(U,Q){var $,K=this;U=Number(U);var Y=D.p(Q),ne=function(de){var pe=O(K);return D.w(pe.date(pe.date()+Math.round(de*U)),K)};if(Y===u)return this.set(u,this.$M+U);if(Y===v)return this.set(v,this.$y+U);if(Y===s)return ne(1);if(Y===c)return ne(7);var fe=($={},$[i]=t,$[a]=r,$[o]=e,$)[Y]||1,be=this.$d.getTime()+U*fe;return D.w(be,this)},B.subtract=function(U,Q){return this.add(-1*U,Q)},B.format=function(U){var Q=this,$=this.$locale();if(!this.isValid())return $.invalidDate||g;var K=U||"YYYY-MM-DDTHH:mm:ssZ",Y=D.z(this),ne=this.$H,fe=this.$m,be=this.$M,de=$.weekdays,pe=$.months,le=$.meridiem,he=function(De,Be,ut,bt){return De&&(De[Be]||De(Q,K))||ut[Be].slice(0,bt)},Le=function(De){return D.s(ne%12||12,De,"0")},Ce=le||function(De,Be,ut){var bt=De<12?"AM":"PM";return ut?bt.toLowerCase():bt};return K.replace(x,function(De,Be){return Be||function(ut){switch(ut){case"YY":return String(Q.$y).slice(-2);case"YYYY":return D.s(Q.$y,4,"0");case"M":return be+1;case"MM":return D.s(be+1,2,"0");case"MMM":return he($.monthsShort,be,pe,3);case"MMMM":return he(pe,be);case"D":return Q.$D;case"DD":return D.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return he($.weekdaysMin,Q.$W,de,2);case"ddd":return he($.weekdaysShort,Q.$W,de,3);case"dddd":return de[Q.$W];case"H":return String(ne);case"HH":return D.s(ne,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return Ce(ne,fe,!0);case"A":return Ce(ne,fe,!1);case"m":return String(fe);case"mm":return D.s(fe,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 Y}return null}(De)||Y.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(U,Q,$){var K,Y=this,ne=D.p(Q),fe=O(U),be=(fe.utcOffset()-this.utcOffset())*t,de=this-fe,pe=function(){return D.m(Y,fe)};switch(ne){case v:K=pe()/12;break;case u:K=pe();break;case h:K=pe()/3;break;case c:K=(de-be)/6048e5;break;case s:K=(de-be)/864e5;break;case a:K=de/r;break;case i:K=de/t;break;case o:K=de/e;break;default:K=de}return $?K:D.a(K)},B.daysInMonth=function(){return this.endOf(u).$D},B.$locale=function(){return _[this.$L]},B.locale=function(U,Q){if(!U)return this.$L;var $=this.clone(),K=k(U,Q,!0);return K&&($.$L=K),$},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},G}(),z=V.prototype;return O.prototype=z,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",u],["$y",v],["$D",S]].forEach(function(G){z[G[1]]=function(B){return this.$g(B,G[0],G[1])}}),O.extend=function(G,B){return G.$i||(G(B,V,O),G.$i=!0),O},O.locale=k,O.isDayjs=N,O.unix=function(G){return O(1e3*G)},O.en=_[T],O.Ls=_,O.p={},O})});var Gg=He((Yl,Xl)=>{"use strict";m();d();p();f();(function(e,t){typeof Yl=="object"&&typeof Xl<"u"?Xl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(Yl,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,c){return s=Number(s),this.$utils().p(c)===t?this.add(3*s,e):i.bind(this)(s,c)};var a=o.startOf;o.startOf=function(s,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(s)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,c)}}})});var Qg=He((Jl,Zl)=>{"use strict";m();d();p();f();(function(e,t){typeof Jl=="object"&&typeof Zl<"u"?Zl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(Jl,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(x){this[y]=+x}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var E=x.match(/([+-]|\d\d)/g),C=60*E[1]+(+E[2]||0);return C===0?0:E[0]==="+"?-C:C}(y)}],h=function(y){var x=a[y];return x&&(x.indexOf?x:x.s.concat(x.f))},v=function(y,x){var E,C=a.meridiem;if(C){for(var I=1;I<=24;I+=1)if(y.indexOf(C(I,0,x))>-1){E=I>12;break}}else E=y===(x?"pm":"PM");return E},S={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[n,c("day")],Do:[i,function(y){var x=a.ordinal,E=y.match(/\d+/);if(this.day=E[0],x)for(var C=1;C<=31;C+=1)x(C).replace(/\[|\]/g,"")===y&&(this.day=C)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(y){var x=h("months"),E=(h("monthsShort")||x.map(function(C){return C.slice(0,3)})).indexOf(y)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[i,function(y){var x=h("months").indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var x,E;x=y,E=a&&a.formats;for(var C=(y=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,D,V){var z=V&&V.toUpperCase();return D||E[V]||e[V]||E[z].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(G,B,U){return B||U.slice(1)})})).match(t),I=C.length,T=0;T<I;T+=1){var _=C[T],j=S[_],N=j&&j[0],k=j&&j[1];C[T]=k?{regex:N,parser:k}:_.replace(/^\[|\]$/g,"")}return function(O){for(var D={},V=0,z=0;V<I;V+=1){var G=C[V];if(typeof G=="string")z+=G.length;else{var B=G.regex,U=G.parser,Q=O.slice(z),$=B.exec(Q)[0];U.call(D,$),O=O.replace($,"")}}return function(K){var Y=K.afternoon;if(Y!==void 0){var ne=K.hours;Y?ne<12&&(K.hours+=12):ne===12&&(K.hours=0),delete K.afternoon}}(D),D}}return function(y,x,E){E.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var C=x.prototype,I=C.parse;C.parse=function(T){var _=T.date,j=T.utc,N=T.args;this.$u=j;var k=N[1];if(typeof k=="string"){var O=N[2]===!0,D=N[3]===!0,V=O||D,z=N[2];D&&(z=N[2]),a=this.$locale(),!O&&z&&(a=E.Ls[z]),this.$d=function(Q,$,K,Y){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*Q);var ne=g($)(Q),fe=ne.year,be=ne.month,de=ne.day,pe=ne.hours,le=ne.minutes,he=ne.seconds,Le=ne.milliseconds,Ce=ne.zone,De=ne.week,Be=new Date,ut=de||(fe||be?1:Be.getDate()),bt=fe||Be.getFullYear(),lr=0;fe&&!be||(lr=be>0?be-1:Be.getMonth());var _n,kn=pe||0,Qo=le||0,lu=he||0,du=Le||0;return Ce?new Date(Date.UTC(bt,lr,ut,kn,Qo,lu,du+60*Ce.offset*1e3)):K?new Date(Date.UTC(bt,lr,ut,kn,Qo,lu,du)):(_n=new Date(bt,lr,ut,kn,Qo,lu,du),De&&(_n=Y(_n).week(De).toDate()),_n)}catch{return new Date("")}}(_,k,j,E),this.init(),z&&z!==!0&&(this.$L=this.locale(z).$L),V&&_!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var G=k.length,B=1;B<=G;B+=1){N[1]=k[B-1];var U=E.apply(this,N);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}B===G&&(this.$d=new Date(""))}else I.call(this,T)}}})});var Mh=He((gd,hd)=>{"use strict";m();d();p();f();(function(e,t){typeof gd=="object"&&typeof hd<"u"?hd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(gd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(x,E){E===void 0&&(E={});var C=E.timeZoneName||"short",I=x+"|"+C,T=t[I];return T||(T=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),t[I]=T),T}(v,S);return y.formatToParts(g)},s=function(h,v){for(var S=a(h,v),g=[],y=0;y<S.length;y+=1){var x=S[y],E=x.type,C=x.value,I=e[E];I>=0&&(g[I]=parseInt(C,10))}var T=g[3],_=T===24?0:T,j=g[0]+"-"+g[1]+"-"+g[2]+" "+_+":"+g[4]+":"+g[5]+":000",N=+h;return(o.utc(j).valueOf()-(N-=N%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=i);var S,g=this.utcOffset(),y=this.toDate(),x=y.toLocaleString("en-US",{timeZone:h}),E=Math.round((y-new Date(x))/1e3/60),C=15*-Math.round(y.getTimezoneOffset()/15)-E;if(!Number(C))S=this.utcOffset(0,v);else if(S=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),v){var I=S.utcOffset();S=S.add(g-I,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||o.tz.guess(),S=a(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},o.tz=function(h,v,S){var g=S&&v,y=S||v||i,x=s(+o(),y);if(typeof h!="string")return o(h).tz(y);var E=function(_,j,N){var k=_-60*j*1e3,O=s(k,N);if(j===O)return[k,j];var D=s(k-=60*(O-j)*1e3,N);return O===D?[k,O]:[_-60*Math.min(O,D)*1e3,Math.max(O,D)]}(o.utc(h,g).valueOf(),x,y),C=E[0],I=E[1],T=o(C).utcOffset(I);return T.$x.$timezone=y,T},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var qh=He((yd,vd)=>{"use strict";m();d();p();f();(function(e,t){typeof yd=="object"&&typeof vd<"u"?vd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_utc=t()})(yd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(g){var y={date:g,utc:!0,args:arguments};return new o(y)},a.utc=function(g){var y=i(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),s.call(this,g)};var c=a.init;a.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=a.utcOffset;a.utcOffset=function(g,y){var x=this.$utils().u;if(x(g))return this.$u?0:x(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(T){T===void 0&&(T="");var _=T.match(t);if(!_)return null;var j=(""+_[0]).match(r)||["-",0,0],N=j[0],k=60*+j[1]+ +j[2];return k===0?0:N==="+"?k:-k}(g),g===null))return this;var E=Math.abs(g)<=16?60*g:g,C=this;if(y)return C.$offset=E,C.$u=g===0,C;if(g!==0){var I=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(C=this.local().add(E+I,e)).$offset=E,C.$x.$localOffset=I}else C=this.utc();return C};var h=a.format;a.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},a.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=a.diff;a.diff=function(g,y,x){if(g&&this.$u===g.$u)return S.call(this,g,y,x);var E=this.local(),C=i(g).local();return S.call(E,C,y,x)}}})});var tS=He((Iae,eS)=>{"use strict";m();d();p();f();function v0(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}eS.exports=S0;function S0(e,t,r){var n=r&&r.stringify||v0,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",h=1-o,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var sS=He((Pae,Xc)=>{"use strict";m();d();p();f();var rS=tS();Xc.exports=ur;var Xi=F0().console||{},b0={mapHttpRequest:Yc,mapHttpResponse:Yc,wrapRequestSerializer:mf,wrapResponseSerializer:mf,wrapErrorSerializer:mf,req:Yc,res:Yc,err:oS,errWithCause:oS};function jr(e,t){return e==="silent"?1/0:t.levels.values[e]}var yf=Symbol("pino.logFuncs"),gf=Symbol("pino.hierarchy"),A0={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function nS(e,t){let r={logger:t,parent:e[gf]};t[gf]=r}function w0(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Xi[o]||Xi[A0[o]||"log"]||Lo}),e[yf]=n}function x0(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function ur(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Xi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=x0(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(x){r[x]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=Lo),w0(u,s,r),nS({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:s,timestamp:O0(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Lo};u.levels=C0(e),u.level=c,u.isLevelEnabled=function(x){return this.levels.values[x]?this.levels.values[x]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Lo,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...x){return y.call(this,h,...x)},t&&(u._logEvent=hf());function v(){return jr(this.level,this)}function S(){return this._level}function g(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,En(this,h,u,"error"),En(this,h,u,"fatal"),En(this,h,u,"warn"),En(this,h,u,"info"),En(this,h,u,"debug"),En(this,h,u,"trace"),a.forEach(E=>{En(this,h,u,E)})}function y(x,E,C){if(!E)throw new Error("missing bindings for child Pino");C=C||{},o&&E.serializers&&(C.serializers=E.serializers);let I=C.serializers;if(o&&I){var T=Object.assign({},n,I),_=e.browser.serialize===!0?Object.keys(T):o;delete E.serializers,vf([E],_,T,this._stdErrSerialize)}function j(k){this._childLevel=(k._childLevel|0)+1,this.bindings=E,T&&(this.serializers=T,this._serialize=_),t&&(this._logEvent=hf([].concat(k._logEvent.bindings,E)))}j.prototype=this;let N=new j(this);return nS(this,N),N.child=function(...k){return y.call(this,x,...k)},N.level=C.level||this.level,x.onChild(N),N}return u}function C0(e){let t=e.customLevels||{},r=Object.assign({},ur.levels.values,t),n=Object.assign({},ur.levels.labels,E0(t));return{values:r,labels:n}}function E0(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}ur.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"}};ur.stdSerializers=b0;ur.stdTimeFunctions=Object.assign({},{nullTime:iS,epochTime:aS,unixTime:P0,isoTime:N0});function R0(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[gf];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function En(e,t,r,n){if(Object.defineProperty(e,n,{value:jr(e.level,r)>jr(n,r)?Lo:r[yf][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Lo){if(!t.transmit)return;let i=t.transmit.level||e.level,a=jr(i,r);if(jr(n,r)<a)return}e[n]=T0(e,t,r,n);let o=R0(e);o.length!==0&&(e[n]=I0(o,e[n]))}function I0(e,t){return function(){return t.apply(this,[...e,...arguments])}}function T0(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xi?Xi:this;for(var u=0;u<s.length;u++)s[u]=arguments[u];var h=!1;if(t.serialize&&(vf(s,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?o.call(c,..._0(this,n,s,a,t)):o.apply(c,s),t.transmit){let v=t.transmit.level||e._level,S=jr(v,r),g=jr(n,r);if(g<S)return;k0(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:jr(e._level,r)},s,h)}}}(e[yf][n])}function _0(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),c=s[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());return[a(u),...s]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());c=s.length?rS(s.shift(),s):void 0}else typeof c=="string"&&(c=rS(s.shift(),s));return c!==void 0&&(u[o.messageKey]=c),[a(u)]}}function vf(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=ur.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function k0(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;n||vf(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,c),e._logEvent=hf(u)}function hf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function oS(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function O0(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?iS:aS}function Yc(){return{}}function mf(e){return e}function Lo(){}function iS(){return!1}function aS(){return Date.now()}function P0(){return Math.round(Date.now()/1e3)}function N0(){return new Date(Date.now()).toISOString()}function F0(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}Xc.exports.default=ur;Xc.exports.pino=ur});var Fk={};Wo(Fk,{DefaultFieldsToInclude:()=>Cf,EcommerceDefaultFieldsToInclude:()=>KS,HighlightUtils:()=>wu,MinimumFieldsToInclude:()=>cu,ResultTemplatesHelpers:()=>lh,buildContext:()=>yS,buildController:()=>Lr,buildDictionaryFieldContext:()=>vS,buildInteractiveResult:()=>QS,buildRecommendationEngine:()=>mS,buildRecommendationList:()=>$S,buildResultTemplatesManager:()=>JS,getAnalyticsNextApiBaseUrl:()=>ca,getOrganizationEndpoint:()=>We,getSampleRecommendationEngineConfiguration:()=>Sf,loadAdvancedSearchQueryActions:()=>Sk,loadClickAnalyticsActions:()=>kk,loadConfigurationActions:()=>bk,loadContextActions:()=>wk,loadDebugActions:()=>xk,loadDictionaryFieldContextActions:()=>Ck,loadFieldActions:()=>Ik,loadPaginationActions:()=>xf,loadPipelineActions:()=>Tk,loadRecommendationActions:()=>_k,loadSearchConfigurationActions:()=>Ak,loadSearchHubActions:()=>Nk});module.exports=ib(Fk);m();d();p();f();var wu={};Wo(wu,{escapeHtml:()=>Nn,getHighlightedSuggestion:()=>Bb,highlightString:()=>Ub});m();d();p();f();m();d();p();f();function Db(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessRecommendation",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessRecommendation"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var ob=Object.create;var Qo=Object.defineProperty;var ib=Object.getOwnPropertyDescriptor;var ab=Object.getOwnPropertyNames;var sb=Object.getPrototypeOf,cb=Object.prototype.hasOwnProperty;var ub=(e,t,r)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ho=(e,t)=>()=>(e&&(t=e(e=0)),t);var He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zo=(e,t)=>{for(var r in t)Qo(e,r,{get:t[r],enumerable:!0})},Ep=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ab(t))!cb.call(e,o)&&o!==r&&Qo(e,o,{get:()=>t[o],enumerable:!(n=ib(t,o))||n.enumerable});return e};var _t=(e,t,r)=>(r=e!=null?ob(sb(e)):{},Ep(t||!e||!e.__esModule?Qo(r,"default",{value:e,enumerable:!0}):r,e)),lb=e=>Ep(Qo({},"__esModule",{value:!0}),e);var we=(e,t,r)=>ub(e,typeof t!="symbol"?t+"":t,r);var b,d=Ho(()=>{"use strict";b=typeof globalThis<"u"?globalThis:window});function ta(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ta=function(t){return typeof t}:ta=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ta(e)}function fb(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=mb.bind(this))}function mb(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),db(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):pb(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var db,pb,p=Ho(()=>{"use strict";db=function(t){return typeof t=="string"},pb=function(t){return t instanceof Blob};fb.call((typeof window>"u"?"undefined":ta(window))==="object"?window:{})});var vu=He(Wo=>{"use strict";m();d();f();p();Object.defineProperty(Wo,"__esModule",{value:!0});function Rp(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function gb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hb(e,t,r){return t=On(t),vb(e,kp()?Reflect.construct(t,r||[],On(e).constructor):t.apply(e,r))}function gu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ip(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,wb(n.key),n)}}function hu(e,t,r){return t&&Ip(e.prototype,t),r&&Ip(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tp(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=xb(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return a=c.done,c},e:function(c){s=!0,i=c},f:function(){try{a||r.return==null||r.return()}finally{if(s)throw i}}}}function fu(){return fu=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Sb(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},fu.apply(null,arguments)}function On(e){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(e)}function yb(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&&mu(e,t)}function kp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kp=function(){return!!e})()}function vb(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 gb(e)}function mu(e,t){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},mu(e,t)}function Sb(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=On(e))!==null;);return e}function bb(e,t,r,n){var o=fu(On(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(i){return o.apply(r,i)}:o}function Ab(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wb(e){var t=Ab(e,"string");return typeof t=="symbol"?t:t+""}function xb(e,t){if(e){if(typeof e=="string")return Rp(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rp(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Cb(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 Eb(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 _p=function(){function e(){gu(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return hu(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],i=0,a=o.length;i<a;i++)if(o[i].callback===n){o.splice(i,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],i=o.slice(),a=function(){var h=i[s];try{h.callback.call(n,r)}catch(v){Promise.resolve().then(function(){throw v})}h.options&&h.options.once&&n.removeEventListener(r.type,h.callback)},s=0,c=i.length;s<c;s++)a();return!r.defaultPrevented}}}])}(),yu=function(e){function t(){var r;return gu(this,t),r=hb(this,t),r.listeners||_p.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return yb(t,e),hu(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),bb(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,i=o===void 0?"Aborted":o;if(n)throw i}}],[{key:"timeout",value:function(n){var o=new ra;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new ra;function i(){o.abort(this.reason),a()}function a(){var h=Tp(n),v;try{for(h.s();!(v=h.n()).done;){var S=v.value;S.removeEventListener("abort",i)}}catch(g){h.e(g)}finally{h.f()}}var s=Tp(n),c;try{for(s.s();!(c=s.n()).done;){var u=c.value;if(u.aborted){o.abort(u.reason);break}else u.addEventListener("abort",i)}}catch(h){s.e(h)}finally{s.f()}return o.signal}}])}(_p),ra=function(){function e(){gu(this,e),Object.defineProperty(this,"signal",{value:new yu,writable:!0,configurable:!0})}return hu(e,[{key:"abort",value:function(r){var n=Eb(r),o=Cb(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(ra.prototype[Symbol.toStringTag]="AbortController",yu.prototype[Symbol.toStringTag]="AbortSignal");function Rb(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 Ib(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,i=t.AbortController,a=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=a===void 0?!1:a;if(!Rb({fetch:r,Request:o,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:c};var c=o;(c&&!c.prototype.hasOwnProperty("signal")||s)&&(c=function(S,g){var y;g&&g.signal&&(y=g.signal,delete g.signal);var x=new o(S,g);return y&&Object.defineProperty(x,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),x},c.prototype=o.prototype);var u=r,h=function(S,g){var y=c&&c.prototype.isPrototypeOf(S)?S.signal:g?g.signal:void 0;if(y){var x;try{x=new DOMException("Aborted","AbortError")}catch{x=new Error("Aborted"),x.name="AbortError"}if(y.aborted)return Promise.reject(x);var E=new Promise(function(C,I){y.addEventListener("abort",function(){return I(x)},{once:!0})});return g&&g.signal&&delete g.signal,Promise.race([E,u(S,g)])}return u(S,g)};return{fetch:h,Request:c}}Wo.AbortController=ra;Wo.AbortSignal=yu;Wo.abortableFetch=Ib});var Op,l,A,f=Ho(()=>{"use strict";Op=_t(vu(),1),l=_t(vu(),1),{fetch:A}=(0,Op.abortableFetch)({fetch})});function Ko(e){if(jb.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Su(e){return e.replace(qb,"")}function Yo(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Lb(r))return!1}return!0}function Lb(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Np(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var Tb,qp,_b,Lp,kb,Ob,Pb,Nb,Fb,Db,Mb,jb,Pp,qb,Pn,bu,Fp,Dp,Mp,jp,w,Up=Ho(()=>{"use strict";m();d();f();p();Tb=Object.create,qp=Object.defineProperty,_b=Object.getOwnPropertyDescriptor,Lp=Object.getOwnPropertyNames,kb=Object.getPrototypeOf,Ob=Object.prototype.hasOwnProperty,Pb=(e,t)=>function(){return t||(0,e[Lp(e)[0]])((t={exports:{}}).exports,t),t.exports},Nb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Lp(t))!Ob.call(e,o)&&o!==r&&qp(e,o,{get:()=>t[o],enumerable:!(n=_b(t,o))||n.enumerable});return e},Fb=(e,t,r)=>(r=e!=null?Tb(kb(e)):{},Nb(t||!e||!e.__esModule?qp(r,"default",{value:e,enumerable:!0}):r,e)),Db=Pb({"node_modules/set-cookie-parser/lib/set-cookie.js"(e,t){"use strict";var r={decodeValues:!0,map:!1,silent:!1};function n(c){return typeof c=="string"&&!!c.trim()}function o(c,u){var h=c.split(";").filter(n),v=h.shift(),S=i(v),g=S.name,y=S.value;u=u?Object.assign({},r,u):r;try{y=u.decodeValues?decodeURIComponent(y):y}catch(E){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+y+"'. Set options.decodeValues to false to disable this feature.",E)}var x={name:g,value:y};return h.forEach(function(E){var C=E.split("="),I=C.shift().trimLeft().toLowerCase(),T=C.join("=");I==="expires"?x.expires=new Date(T):I==="max-age"?x.maxAge=parseInt(T,10):I==="secure"?x.secure=!0:I==="httponly"?x.httpOnly=!0:I==="samesite"?x.sameSite=T:x[I]=T}),x}function i(c){var u="",h="",v=c.split("=");return v.length>1?(u=v.shift(),h=v.join("=")):h=c,{name:u,value:h}}function a(c,u){if(u=u?Object.assign({},r,u):r,!c)return u.map?{}:[];if(c.headers)if(typeof c.headers.getSetCookie=="function")c=c.headers.getSetCookie();else if(c.headers["set-cookie"])c=c.headers["set-cookie"];else{var h=c.headers[Object.keys(c.headers).find(function(S){return S.toLowerCase()==="set-cookie"})];!h&&c.headers.cookie&&!u.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),c=h}if(Array.isArray(c)||(c=[c]),u=u?Object.assign({},r,u):r,u.map){var v={};return c.filter(n).reduce(function(S,g){var y=o(g,u);return S[y.name]=y,S},v)}else return c.filter(n).map(function(S){return o(S,u)})}function s(c){if(Array.isArray(c))return c;if(typeof c!="string")return[];var u=[],h=0,v,S,g,y,x;function E(){for(;h<c.length&&/\s/.test(c.charAt(h));)h+=1;return h<c.length}function C(){return S=c.charAt(h),S!=="="&&S!==";"&&S!==","}for(;h<c.length;){for(v=h,x=!1;E();)if(S=c.charAt(h),S===","){for(g=h,h+=1,E(),y=h;h<c.length&&C();)h+=1;h<c.length&&c.charAt(h)==="="?(x=!0,h=y,u.push(c.substring(v,g)),v=h):h=g+1}else h+=1;(!x||h>=c.length)&&u.push(c.substring(v,c.length))}return u}t.exports=a,t.exports.parse=a,t.exports.parseString=o,t.exports.splitCookiesString=s}}),Mb=Fb(Db()),jb=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Pp=[`
19
+ `,"\r","\t"," "],qb=new RegExp(`(^[${Pp.join("")}]|$[${Pp.join("")}])`,"g");Pn=Symbol("normalizedHeaders"),bu=Symbol("rawHeaderNames"),Fp=", ",w=class Vp{constructor(t){this[Dp]={},this[Mp]=new Map,this[jp]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor.name)||t instanceof Vp||typeof b.Headers<"u"&&t instanceof b.Headers?t.forEach((n,o)=>{this.append(o,n)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Fp):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Fp):n)})}[(Dp=Pn,Mp=bu,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[Pn]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Yo(t))throw new TypeError(`Invalid header name "${t}"`);return this[Pn].hasOwnProperty(Ko(t))}get(t){if(!Yo(t))throw TypeError(`Invalid header name "${t}"`);return this[Pn][Ko(t)]??null}set(t,r){if(!Yo(t)||!Np(r))return;let n=Ko(t),o=Su(r);this[Pn][n]=Su(o),this[bu].set(n,t)}append(t,r){if(!Yo(t)||!Np(r))return;let n=Ko(t),o=Su(r),i=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,i)}delete(t){if(!Yo(t)||!this.has(t))return;let r=Ko(t);delete this[Pn][r],this[bu].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:(0,Mb.splitCookiesString)(t)}}});var m=Ho(()=>{"use strict";Up()});var Kp=He(Zo=>{"use strict";m();d();f();p();var aa=Zo&&Zo.__assign||function(){return aa=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},aa.apply(this,arguments)};Object.defineProperty(Zo,"__esModule",{value:!0});var Wb={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Kb(e){var t=aa(aa({},Wb),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Zo.getSanitizedOptions=Kb});var Yp=He(Cu=>{"use strict";m();d();f();p();Object.defineProperty(Cu,"__esModule",{value:!0});function Yb(e){var t=Math.random()*e;return Math.round(t)}Cu.fullJitter=Yb});var Xp=He(Eu=>{"use strict";m();d();f();p();Object.defineProperty(Eu,"__esModule",{value:!0});function Xb(e){return e}Eu.noJitter=Xb});var Jp=He(Ru=>{"use strict";m();d();f();p();Object.defineProperty(Ru,"__esModule",{value:!0});var Jb=Yp(),Zb=Xp();function eA(e){return e.jitter==="full"?Jb.fullJitter:Zb.noJitter}Ru.JitterFactory=eA});var Tu=He(Iu=>{"use strict";m();d();f();p();Object.defineProperty(Iu,"__esModule",{value:!0});var tA=Jp(),rA=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=tA.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Iu.Delay=rA});var Zp=He(Kt=>{"use strict";m();d();f();p();var nA=Kt&&Kt.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),oA=Kt&&Kt.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},iA=Kt&&Kt.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Kt,"__esModule",{value:!0});var aA=Tu(),sA=function(e){nA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return oA(this,void 0,void 0,function(){return iA(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(aA.Delay);Kt.SkipFirstDelay=sA});var ef=He(ei=>{"use strict";m();d();f();p();var cA=ei&&ei.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(ei,"__esModule",{value:!0});var uA=Tu(),lA=function(e){cA(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(uA.Delay);ei.AlwaysDelay=lA});var tf=He(_u=>{"use strict";m();d();f();p();Object.defineProperty(_u,"__esModule",{value:!0});var dA=Zp(),pA=ef();function fA(e,t){var r=mA(e);return r.setAttemptNumber(t),r}_u.DelayFactory=fA;function mA(e){return e.delayFirstAttempt?new pA.AlwaysDelay(e):new dA.SkipFirstDelay(e)}});var rf=He(Ur=>{"use strict";m();d();f();p();var ku=Ur&&Ur.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})},Ou=Ur&&Ur.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Ur,"__esModule",{value:!0});var gA=Kp(),hA=tf();function yA(e,t){return t===void 0&&(t={}),ku(this,void 0,void 0,function(){var r,n;return Ou(this,function(o){switch(o.label){case 0:return r=gA.getSanitizedOptions(t),n=new vA(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Ur.backOff=yA;var vA=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return ku(this,void 0,void 0,function(){var t,r;return Ou(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return ku(this,void 0,void 0,function(){var t;return Ou(this,function(r){switch(r.label){case 0:return t=hA.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var fs=He((Kl,Yl)=>{"use strict";m();d();f();p();(function(e,t){typeof Kl=="object"&&typeof Yl<"u"?Yl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs=t()})(Kl,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",c="week",u="month",h="quarter",v="year",S="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var B=["th","st","nd","rd"],U=$%100;return"["+$+(B[(U-20)%10]||B[U]||B[0])+"]"}},C=function($,B,U){var Q=String($);return!Q||Q.length>=B?$:""+Array(B+1-Q.length).join(U)+$},I={s:C,z:function($){var B=-$.utcOffset(),U=Math.abs(B),Q=Math.floor(U/60),G=U%60;return(B<=0?"+":"-")+C(Q,2,"0")+":"+C(G,2,"0")},m:function $(B,U){if(B.date()<U.date())return-$(U,B);var Q=12*(U.year()-B.year())+(U.month()-B.month()),G=B.clone().add(Q,u),K=U-G<0,Y=B.clone().add(Q+(K?-1:1),u);return+(-(Q+(U-G)/(K?G-Y:Y-G))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:u,y:v,w:c,d:s,D:S,h:a,m:i,s:o,ms:n,Q:h}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},T="en",_={};_[T]=E;var q="$isDayjsObject",N=function($){return $ instanceof V||!(!$||!$[q])},k=function $(B,U,Q){var G;if(!B)return T;if(typeof B=="string"){var K=B.toLowerCase();_[K]&&(G=K),U&&(_[K]=U,G=K);var Y=B.split("-");if(!G&&Y.length>1)return $(Y[0])}else{var ne=B.name;_[ne]=B,G=ne}return!Q&&G&&(T=G),G||!Q&&T},O=function($,B){if(N($))return $.clone();var U=typeof B=="object"?B:{};return U.date=$,U.args=arguments,new V(U)},D=I;D.l=k,D.i=N,D.w=function($,B){return O($,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var V=function(){function $(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[q]=!0}var B=$.prototype;return B.parse=function(U){this.$d=function(Q){var G=Q.date,K=Q.utc;if(G===null)return new Date(NaN);if(D.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var Y=G.match(y);if(Y){var ne=Y[2]-1||0,pe=(Y[7]||"0").substring(0,3);return K?new Date(Date.UTC(Y[1],ne,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,pe)):new Date(Y[1],ne,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,pe)}}return new Date(G)}(U),this.init()},B.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==g},B.isSame=function(U,Q){var G=O(U);return this.startOf(Q)<=G&&G<=this.endOf(Q)},B.isAfter=function(U,Q){return O(U)<this.startOf(Q)},B.isBefore=function(U,Q){return this.endOf(Q)<O(U)},B.$g=function(U,Q,G){return D.u(U)?this[Q]:this.set(G,U)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(U,Q){var G=this,K=!!D.u(Q)||Q,Y=D.p(U),ne=function(Ce,De){var Be=D.w(G.$u?Date.UTC(G.$y,De,Ce):new Date(G.$y,De,Ce),G);return K?Be:Be.endOf(s)},pe=function(Ce,De){return D.w(G.toDate()[Ce].apply(G.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(De)),G)},be=this.$W,de=this.$M,fe=this.$D,le="set"+(this.$u?"UTC":"");switch(Y){case v:return K?ne(1,0):ne(31,11);case u:return K?ne(1,de):ne(0,de+1);case c:var he=this.$locale().weekStart||0,Le=(be<he?be+7:be)-he;return ne(K?fe-Le:fe+(6-Le),de);case s:case S:return pe(le+"Hours",0);case a:return pe(le+"Minutes",1);case i:return pe(le+"Seconds",2);case o:return pe(le+"Milliseconds",3);default:return this.clone()}},B.endOf=function(U){return this.startOf(U,!1)},B.$set=function(U,Q){var G,K=D.p(U),Y="set"+(this.$u?"UTC":""),ne=(G={},G[s]=Y+"Date",G[S]=Y+"Date",G[u]=Y+"Month",G[v]=Y+"FullYear",G[a]=Y+"Hours",G[i]=Y+"Minutes",G[o]=Y+"Seconds",G[n]=Y+"Milliseconds",G)[K],pe=K===s?this.$D+(Q-this.$W):Q;if(K===u||K===v){var be=this.clone().set(S,1);be.$d[ne](pe),be.init(),this.$d=be.set(S,Math.min(this.$D,be.daysInMonth())).$d}else ne&&this.$d[ne](pe);return this.init(),this},B.set=function(U,Q){return this.clone().$set(U,Q)},B.get=function(U){return this[D.p(U)]()},B.add=function(U,Q){var G,K=this;U=Number(U);var Y=D.p(Q),ne=function(de){var fe=O(K);return D.w(fe.date(fe.date()+Math.round(de*U)),K)};if(Y===u)return this.set(u,this.$M+U);if(Y===v)return this.set(v,this.$y+U);if(Y===s)return ne(1);if(Y===c)return ne(7);var pe=(G={},G[i]=t,G[a]=r,G[o]=e,G)[Y]||1,be=this.$d.getTime()+U*pe;return D.w(be,this)},B.subtract=function(U,Q){return this.add(-1*U,Q)},B.format=function(U){var Q=this,G=this.$locale();if(!this.isValid())return G.invalidDate||g;var K=U||"YYYY-MM-DDTHH:mm:ssZ",Y=D.z(this),ne=this.$H,pe=this.$m,be=this.$M,de=G.weekdays,fe=G.months,le=G.meridiem,he=function(De,Be,ut,bt){return De&&(De[Be]||De(Q,K))||ut[Be].slice(0,bt)},Le=function(De){return D.s(ne%12||12,De,"0")},Ce=le||function(De,Be,ut){var bt=De<12?"AM":"PM";return ut?bt.toLowerCase():bt};return K.replace(x,function(De,Be){return Be||function(ut){switch(ut){case"YY":return String(Q.$y).slice(-2);case"YYYY":return D.s(Q.$y,4,"0");case"M":return be+1;case"MM":return D.s(be+1,2,"0");case"MMM":return he(G.monthsShort,be,fe,3);case"MMMM":return he(fe,be);case"D":return Q.$D;case"DD":return D.s(Q.$D,2,"0");case"d":return String(Q.$W);case"dd":return he(G.weekdaysMin,Q.$W,de,2);case"ddd":return he(G.weekdaysShort,Q.$W,de,3);case"dddd":return de[Q.$W];case"H":return String(ne);case"HH":return D.s(ne,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return Ce(ne,pe,!0);case"A":return Ce(ne,pe,!1);case"m":return String(pe);case"mm":return D.s(pe,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 Y}return null}(De)||Y.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(U,Q,G){var K,Y=this,ne=D.p(Q),pe=O(U),be=(pe.utcOffset()-this.utcOffset())*t,de=this-pe,fe=function(){return D.m(Y,pe)};switch(ne){case v:K=fe()/12;break;case u:K=fe();break;case h:K=fe()/3;break;case c:K=(de-be)/6048e5;break;case s:K=(de-be)/864e5;break;case a:K=de/r;break;case i:K=de/t;break;case o:K=de/e;break;default:K=de}return G?K:D.a(K)},B.daysInMonth=function(){return this.endOf(u).$D},B.$locale=function(){return _[this.$L]},B.locale=function(U,Q){if(!U)return this.$L;var G=this.clone(),K=k(U,Q,!0);return K&&(G.$L=K),G},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},$}(),z=V.prototype;return O.prototype=z,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",u],["$y",v],["$D",S]].forEach(function($){z[$[1]]=function(B){return this.$g(B,$[0],$[1])}}),O.extend=function($,B){return $.$i||($(B,V,O),$.$i=!0),O},O.locale=k,O.isDayjs=N,O.unix=function($){return O(1e3*$)},O.en=_[T],O.Ls=_,O.p={},O})});var Qg=He((Xl,Jl)=>{"use strict";m();d();f();p();(function(e,t){typeof Xl=="object"&&typeof Jl<"u"?Jl.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_quarterOfYear=t()})(Xl,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,c){return s=Number(s),this.$utils().p(c)===t?this.add(3*s,e):i.bind(this)(s,c)};var a=o.startOf;o.startOf=function(s,c){var u=this.$utils(),h=!!u.u(c)||c;if(u.p(s)===t){var v=this.quarter()-1;return h?this.month(3*v).startOf(e).startOf("day"):this.month(3*v+2).endOf(e).endOf("day")}return a.bind(this)(s,c)}}})});var Hg=He((Zl,ed)=>{"use strict";m();d();f();p();(function(e,t){typeof Zl=="object"&&typeof ed<"u"?ed.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_customParseFormat=t()})(Zl,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(x){this[y]=+x}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var E=x.match(/([+-]|\d\d)/g),C=60*E[1]+(+E[2]||0);return C===0?0:E[0]==="+"?-C:C}(y)}],h=function(y){var x=a[y];return x&&(x.indexOf?x:x.s.concat(x.f))},v=function(y,x){var E,C=a.meridiem;if(C){for(var I=1;I<=24;I+=1)if(y.indexOf(C(I,0,x))>-1){E=I>12;break}}else E=y===(x?"pm":"PM");return E},S={A:[i,function(y){this.afternoon=v(y,!1)}],a:[i,function(y){this.afternoon=v(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[n,c("day")],Do:[i,function(y){var x=a.ordinal,E=y.match(/\d+/);if(this.day=E[0],x)for(var C=1;C<=31;C+=1)x(C).replace(/\[|\]/g,"")===y&&(this.day=C)}],w:[o,c("week")],ww:[n,c("week")],M:[o,c("month")],MM:[n,c("month")],MMM:[i,function(y){var x=h("months"),E=(h("monthsShort")||x.map(function(C){return C.slice(0,3)})).indexOf(y)+1;if(E<1)throw new Error;this.month=E%12||E}],MMMM:[i,function(y){var x=h("months").indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,c("year")],YY:[n,function(y){this.year=s(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(y){var x,E;x=y,E=a&&a.formats;for(var C=(y=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,D,V){var z=V&&V.toUpperCase();return D||E[V]||e[V]||E[z].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function($,B,U){return B||U.slice(1)})})).match(t),I=C.length,T=0;T<I;T+=1){var _=C[T],q=S[_],N=q&&q[0],k=q&&q[1];C[T]=k?{regex:N,parser:k}:_.replace(/^\[|\]$/g,"")}return function(O){for(var D={},V=0,z=0;V<I;V+=1){var $=C[V];if(typeof $=="string")z+=$.length;else{var B=$.regex,U=$.parser,Q=O.slice(z),G=B.exec(Q)[0];U.call(D,G),O=O.replace(G,"")}}return function(K){var Y=K.afternoon;if(Y!==void 0){var ne=K.hours;Y?ne<12&&(K.hours+=12):ne===12&&(K.hours=0),delete K.afternoon}}(D),D}}return function(y,x,E){E.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(s=y.parseTwoDigitYear);var C=x.prototype,I=C.parse;C.parse=function(T){var _=T.date,q=T.utc,N=T.args;this.$u=q;var k=N[1];if(typeof k=="string"){var O=N[2]===!0,D=N[3]===!0,V=O||D,z=N[2];D&&(z=N[2]),a=this.$locale(),!O&&z&&(a=E.Ls[z]),this.$d=function(Q,G,K,Y){try{if(["x","X"].indexOf(G)>-1)return new Date((G==="X"?1e3:1)*Q);var ne=g(G)(Q),pe=ne.year,be=ne.month,de=ne.day,fe=ne.hours,le=ne.minutes,he=ne.seconds,Le=ne.milliseconds,Ce=ne.zone,De=ne.week,Be=new Date,ut=de||(pe||be?1:Be.getDate()),bt=pe||Be.getFullYear(),lr=0;pe&&!be||(lr=be>0?be-1:Be.getMonth());var _n,kn=fe||0,$o=le||0,du=he||0,pu=Le||0;return Ce?new Date(Date.UTC(bt,lr,ut,kn,$o,du,pu+60*Ce.offset*1e3)):K?new Date(Date.UTC(bt,lr,ut,kn,$o,du,pu)):(_n=new Date(bt,lr,ut,kn,$o,du,pu),De&&(_n=Y(_n).week(De).toDate()),_n)}catch{return new Date("")}}(_,k,q,E),this.init(),z&&z!==!0&&(this.$L=this.locale(z).$L),V&&_!=this.format(k)&&(this.$d=new Date("")),a={}}else if(k instanceof Array)for(var $=k.length,B=1;B<=$;B+=1){N[1]=k[B-1];var U=E.apply(this,N);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}B===$&&(this.$d=new Date(""))}else I.call(this,T)}}})});var Lh=He((hd,yd)=>{"use strict";m();d();f();p();(function(e,t){typeof hd=="object"&&typeof yd<"u"?yd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_timezone=t()})(hd,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,a=function(h,v,S){S===void 0&&(S={});var g=new Date(h),y=function(x,E){E===void 0&&(E={});var C=E.timeZoneName||"short",I=x+"|"+C,T=t[I];return T||(T=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),t[I]=T),T}(v,S);return y.formatToParts(g)},s=function(h,v){for(var S=a(h,v),g=[],y=0;y<S.length;y+=1){var x=S[y],E=x.type,C=x.value,I=e[E];I>=0&&(g[I]=parseInt(C,10))}var T=g[3],_=T===24?0:T,q=g[0]+"-"+g[1]+"-"+g[2]+" "+_+":"+g[4]+":"+g[5]+":000",N=+h;return(o.utc(q).valueOf()-(N-=N%1e3))/6e4},c=n.prototype;c.tz=function(h,v){h===void 0&&(h=i);var S,g=this.utcOffset(),y=this.toDate(),x=y.toLocaleString("en-US",{timeZone:h}),E=Math.round((y-new Date(x))/1e3/60),C=15*-Math.round(y.getTimezoneOffset()/15)-E;if(!Number(C))S=this.utcOffset(0,v);else if(S=o(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),v){var I=S.utcOffset();S=S.add(g-I,"minute")}return S.$x.$timezone=h,S},c.offsetName=function(h){var v=this.$x.$timezone||o.tz.guess(),S=a(this.valueOf(),v,{timeZoneName:h}).find(function(g){return g.type.toLowerCase()==="timezonename"});return S&&S.value};var u=c.startOf;c.startOf=function(h,v){if(!this.$x||!this.$x.$timezone)return u.call(this,h,v);var S=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(S,h,v).tz(this.$x.$timezone,!0)},o.tz=function(h,v,S){var g=S&&v,y=S||v||i,x=s(+o(),y);if(typeof h!="string")return o(h).tz(y);var E=function(_,q,N){var k=_-60*q*1e3,O=s(k,N);if(q===O)return[k,q];var D=s(k-=60*(O-q)*1e3,N);return O===D?[k,O]:[_-60*Math.min(O,D)*1e3,Math.max(O,D)]}(o.utc(h,g).valueOf(),x,y),C=E[0],I=E[1],T=o(C).utcOffset(I);return T.$x.$timezone=y,T},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(h){i=h}}})});var Vh=He((vd,Sd)=>{"use strict";m();d();f();p();(function(e,t){typeof vd=="object"&&typeof Sd<"u"?Sd.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof b<"u"?b:e||self).dayjs_plugin_utc=t()})(vd,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var a=o.prototype;i.utc=function(g){var y={date:g,utc:!0,args:arguments};return new o(y)},a.utc=function(g){var y=i(this.toDate(),{locale:this.$L,utc:!0});return g?y.add(this.utcOffset(),e):y},a.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),s.call(this,g)};var c=a.init;a.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else c.call(this)};var u=a.utcOffset;a.utcOffset=function(g,y){var x=this.$utils().u;if(x(g))return this.$u?0:x(this.$offset)?u.call(this):this.$offset;if(typeof g=="string"&&(g=function(T){T===void 0&&(T="");var _=T.match(t);if(!_)return null;var q=(""+_[0]).match(r)||["-",0,0],N=q[0],k=60*+q[1]+ +q[2];return k===0?0:N==="+"?k:-k}(g),g===null))return this;var E=Math.abs(g)<=16?60*g:g;if(E===0)return this.utc(y);var C=this.clone();if(y)return C.$offset=E,C.$u=!1,C;var I=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(C=this.local().add(E+I,e)).$offset=E,C.$x.$localOffset=I,C};var h=a.format;a.format=function(g){var y=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,y)},a.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var v=a.toDate;a.toDate=function(g){return g==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var S=a.diff;a.diff=function(g,y,x){if(g&&this.$u===g.$u)return S.call(this,g,y,x);var E=this.local(),C=i(g).local();return S.call(E,C,y,x)}}})});var aS=He((Tae,iS)=>{"use strict";m();d();f();p();function A0(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}iS.exports=w0;function w0(e,t,r){var n=r&&r.stringify||A0,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var a=new Array(i);a[0]=n(e);for(var s=1;s<i;s++)a[s]=n(t[s]);return a.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var u="",h=1-o,v=-1,S=e&&e.length||0,g=0;g<S;){if(e.charCodeAt(g)===37&&g+1<S){switch(v=v>-1?v:0,e.charCodeAt(g+1)){case 100:case 102:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Number(t[h]),v=g+2,g++;break;case 105:if(h>=c||t[h]==null)break;v<g&&(u+=e.slice(v,g)),u+=Math.floor(Number(t[h])),v=g+2,g++;break;case 79:case 111:case 106:if(h>=c||t[h]===void 0)break;v<g&&(u+=e.slice(v,g));var y=typeof t[h];if(y==="string"){u+="'"+t[h]+"'",v=g+2,g++;break}if(y==="function"){u+=t[h].name||"<anonymous>",v=g+2,g++;break}u+=n(t[h]),v=g+2,g++;break;case 115:if(h>=c)break;v<g&&(u+=e.slice(v,g)),u+=String(t[h]),v=g+2,g++;break;case 37:v<g&&(u+=e.slice(v,g)),u+="%",v=g+2,g++,h--;break}++h}++g}return v===-1?e:(v<S&&(u+=e.slice(v)),u)}});var pS=He((Nae,Jc)=>{"use strict";m();d();f();p();var sS=aS();Jc.exports=ur;var Yi=j0().console||{},x0={mapHttpRequest:Xc,mapHttpResponse:Xc,wrapRequestSerializer:mp,wrapResponseSerializer:mp,wrapErrorSerializer:mp,req:Xc,res:Xc,err:uS,errWithCause:uS};function qr(e,t){return e==="silent"?1/0:t.levels.values[e]}var yp=Symbol("pino.logFuncs"),gp=Symbol("pino.hierarchy"),C0={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function cS(e,t){let r={logger:t,parent:e[gp]};t[gp]=r}function E0(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Yi[o]||Yi[C0[o]||"log"]||qo}),e[yp]=n}function R0(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function ur(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Yi;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=R0(e.browser.serialize,n),i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);let a=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(a);typeof r=="function"&&s.forEach(function(x){r[x]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let c=e.level||"info",u=Object.create(r);u.log||(u.log=qo),E0(u,s,r),cS({},u),Object.defineProperty(u,"levelVal",{get:v}),Object.defineProperty(u,"level",{get:S,set:g});let h={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:s,timestamp:F0(e),messageKey:e.messageKey||"msg",onChild:e.onChild||qo};u.levels=I0(e),u.level=c,u.isLevelEnabled=function(x){return this.levels.values[x]?this.levels.values[x]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=qo,u.serializers=n,u._serialize=o,u._stdErrSerialize=i,u.child=function(...x){return y.call(this,h,...x)},t&&(u._logEvent=hp());function v(){return qr(this.level,this)}function S(){return this._level}function g(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,En(this,h,u,"error"),En(this,h,u,"fatal"),En(this,h,u,"warn"),En(this,h,u,"info"),En(this,h,u,"debug"),En(this,h,u,"trace"),a.forEach(E=>{En(this,h,u,E)})}function y(x,E,C){if(!E)throw new Error("missing bindings for child Pino");C=C||{},o&&E.serializers&&(C.serializers=E.serializers);let I=C.serializers;if(o&&I){var T=Object.assign({},n,I),_=e.browser.serialize===!0?Object.keys(T):o;delete E.serializers,vp([E],_,T,this._stdErrSerialize)}function q(k){this._childLevel=(k._childLevel|0)+1,this.bindings=E,T&&(this.serializers=T,this._serialize=_),t&&(this._logEvent=hp([].concat(k._logEvent.bindings,E)))}q.prototype=this;let N=new q(this);return cS(this,N),N.child=function(...k){return y.call(this,x,...k)},N.level=C.level||this.level,x.onChild(N),N}return u}function I0(e){let t=e.customLevels||{},r=Object.assign({},ur.levels.values,t),n=Object.assign({},ur.levels.labels,T0(t));return{values:r,labels:n}}function T0(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}ur.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"}};ur.stdSerializers=x0;ur.stdTimeFunctions=Object.assign({},{nullTime:lS,epochTime:dS,unixTime:D0,isoTime:M0});function _0(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[gp];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function En(e,t,r,n){if(Object.defineProperty(e,n,{value:qr(e.level,r)>qr(n,r)?qo:r[yp][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===qo){if(!t.transmit)return;let i=t.transmit.level||e.level,a=qr(i,r);if(qr(n,r)<a)return}e[n]=O0(e,t,r,n);let o=_0(e);o.length!==0&&(e[n]=k0(o,e[n]))}function k0(e,t){return function(){return t.apply(this,[...e,...arguments])}}function O0(e,t,r,n){return function(o){return function(){let a=t.timestamp(),s=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Yi?Yi:this;for(var u=0;u<s.length;u++)s[u]=arguments[u];var h=!1;if(t.serialize&&(vp(s,this._serialize,this.serializers,this._stdErrSerialize),h=!0),t.asObject||t.formatters?o.call(c,...P0(this,n,s,a,t)):o.apply(c,s),t.transmit){let v=t.transmit.level||e._level,S=qr(v,r),g=qr(n,r);if(g<S)return;N0(this,{ts:a,methodLevel:n,methodValue:g,transmitLevel:v,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:qr(e._level,r)},s,h)}}}(e[yp][n])}function P0(e,t,r,n,o){let{level:i,log:a=v=>v}=o.formatters||{},s=r.slice(),c=s[0],u={},h=(e._childLevel|0)+1;if(h<1&&(h=1),n&&(u.time=n),i){let v=i(t,e.levels.values[t]);Object.assign(u,v)}else u.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());return[a(u),...s]}else{if(c!==null&&typeof c=="object"){for(;h--&&typeof s[0]=="object";)Object.assign(u,s.shift());c=s.length?sS(s.shift(),s):void 0}else typeof c=="string"&&(c=sS(s.shift(),s));return c!==void 0&&(u[o.messageKey]=c),[a(u)]}}function vp(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=ur.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let i in e[o])t.indexOf(i)>-1&&i in r&&(e[o][i]=r[i](e[o][i]))}function N0(e,t,r,n=!1){let o=t.send,i=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;n||vp(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(h){return u.indexOf(h)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=s,o(a,e._logEvent,c),e._logEvent=hp(u)}function hp(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function uS(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function F0(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?lS:dS}function Xc(){return{}}function mp(e){return e}function qo(){}function lS(){return!1}function dS(){return Date.now()}function D0(){return Math.round(Date.now()/1e3)}function M0(){return new Date(Date.now()).toISOString()}function j0(){function e(t){return typeof t<"u"&&t}try{return typeof b<"u"?b:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),b)}catch{return e(self)||e(window)||e(this)||{}}}Jc.exports.default=ur;Jc.exports.pino=ur});var jk={};zo(jk,{DefaultFieldsToInclude:()=>Cp,EcommerceDefaultFieldsToInclude:()=>eb,HighlightUtils:()=>xu,MinimumFieldsToInclude:()=>uu,ResultTemplatesHelpers:()=>dh,buildContext:()=>wS,buildController:()=>Lr,buildDictionaryFieldContext:()=>xS,buildInteractiveResult:()=>YS,buildRecommendationEngine:()=>SS,buildRecommendationList:()=>WS,buildResultTemplatesManager:()=>nb,getAnalyticsNextApiBaseUrl:()=>sa,getOrganizationEndpoint:()=>We,getSampleRecommendationEngineConfiguration:()=>Sp,loadAdvancedSearchQueryActions:()=>wk,loadClickAnalyticsActions:()=>Nk,loadConfigurationActions:()=>xk,loadContextActions:()=>Ek,loadDebugActions:()=>Rk,loadDictionaryFieldContextActions:()=>Ik,loadFieldActions:()=>kk,loadPaginationActions:()=>xp,loadPipelineActions:()=>Ok,loadRecommendationActions:()=>Pk,loadSearchConfigurationActions:()=>Ck,loadSearchHubActions:()=>Mk});module.exports=lb(jk);m();d();f();p();var xu={};zo(xu,{escapeHtml:()=>Nn,getHighlightedSuggestion:()=>zb,highlightString:()=>Hb});m();d();f();p();m();d();f();p();function Vb(e,t){let r=`
20
20
  The following properties are invalid:
21
21
 
22
22
  ${e.join(`
23
23
  `)}
24
24
 
25
25
  ${t}
26
- `;return new Jo(r)}var Jo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},lt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw Db(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Oe=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&ie(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 ze(e){return e===void 0}function Mb(e){return e===null}function ie(e){return ze(e)||Mb(e)}var ue=class{constructor(e={}){we(this,"value");this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t||(qb(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function qb(e){return ze(e)||Bf(e)}function Bf(e){return typeof e=="boolean"}var te=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t||(jb(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 jb(e){return ze(e)||$f(e)}function $f(e){return typeof e=="number"&&!Number.isNaN(e)}var Lb=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,H=class{constructor(e={}){we(this,"value");we(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Oe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(ze(e))return null;if(!oa(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Lb.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 oa(e){return Object.prototype.toString.call(e)==="[object String]"}var ee=class{constructor(e={}){we(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(ze(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Gf(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ie(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Gf(e){return e!==void 0&&typeof e=="object"}var ge=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Oe(this.config)}validate(e){if(!ie(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ie(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ie(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Bf(e)||oa(e)||$f(e)||Gf(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 bu=class{constructor(e){we(this,"value");this.config=e,this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:ze(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();p();f();function Hf(e){return Array.isArray(e)}function ia(e){return e.trim()===""}var Vb=new Set(["1",1,"yes",!0]);function zf(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Vb.has(r))}function Wf(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Zo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function aa(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function Ub(e){if(ia(e.openingDelimiter)||ia(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ie(e.content)||ia(e.content))return e.content;if(e.highlights.length===0)return Nn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Nn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Nn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Nn(e.content.slice(n))),r}function Bb(e,t){return e=Nn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?Au(n,t.notMatchDelimiters):o?Au(o,t.exactMatchDelimiters):i?Au(i,t.correctionDelimiters):r)}function Au(e,t){return t?t.open+e+t.close:e}function Nn(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();p();f();var ap=_t(rp(),1);m();d();p();f();var Dt=new Error("Failed to load reducers."),Fn=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."}},Br=class extends Error{constructor(r,n){super();we(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();p();f();function np(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function op(e){return typeof e!="object"||!e?!1:Object.values(e).every(mA)}function mA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ip(e){return e===429}var kt=class e{static call(t){return _asyncToGenerator(function*(){let r=gA(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield A(i,a);if(ip(c.status))throw c;return c});return function s(){return _ref.apply(this,arguments)}}();try{let c=yield(0,ap.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&ip(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Fn;case 404:throw new Br(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Br(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...c}=t,u=Zo(c);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function We(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function dr(e,t="prod"){return`${We(e,t)}/rest/search/v2`}function ca(e,t="prod"){return`${We(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function gA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",c=hA(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:c}),signal:a}}function hA(e,t){return t==="application/x-www-form-urlencoded"?op(e)?np(e):"":JSON.stringify(e)}m();d();p();f();m();d();p();f();var ua=e=>e;m();d();p();f();m();d();p();f();function la(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Mt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:la(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:la(),extendedResults:{},searchAction:void 0}}m();d();p();f();function fr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var pr=e=>{let{response:t}=e;return t.body?yA(e):vA(t)},yA=e=>bA(e)?AA(e):SA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},vA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function SA(e){return e.body.statusCode!==void 0}function bA(e){return e.body.exception!==void 0}var AA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();p();f();var mr=class{constructor(){we(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();p();f();m();d();p();f();var ri=class{constructor(t){we(this,"_basePath");we(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();p();f();function sp(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();p();f();var Yt=(e,t,r,n)=>{let o=new ri(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var cp=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield kt.call({...Yt(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:fr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=sp(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return wA(a)?{success:a}:{error:pr({response:r,body:a})}});return function cp(_x3,_x4){return _ref3.apply(this,arguments)}}();function wA(e){return typeof e=="string"}m();d();p();f();function xA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function CA(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function da(e,t){if(t&&e.name==="AbortError")return{error:CA(e)};if(e instanceof Br)return{error:xA(e)};throw e}var fa=class{constructor(t){this.options=t;we(this,"apiCallsQueues",{unknown:new mr,mainSearch:new mr,facetValues:new mr,foldingCollection:new mr,instantResults:new mr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/plan"),requestParams:fr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return da(r);let n=yield r.json();return RA(n)?{success:n}:{error:pr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:fr(t),..._this3.options});if(r instanceof Error)return da(r);let n=yield r.json(),o={response:r,body:n};return EA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:pr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>kt.call({...Yt(t,"POST","application/json",""),requestParams:fr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return da(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return up(i)?(a.body=lp(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:pr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/facet"),requestParams:fr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json",""),requestParams:fr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(up(n)){let o={response:r,body:n};return o.body=lp(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:pr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return cp(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return IA(n)?{success:n}:{error:pr({response:r,body:n})}})()}},pa=e=>e.success!==void 0,dt=e=>e.error!==void 0;function up(e){return e.results!==void 0}function lp(e){let t=la();return ie(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function EA(e){return e.completions!==void 0}function RA(e){return e.preprocessingOutput!==void 0}function IA(e){return e.fields!==void 0}m();d();p();f();var dp=e=>e,fp=e=>e,pp=e=>e;m();d();p();f();m();d();p();f();m();d();p();f();function Ke(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 TA=typeof Symbol=="function"&&Symbol.observable||"@@observable",mp=TA,Ou=()=>Math.random().toString(36).substring(7).split("").join("."),_A={INIT:`@@redux/INIT${Ou()}`,REPLACE:`@@redux/REPLACE${Ou()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ou()}`},ma=_A;function qt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Pu(e,t,r){if(typeof e!="function")throw new Error(Ke(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ke(1));return r(Pu)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((E,C)=>{a.set(C,E)}))}function h(){if(c)throw new Error(Ke(3));return o}function v(E){if(typeof E!="function")throw new Error(Ke(4));if(c)throw new Error(Ke(5));let C=!0;u();let I=s++;return a.set(I,E),function(){if(C){if(c)throw new Error(Ke(6));C=!1,u(),a.delete(I),i=null}}}function S(E){if(!qt(E))throw new Error(Ke(7));if(typeof E.type>"u")throw new Error(Ke(8));if(typeof E.type!="string")throw new Error(Ke(17));if(c)throw new Error(Ke(9));try{c=!0,o=n(o,E)}finally{c=!1}return(i=a).forEach(I=>{I()}),E}function g(E){if(typeof E!="function")throw new Error(Ke(10));n=E,S({type:ma.REPLACE})}function y(){let E=v;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(Ke(11));function I(){let _=C;_.next&&_.next(h())}return I(),{unsubscribe:E(I)}},[mp](){return this}}}return S({type:ma.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[mp]:y}}function kA(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:ma.INIT})>"u")throw new Error(Ke(12));if(typeof r(void 0,{type:ma.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function Dn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{kA(r)}catch(a){i=a}return function(s={},c){if(i)throw i;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=s[S],x=g(y,c);if(typeof x>"u"){let E=c&&c.type;throw new Error(Ke(14))}h[S]=x,u=u||x!==y}return u=u||n.length!==Object.keys(s).length,u?h:s}}function Mn(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function gp(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ke(15))},a={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},s=e.map(c=>c(a));return i=Mn(...s)(o.dispatch),{...o,dispatch:i}}}function qn(e){return qt(e)&&"type"in e&&typeof e.type=="string"}m();d();p();f();var Bu=Symbol.for("immer-nothing"),ni=Symbol.for("immer-draftable"),ft=Symbol.for("immer-state");function Ye(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jn=Object.getPrototypeOf;function vt(e){return!!e&&!!e[ft]}function pt(e){return e?Ap(e)||Array.isArray(e)||!!e[ni]||!!e.constructor?.[ni]||Ln(e)||ui(e):!1}var OA=Object.prototype.constructor.toString(),hp=new WeakMap;function Ap(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=hp.get(r);return n===void 0&&(n=Function.toString.call(r),hp.set(r,n)),n===OA}function $u(e){return vt(e)||Ye(15,e),e[ft].base_}function oi(e,t,r=!0){Gr(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Gr(e){let t=e[ft];return t?t.type_:Array.isArray(e)?1:Ln(e)?2:ui(e)?3:0}function ii(e,t){return Gr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Nu(e,t){return Gr(e)===2?e.get(t):e[t]}function wp(e,t,r){let n=Gr(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function PA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ln(e){return e instanceof Map}function ui(e){return e instanceof Set}function $r(e){return e.copy_||e.base_}function Mu(e,t){if(Ln(e))return new Map(e);if(ui(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Ap(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[ft];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[a]})}return Object.create(jn(e),n)}else{let n=jn(e);if(n!==null&&r)return{...e};let o=Object.create(n);return Object.assign(o,e)}}function va(e,t=!1){return Sa(e)||vt(e)||!pt(e)||(Gr(e)>1&&Object.defineProperties(e,{set:ga,add:ga,clear:ga,delete:ga}),Object.freeze(e),t&&Object.values(e).forEach(r=>va(r,!0))),e}function NA(){Ye(2)}var ga={value:NA};function Sa(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var qu={};function Qr(e){let t=qu[e];return t||Ye(0,e),t}function FA(e,t){qu[e]||(qu[e]=t)}var ai;function xp(){return ai}function DA(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yp(e,t){t&&(Qr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ju(e){Lu(e),e.drafts_.forEach(MA),e.drafts_=null}function Lu(e){e===ai&&(ai=e.parent_)}function vp(e){return ai=DA(ai,e)}function MA(e){let t=e[ft];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sp(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[ft].modified_&&(ju(t),Ye(4)),pt(e)&&(e=ha(t,e),t.parent_||ya(t,e)),t.patches_&&Qr("Patches").generateReplacementPatches_(r[ft].base_,e,t.patches_,t.inversePatches_)):e=ha(t,r,[]),ju(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Bu?e:void 0}function ha(e,t,r){if(Sa(t))return t;let n=e.immer_.shouldUseStrictIteration(),o=t[ft];if(!o)return oi(t,(i,a)=>bp(e,o,t,i,a,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return ya(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;let i=o.copy_,a=i,s=!1;o.type_===3&&(a=new Set(i),i.clear(),s=!0),oi(a,(c,u)=>bp(e,o,i,c,u,r,s),n),ya(e,i,!1),r&&e.patches_&&Qr("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function bp(e,t,r,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;let s=Sa(o);if(!(s&&!a)){if(vt(o)){let c=i&&t&&t.type_!==3&&!ii(t.assigned_,n)?i.concat(n):void 0,u=ha(e,o,c);if(wp(r,n,u),vt(u))e.canAutoFreeze_=!1;else return}else a&&r.add(o);if(pt(o)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&s)return;ha(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Ln(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&ya(e,o)}}}function ya(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&va(t,r)}function qA(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:xp(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=Gu;r&&(o=[n],i=si);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}var Gu={get(e,t){if(t===ft)return e;let r=$r(e);if(!ii(r,t))return jA(e,r,t);let n=r[t];return e.finalized_||!pt(n)?n:n===Fu(e.base_,t)?(Du(e),e.copy_[t]=Uu(n,e)):n},has(e,t){return t in $r(e)},ownKeys(e){return Reflect.ownKeys($r(e))},set(e,t,r){let n=Cp($r(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Fu($r(e),t),i=o?.[ft];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(PA(r,o)&&(r!==void 0||ii(e.base_,t)))return!0;Du(e),Vu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fu(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Du(e),Vu(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=$r(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ye(11)},getPrototypeOf(e){return jn(e.base_)},setPrototypeOf(){Ye(12)}},si={};oi(Gu,(e,t)=>{si[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});si.deleteProperty=function(e,t){return si.set.call(this,e,t,void 0)};si.set=function(e,t,r){return Gu.set.call(this,e[0],t,r,e[0])};function Fu(e,t){let r=e[ft];return(r?$r(r):e)[t]}function jA(e,t,r){let n=Cp(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Cp(e,t){if(!(t in e))return;let r=jn(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=jn(r)}}function Vu(e){e.modified_||(e.modified_=!0,e.parent_&&Vu(e.parent_))}function Du(e){e.copy_||(e.copy_=Mu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var LA=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let a=this;return function(c=i,...u){return a.produce(c,h=>r.call(this,h,...u))}}typeof r!="function"&&Ye(6),n!==void 0&&typeof n!="function"&&Ye(7);let o;if(pt(t)){let i=vp(this),a=Uu(t,void 0),s=!0;try{o=r(a),s=!1}finally{s?ju(i):Lu(i)}return yp(i,n),Sp(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Bu&&(o=void 0),this.autoFreeze_&&va(o,!0),n){let i=[],a=[];Qr("Patches").generateReplacementPatches_(t,o,i,a),n(i,a)}return o}else Ye(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){pt(e)||Ye(8),vt(e)&&(e=Ep(e));let t=vp(this),r=Uu(e,void 0);return r[ft].isManual_=!0,Lu(t),r}finishDraft(e,t){let r=e&&e[ft];(!r||!r.isManual_)&&Ye(9);let{scope_:n}=r;return yp(n,t),Sp(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Qr("Patches").applyPatches_;return vt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Uu(e,t){let r=Ln(e)?Qr("MapSet").proxyMap_(e,t):ui(e)?Qr("MapSet").proxySet_(e,t):qA(e,t);return(t?t.scope_:xp()).drafts_.push(r),r}function Ep(e){return vt(e)||Ye(10,e),Rp(e)}function Rp(e){if(!pt(e)||Sa(e))return e;let t=e[ft],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Mu(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Mu(e,!0);return oi(r,(o,i)=>{wp(r,o,Rp(i))},n),t&&(t.finalized_=!1),r}function Ip(){let t="replace",r="add",n="remove";function o(S,g,y,x){switch(S.type_){case 0:case 2:return a(S,g,y,x);case 1:return i(S,g,y,x);case 3:return s(S,g,y,x)}}function i(S,g,y,x){let{base_:E,assigned_:C}=S,I=S.copy_;I.length<E.length&&([E,I]=[I,E],[y,x]=[x,y]);for(let T=0;T<E.length;T++)if(C[T]&&I[T]!==E[T]){let _=g.concat([T]);y.push({op:t,path:_,value:v(I[T])}),x.push({op:t,path:_,value:v(E[T])})}for(let T=E.length;T<I.length;T++){let _=g.concat([T]);y.push({op:r,path:_,value:v(I[T])})}for(let T=I.length-1;E.length<=T;--T){let _=g.concat([T]);x.push({op:n,path:_})}}function a(S,g,y,x){let{base_:E,copy_:C}=S;oi(S.assigned_,(I,T)=>{let _=Nu(E,I),j=Nu(C,I),N=T?ii(E,I)?t:r:n;if(_===j&&N===t)return;let k=g.concat(I);y.push(N===n?{op:N,path:k}:{op:N,path:k,value:j}),x.push(N===r?{op:n,path:k}:N===n?{op:r,path:k,value:v(_)}:{op:t,path:k,value:v(_)})})}function s(S,g,y,x){let{base_:E,copy_:C}=S,I=0;E.forEach(T=>{if(!C.has(T)){let _=g.concat([I]);y.push({op:n,path:_,value:T}),x.unshift({op:r,path:_,value:T})}I++}),I=0,C.forEach(T=>{if(!E.has(T)){let _=g.concat([I]);y.push({op:r,path:_,value:T}),x.unshift({op:n,path:_,value:T})}I++})}function c(S,g,y,x){y.push({op:t,path:[],value:g===Bu?void 0:g}),x.push({op:t,path:[],value:S})}function u(S,g){return g.forEach(y=>{let{path:x,op:E}=y,C=S;for(let j=0;j<x.length-1;j++){let N=Gr(C),k=x[j];typeof k!="string"&&typeof k!="number"&&(k=""+k),(N===0||N===1)&&(k==="__proto__"||k==="constructor")&&Ye(19),typeof C=="function"&&k==="prototype"&&Ye(19),C=Nu(C,k),typeof C!="object"&&Ye(18,x.join("/"))}let I=Gr(C),T=h(y.value),_=x[x.length-1];switch(E){case t:switch(I){case 2:return C.set(_,T);case 3:Ye(16);default:return C[_]=T}case r:switch(I){case 1:return _==="-"?C.push(T):C.splice(_,0,T);case 2:return C.set(_,T);case 3:return C.add(T);default:return C[_]=T}case n:switch(I){case 1:return C.splice(_,1);case 2:return C.delete(_);case 3:return C.delete(y.value);default:return delete C[_]}default:Ye(17,E)}}),S}function h(S){if(!pt(S))return S;if(Array.isArray(S))return S.map(h);if(Ln(S))return new Map(Array.from(S.entries()).map(([y,x])=>[y,h(x)]));if(ui(S))return new Set(Array.from(S).map(h));let g=Object.create(jn(S));for(let y in S)g[y]=h(S[y]);return ii(S,ni)&&(g[ni]=S[ni]),g}function v(S){return vt(S)?h(S):S}FA("Patches",{applyPatches_:u,generatePatches_:o,generateReplacementPatches_:c})}var ci=new LA,Xt=ci.produce,ba=ci.produceWithPatches.bind(ci);var Qu=ci.applyPatches.bind(ci);m();d();p();f();function VA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function UA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function BA(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Tp=e=>Array.isArray(e)?e:[e];function $A(e){let t=Array.isArray(e[0])?e[0]:e;return BA(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function GA(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var uF=Symbol();var lF=Object.getPrototypeOf({});var QA=class{constructor(e){this.value=e}deref(){return this.value}},HA=typeof WeakRef<"u"?WeakRef:QA,zA=0,_p=1;function Aa(){return{s:zA,v:void 0,o:null,p:null}}function Vn(e,t={}){let r=Aa(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let x=y.get(g);x===void 0?(s=Aa(),y.set(g,s)):s=x}else{let y=s.p;y===null&&(s.p=y=new Map);let x=y.get(g);x===void 0?(s=Aa(),y.set(g,s)):s=x}}let u=s,h;if(s.s===_p)h=s.v;else if(h=e.apply(null,arguments),i++,n){let v=o?.deref?.()??o;v!=null&&n(v,h)&&(h=v,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new HA(h):h}return u.s=_p,u.v=h,h}return a.clearCache=()=>{r=Aa(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function kp(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),VA(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=Vn,argsMemoizeOptions:y=[],devModeChecks:x={}}=h,E=Tp(S),C=Tp(y),I=$A(o),T=v(function(){return i++,u.apply(null,arguments)},...E),_=!0,j=g(function(){a++;let k=GA(I,arguments);return s=T.apply(null,k),s},...C);return Object.assign(j,{resultFunc:u,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Ve=kp(Vn),WA=Object.assign((e,t=Ve)=>{UA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((a,s,c)=>(a[r[c]]=s,a),{}))},{withTypes:()=>WA});m();d();p();f();function Op(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Pp=Op(),Np=Op;var KA=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Mn:Mn.apply(null,arguments)},TF=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},YA=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(st(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>qn(n)&&n.type===e,r}var Up=class li extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,li.prototype)}static get[Symbol.species](){return li}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new li(...t[0].concat(this)):new li(...t.concat(this))}};function Fp(e){return pt(e)?Xt(e,()=>{}):e}function Dp(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function XA(e){return typeof e=="boolean"}var JA=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Up;return r&&(XA(r)?a.push(Pp):a.push(Np(r.extraArgument))),a},di="RTK_autoBatch",$n=()=>e=>({payload:e,meta:{[di]:!0}}),Mp=e=>t=>{setTimeout(t,e)},ZA=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Mp(10):e.type==="callback"?e.queueNotification:Mp(e.timeout),u=()=>{a=!1,i&&(i=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>o&&h(),S=n.subscribe(v);return s.add(h),()=>{S(),s.delete(h)}},dispatch(h){try{return o=!h?.meta?.[di],i=!o,i&&(a||(a=!0,c(u))),n.dispatch(h)}finally{o=!0}}})},ew=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Up(e);return n&&o.push(ZA(typeof n=="object"?n:void 0)),o};function Bp(e){let t=JA(),{reducer:r=void 0,middleware:n,devTools:o=!0,preloadedState:i=void 0,enhancers:a=void 0}=e||{},s;if(typeof r=="function")s=r;else if(qt(r))s=Dn(r);else throw new Error(st(1));let c;typeof n=="function"?c=n(t):c=t();let u=Mn;o&&(u=KA({trace:!1,...(typeof o=="object"&&o)}));let h=gp(...c),v=ew(h),S=typeof a=="function"?a(v):v(),g=u(...S);return Pu(s,i,g)}function $p(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(st(28));if(s in t)throw new Error(st(29));return t[s]=a,o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function tw(e){return typeof e=="function"}function Me(e,t){let[r,n,o]=$p(t),i;if(tw(e))i=()=>Fp(e());else{let s=Fp(e);i=()=>s}function a(s=i(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[o]),u.reduce((h,v)=>{if(v)if(vt(h)){let g=v(h,c);return g===void 0?h:g}else{if(pt(h))return Xt(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},s)}return a.getInitialState=i,a}var Gp=(e,t)=>YA(e)?e.match(t):e(t);function jt(...e){return t=>e.some(r=>Gp(r,t))}function Bn(...e){return t=>e.every(r=>Gp(r,t))}function Ea(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function fi(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Ra(...e){return e.length===0?t=>Ea(t,["pending"]):fi(e)?jt(...e.map(t=>t.pending)):Ra()(e[0])}function Wr(...e){return e.length===0?t=>Ea(t,["rejected"]):fi(e)?jt(...e.map(t=>t.rejected)):Wr()(e[0])}function pi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Bn(Wr(...e),t):fi(e)?Bn(Wr(...e),t):pi()(e[0])}function Jt(...e){return e.length===0?t=>Ea(t,["fulfilled"]):fi(e)?jt(...e.map(t=>t.fulfilled)):Jt()(e[0])}function Ia(...e){return e.length===0?t=>Ea(t,["pending","fulfilled","rejected"]):fi(e)?jt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ia()(e[0])}var rw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",mi=(e=21)=>{let t="",r=e;for(;r--;)t+=rw[Math.random()*64|0];return t},nw=["name","message","stack","code"],Hu=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},qp=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},ow=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of nw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Ee=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),i=P(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),a=P(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||ow)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c){return(u,h,v)=>{let S=n?.idGenerator?n.idGenerator(c):mi(),g=new l.AbortController,y,x;function E(I){x=I,g.abort()}let C=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(c,{getState:h,extra:v});if(aw(_)&&(_=yield _),_===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let j=new Promise((N,k)=>{y=()=>{k({name:"AbortError",message:x||"Aborted"})},g.signal.addEventListener("abort",y)});u(i(S,c,n?.getPendingMeta?.({requestId:S,arg:c},{getState:h,extra:v}))),I=yield Promise.race([j,Promise.resolve(r(c,{dispatch:u,getState:h,extra:v,requestId:S,signal:g.signal,abort:E,rejectWithValue:(N,k)=>new Hu(N,k),fulfillWithValue:(N,k)=>new qp(N,k)})).then(N=>{if(N instanceof Hu)throw N;return N instanceof qp?o(N.payload,S,c,N.meta):o(N,S,c)})])}catch(_){I=_ instanceof Hu?a(null,S,c,_.payload,_.meta):a(_,S,c)}finally{y&&g.signal.removeEventListener("abort",y)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||u(I),I})();return Object.assign(C,{abort:E,requestId:S,arg:c,unwrap(){return C.then(iw)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:jt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function iw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function aw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Qp=Symbol.for("rtk-slice-createasyncthunk"),NF={[Qp]:Ee};function sw(e,t){return`${e}/${t}`}function cw({creators:e}={}){let t=e?.asyncThunk?.[Qp];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(st(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(lw()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,T){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(st(12));if(_ in c.sliceCaseReducersByType)throw new Error(st(13));return c.sliceCaseReducersByType[_]=T,u},addMatcher(I,T){return c.sliceMatchers.push({matcher:I,reducer:T}),u},exposeAction(I,T){return c.actionCreators[I]=T,u},exposeCaseReducer(I,T){return c.sliceCaseReducersByName[I]=T,u}};s.forEach(I=>{let T=a[I],_={reducerName:I,type:sw(o,I),createNotation:typeof n.reducers=="function"};fw(T)?mw(_,T,u,t):dw(_,T,u)});function h(){let[I={},T=[],_=void 0]=typeof n.extraReducers=="function"?$p(n.extraReducers):[n.extraReducers],j={...I,...c.sliceCaseReducersByType};return Me(n.initialState,N=>{for(let k in j)N.addCase(k,j[k]);for(let k of c.sliceMatchers)N.addMatcher(k.matcher,k.reducer);for(let k of T)N.addMatcher(k.matcher,k.reducer);_&&N.addDefaultCase(_)})}let v=I=>I,S=new Map,g;function y(I,T){return g||(g=h()),g(I,T)}function x(){return g||(g=h()),g.getInitialState()}function E(I,T=!1){function _(N){let k=N[I];return typeof k>"u"&&T&&(k=x()),k}function j(N=v){let k=Dp(S,T,()=>new WeakMap);return Dp(k,N,()=>{let O={};for(let[D,V]of Object.entries(n.selectors??{}))O[D]=uw(V,N,x,T);return O})}return{reducerPath:I,getSelectors:j,get selectors(){return j(_)},selectSlice:_}}let C={name:o,reducer:y,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...E(i),injectInto(I,{reducerPath:T,..._}={}){let j=T??i;return I.inject({reducerPath:j,reducer:y},_),{...C,...E(j,!0)}}};return C}}function uw(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var Kr=cw();function lw(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function dw({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!pw(n))throw new Error(st(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?P(e,a):P(e))}function fw(e){return e._reducerDefinitionType==="asyncThunk"}function pw(e){return e._reducerDefinitionType==="reducerWithPrepare"}function mw({type:e,reducerName:t},r,n,o){if(!o)throw new Error(st(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,v=o(e,i,h);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:a||wa,pending:s||wa,rejected:c||wa,settled:u||wa})}function wa(){}var gw="task",Hp="listener",zp="completed",Ku="cancelled",hw=`task-${Ku}`,yw=`task-${zp}`,zu=`${Hp}-${Ku}`,vw=`${Hp}-${zp}`,Ta=class{constructor(e){we(this,"name","TaskAbortError");we(this,"message");this.code=e,this.message=`${gw} ${Ku} (reason: ${e})`}},Yu=(e,t)=>{if(typeof e!="function")throw new TypeError(st(32))},xa=()=>{},Wp=(e,t=xa)=>(e.catch(t),e),Kp=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Hr=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},zr=e=>{if(e.aborted){let{reason:t}=e;throw new Ta(t)}};function Yp(e,t){let r=xa;return new Promise((n,o)=>{let i=()=>o(new Ta(e.reason));if(e.aborted){i();return}r=Kp(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=xa})}var Sw=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ta?"cancelled":"rejected",error:r}}finally{t?.()}});return function Sw(_x5,_x6){return _ref5.apply(this,arguments)}}(),Ca=e=>t=>Wp(Yp(e,t).then(r=>(zr(e),r))),Xp=e=>{let t=Ca(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Un}=Object,jp={},_a="listenerMiddleware",bw=(e,t)=>{let r=n=>Kp(e,()=>Hr(n,e.reason));return(n,o)=>{Yu(n,"taskExecutor");let i=new l.AbortController;r(i);let a=Sw(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let s=yield n({pause:Ca(i.signal),delay:Xp(i.signal),signal:i.signal});return zr(i.signal),s}),()=>Hr(i,yw));return o?.autoJoin&&t.push(a.catch(xa)),{result:Ca(e)(a),cancel(){Hr(i,hw)}}}},Aw=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},s=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});i=()=>{h(),u()}})];o!=null&&s.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Yp(t,Promise.race(s));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Wp(r(n,o))},Jp=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(st(21));return Yu(i,"options.listener"),{predicate:o,type:t,effect:i}},Zp=Un(e=>{let{type:t,predicate:r,effect:n}=Jp(e);return{id:mi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(st(22))}}},{withTypes:()=>Zp}),Lp=(e,t)=>{let{type:r,effect:n,predicate:o}=Jp(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Wu=e=>{e.pending.forEach(t=>{Hr(t,zu)})},ww=e=>()=>{e.forEach(Wu),e.clear()},Vp=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},em=Un(P(`${_a}/add`),{withTypes:()=>em}),xw=P(`${_a}/removeAll`),tm=Un(P(`${_a}/remove`),{withTypes:()=>tm}),Cw=(...e)=>{console.error(`${_a}/error`,...e)},rm=(e={})=>{let t=new Map,{extra:r,onError:n=Cw}=e;Yu(n,"onError");let o=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),v=>{h.unsubscribe(),v?.cancelActive&&Wu(h)}),i=h=>{let v=Lp(t,h)??Zp(h);return o(v)};Un(i,{withTypes:()=>i});let a=h=>{let v=Lp(t,h);return v&&(v.unsubscribe(),h.cancelActive&&Wu(v)),!!v};Un(a,{withTypes:()=>a});let s=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,v,S,g){let y=new l.AbortController,x=Aw(i,y.signal),E=[];try{h.pending.add(y),yield Promise.resolve(h.effect(v,Un({},S,{getOriginalState:g,condition:(C,I)=>x(C,I).then(Boolean),take:x,delay:Xp(y.signal),pause:Ca(y.signal),extra:r,signal:y.signal,fork:bw(y.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((C,I,T)=>{C!==y&&(Hr(C,zu),T.delete(C))})},cancel:()=>{Hr(y,zu),h.pending.delete(y)},throwIfCancelled:()=>{zr(y.signal)}})))}catch(C){C instanceof Ta||Vp(n,C,{raisedBy:"effect"})}finally{yield Promise.all(E),Hr(y,vw),h.pending.delete(y)}});return function s(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),c=ww(t);return{middleware:h=>v=>S=>{if(!qn(S))return v(S);if(em.match(S))return i(S.payload);if(xw.match(S)){c();return}if(tm.match(S))return a(S.payload);let g=h.getState(),y=()=>{if(g===jp)throw new Error(st(23));return g},x;try{if(x=v(S),t.size>0){let E=h.getState(),C=Array.from(t.values());for(let I of C){let T=!1;try{T=I.predicate(S,E,g)}catch(_){T=!1,Vp(n,_,{raisedBy:"predicate"})}T&&s(I,S,h,y)}}}finally{g=jp}return x},startListening:i,stopListening:a,clearListeners:c}};var DF=Symbol.for("rtk-state-proxy-original");function st(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();p();f();var X=new H({required:!0,emptyAllowed:!1}),Xe=new H({required:!1,emptyAllowed:!1}),Je=new H({required:!0,emptyAllowed:!0}),zF=new H({required:!1,emptyAllowed:!0}),ka=new ge({each:X,required:!0}),nm=new H({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),om=new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),WF=new H({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Zt=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),At=(e,t)=>{if("required"in t)return{payload:new lt({value:t}).validate({value:e}).value};let o=new ee({options:{required:!0},values:t}).validate(e);if(o)throw new Jo(o);return{payload:e}},q=(e,t)=>{try{return At(e,t)}catch(r){return{payload:e,error:Zt(r)}}},im=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return sm(e,t,r,o,"Controller initialization error")},am=(e,t,r,n)=>{let o=`Check the options of ${n}`;return sm(e,t,r,o,"Controller initialization error")},sm=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();p();f();var Gn="3.47.0",cm=["@coveo/atomic","@coveo/quantic"];var Xu=()=>Xe,um=()=>X,gr=P("configuration/updateBasicConfiguration",e=>q(e,{accessToken:Xe,environment:new H({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Xe})),Lt=P("configuration/updateSearchConfiguration",e=>q(e,{proxyBaseUrl:new H({required:!1,url:!0}),pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:Xe,timezone:Xe,locale:Xe,authenticationProviders:new ge({required:!1,each:X})})),Ew={enabled:new ue({default:!0}),originContext:Xu(),originLevel2:Xu(),originLevel3:Xu(),proxyBaseUrl:new H({required:!1,url:!0}),runtimeEnvironment:new Oe,anonymous:new ue({default:!1}),deviceId:Xe,userDisplayName:Xe,documentLocation:Xe,trackingId:om,analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ee({options:{required:!1},values:cm.reduce((e,t)=>(e[t]=nm,e),{})})},Qn=P("configuration/updateAnalyticsConfiguration",e=>q(e,Ew)),Hn=P("configuration/analytics/disable"),zn=P("configuration/analytics/enable"),Oa=P("configuration/analytics/originlevel2",e=>q(e,{originLevel2:um()})),Pa=P("configuration/analytics/originlevel3",e=>q(e,{originLevel3:um()})),lm=P("knowledge/setAgentId",e=>q(e,new H({required:!0})));m();d();p();f();m();d();p();f();m();d();p();f();var dm={q:new H,enableQuerySyntax:new ue,aq:new H,cq:new H,firstResult:new te({min:0}),numberOfResults:new te({min:0}),sortCriteria:new H,f:new ee,fExcluded:new ee,cf:new ee,nf:new ee,mnf:new ee,df:new ee,debug:new ue,sf:new ee,tab:new H,af:new ee};var hr=P("searchParameters/restore",e=>q(e,dm)),fm=P("searchParameters/restoreTab",e=>q(e,X));m();d();p();f();var Na=P("debug/enable"),Fa=P("debug/disable");m();d();p();f();var Da=()=>!1;var Ma=Me(Da(),e=>{e.addCase(Na,()=>!0).addCase(Fa,()=>!1).addCase(hr,(t,r)=>r.payload.debug??t)});m();d();p();f();var Wn=P("pipeline/set",e=>q(e,new H({required:!0,emptyAllowed:!0})));m();d();p();f();m();d();p();f();var Rw=P("history/undo"),Iw=P("history/redo"),Vt=P("history/snapshot"),nM=Ee("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Rw()),yield t(mt())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),oM=Ee("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(Iw()),yield t(mt())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),mt=Ee("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();p();f();var Kn=()=>"";var Yn=Me(Kn(),e=>{e.addCase(Wn,(t,r)=>r.payload).addCase(mt.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Lt,(t,r)=>r.payload.pipeline||t)});m();d();p();f();m();d();p();f();var qa=P("app/setError");m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Xn=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(s)||u.test(s)||s.indexOf(".")===-1?Ju(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Ju(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Ju(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();p();f();function Tw(){return typeof navigator<"u"}function pm(){try{return typeof localStorage<"u"}catch{return!1}}function mm(){try{return typeof sessionStorage<"u"}catch{return!1}}function gm(){return!!(Tw()&&navigator.cookieEnabled)}var hm=null;function ym(){return hm||(pm()?localStorage:gm()?new Zu:mm()?sessionStorage:new el)}var Jn=class Jn{getItem(t){return Xn.get(`${Jn.prefix}${t}`)}removeItem(t){Xn.erase(`${Jn.prefix}${t}`)}setItem(t,r,n){Xn.set(`${Jn.prefix}${t}`,r,n)}};we(Jn,"prefix","coveo_");var Zu=Jn;var el=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ja="__coveo.analytics.history",_w=20,kw=1e3*60,Ow=75,Yr=class Yr{constructor(t){we(this,"store");this.store=t||ym()}static getInstance(t){return Yr.instance||(Yr.instance=new Yr(t)),Yr.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!==null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ja);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ja);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ja,JSON.stringify(t.slice(0,_w)))}catch{}}clear(){try{this.store.removeItem(ja)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Ow)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>kw:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};we(Yr,"instance",null);var tl=Yr,wt=tl;m();d();p();f();m();d();p();f();var Zn=Ve(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Gn}`));m();d();p();f();m();d();p();f();function er(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function M(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function ol(){return typeof window<"u"}function yl(){return typeof navigator<"u"}function eo(){return typeof document<"u"}function il(){try{return typeof localStorage<"u"}catch{return!1}}function Pw(){try{return typeof sessionStorage<"u"}catch{return!1}}function Om(){return yl()&&navigator.cookieEnabled}var Nw=[ve.click,ve.custom,ve.search,ve.view],Fw=(e,t)=>Nw.indexOf(e)!==-1?Object.assign({language:eo()?document.documentElement.lang:"unknown",userAgent:yl()?navigator.userAgent:"unknown"},t):t,hi=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?vm(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],vm(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function vm(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function Dw(){return il()?localStorage:Om()?new yi:Pw()?sessionStorage:new ro}var yi=class e{getItem(t){return hi.get(`${e.prefix}${t}`)}removeItem(t){hi.erase(`${e.prefix}${t}`)}setItem(t,r,n){hi.set(`${e.prefix}${t}`,r,n)}};yi.prefix="coveo_";var al=class{constructor(){this.cookieStorage=new yi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},ro=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},La="__coveo.analytics.history",Mw=20,qw=1e3*60,jw=75,Ba=class{constructor(t){this.store=t||Dw()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return M(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return M(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(La);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return M(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(La);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(La,JSON.stringify(t.slice(0,Mw)))}catch{}}clear(){try{this.store.removeItem(La)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,jw)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>qw:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Lw=(e,t)=>M(void 0,void 0,void 0,function*(){return e===ve.view?(yield Vw(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Vw=e=>M(void 0,void 0,void 0,function*(){let t=new Ba,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Va,Uw=new Uint8Array(16);function Bw(){if(!Va&&(Va=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Va))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Va(Uw)}var $w=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function $a(e){return typeof e=="string"&&$w.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Pm(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function Gw(e){if(!$a(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function Qw(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Hw="6ba7b810-9dad-11d1-80b4-00c04fd430c8",zw="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Ww(e,t,r){function n(o,i,a,s){var c;if(typeof o=="string"&&(o=Qw(o)),typeof i=="string"&&(i=Gw(i)),((c=i)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+o.length);if(u.set(i),u.set(o,i.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,a){s=s||0;for(let h=0;h<16;++h)a[s+h]=u[h];return a}return Pm(u)}try{n.name=e}catch{}return n.DNS=Hw,n.URL=zw,n}var Kw=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sm={randomUUID:Kw};function Xr(e,t,r){if(Sm.randomUUID&&!t&&!e)return Sm.randomUUID();e=e||{};let n=e.random||(e.rng||Bw)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Pm(n)}function Yw(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function rl(e,t){return e<<t|e>>>32-t}function Xw(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let c=0;c<16;++c)s[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];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let g=0;g<16;++g)s[g]=i[a][g];for(let g=16;g<80;++g)s[g]=rl(s[g-3]^s[g-8]^s[g-14]^s[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),x=rl(c,5)+Yw(y,u,h,v)+S+t[y]+s[g]>>>0;S=v,v=h,h=rl(u,30)>>>0,u=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Jw=Ww("v5",80,Xw),bm=Jw,Nm="2.30.52",Am=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,gi={pageview:"pageview",event:"event"},Ga=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},sl=class extends Ga{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Am(window.location),this.lastReferrer=eo()?document.referrer:"",this.addHooks()}getApi(t){switch(t){case"setAction":return this.setAction;default:return null}}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:eo()?document.title:"",encoding:eo()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===gi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===gi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===gi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===gi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return Am(window.location)}},yr=class e{constructor(t,r){if(!$a(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return $a(i)?new e(i,Number.parseInt(o)*1e3):null}};yr.cvo_cid="cvo_cid";yr.expirationTime=120;var cl=class extends Ga{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return M(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(yr.cvo_cid,new yr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};cl.Id="link";var Ct=Object.keys;function Ua(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var nl=128,Fm=192,wm=224,xm=240;function Zw(e){return(e&248)===xm?4:(e&xm)===wm?3:(e&wm)===Fm?2:1}function ex(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&nl)!=nl)break;if(r-=3,(n&Fm)!=nl){t-r>=Zw(n)*3&&(r=t);break}}return e.substring(0,r)}var ul={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"},tx=Ct(ul).map(e=>ul[e]),rx=[...tx].join("|"),nx=new RegExp(`^(${rx}$)`),ox={svcAction:"svc_action",svcActionData:"svc_action_data"},ix=e=>Ct(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ul[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),ax=e=>nx.test(e),sx=[ax],Cm={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Em={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},ot={action:"pa",list:"pal",listSource:"pls"},Qa={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},cx=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ll={id:"quoteId",affiliation:"quoteAffiliation"},dl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},ux={add:ot,bookmark_add:ot,bookmark_remove:ot,click:ot,checkout:ot,checkout_option:ot,detail:ot,impression:ot,remove:ot,refund:Object.assign(Object.assign({},ot),Qa),purchase:Object.assign(Object.assign({},ot),Qa),quickview:ot,quote:Object.assign(Object.assign({},ot),ll),review:Object.assign(Object.assign({},ot),dl)},lx=Ct(Cm).map(e=>Cm[e]),dx=Ct(Em).map(e=>Em[e]),fx=Ct(ot).map(e=>ot[e]),px=Ct(Qa).map(e=>Qa[e]),mx=Ct(dl).map(e=>dl[e]),gx=Ct(ll).map(e=>ll[e]),hx=[...lx,"custom"].join("|"),yx=[...dx,"custom"].join("|"),Dm="(pr[0-9]+)",Mm="(il[0-9]+pi[0-9]+)",vx=new RegExp(`^${Dm}(${hx})$`),Sx=new RegExp(`^(${Mm}(${yx}))|(il[0-9]+nm)$`),bx=new RegExp(`^(${fx.join("|")})$`),Ax=new RegExp(`^(${px.join("|")})$`),wx=new RegExp(`^${Dm}custom$`),xx=new RegExp(`^${Mm}custom$`),Cx=new RegExp(`^(${[...cx,...mx,...gx].join("|")})$`),Ex=e=>vx.test(e),Rx=e=>Sx.test(e),Ix=e=>bx.test(e),Tx=e=>Ax.test(e),_x=e=>Cx.test(e),kx=[Rx,Ex,Ix,Tx,_x],Ox=[wx,xx],Px={anonymizeIp:"aip"},Nx={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Fx={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Dx=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Mx=Object.assign(Object.assign(Object.assign(Object.assign({},Px),Nx),Fx),Dx.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),fl=Object.assign(Object.assign({},Mx),ox),qx=e=>{let t=!!e.action&&ux[e.action]||{};return Ct(e).reduce((r,n)=>{let o=t[n]||fl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},jx=Ct(fl).map(e=>fl[e]),Lx=e=>jx.indexOf(e)!==-1,Vx=e=>e==="custom",Ux=e=>[...kx,...sx,Lx,Vx].some(t=>t(e)),Bx=e=>Ct(e).reduce((t,r)=>{let n=$x(r);return n?Object.assign(Object.assign({},t),Gx(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),$x=e=>{let t;return[...Ox].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Gx=(e,t)=>Ct(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),pl=class{constructor(t){this.opts=t}sendEvent(t,r){return M(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,s),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return M(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:c}=a;o=s||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return M(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},ml=class{sendEvent(t,r){return M(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return M(this,void 0,void 0,function*(){return Promise.resolve()})}},Rm=b.fetch,Ha=class{constructor(t){this.opts=t}sendEvent(t,r){return M(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:u}=c,h=er(c,["url"]),v;try{v=yield Rm(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&o.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return M(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Rm(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return M(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},gl=class{constructor(t,r){il()&&Om()?this.storage=new al:il()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ro),this.client=new Ha(t),this.beaconClient=new pl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},hl=class{constructor(t,r){this.storage=r||new ro,this.client=new Ha(t)}getClientDependingOnEventType(t){return this.client}},za=class{constructor(){this.storage=new ro,this.client=new ml}getClientDependingOnEventType(t){return this.client}},Qx="xx",Hx=e=>e?.startsWith(Qx)||!1,zx=`
26
+ `;return new Xo(r)}var Xo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},lt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw Vb(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Oe=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&ie(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 ze(e){return e===void 0}function Ub(e){return e===null}function ie(e){return ze(e)||Ub(e)}var ue=class{constructor(e={}){we(this,"value");this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t||(Bb(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Bb(e){return ze(e)||Bp(e)}function Bp(e){return typeof e=="boolean"}var te=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t||(Gb(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 Gb(e){return ze(e)||Gp(e)}function Gp(e){return typeof e=="number"&&!Number.isNaN(e)}var $b=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,H=class{constructor(e={}){we(this,"value");we(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Oe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(ze(e))return null;if(!na(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!($b.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 na(e){return Object.prototype.toString.call(e)==="[object String]"}var ee=class{constructor(e={}){we(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(ze(e))return this.config.options.required?"value is required and is currently undefined":null;if(!$p(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ie(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function $p(e){return e!==void 0&&typeof e=="object"}var ge=class{constructor(e={}){we(this,"value");this.config=e,this.value=new Oe(this.config)}validate(e){if(!ie(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ie(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&ie(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Bp(e)||na(e)||Gp(e)||$p(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Qp(e){return Array.isArray(e)}var Au=class{constructor(e){we(this,"value");this.config=e,this.value=new Oe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:ze(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();f();p();function Hp(e){return Array.isArray(e)}function oa(e){return e.trim()===""}var Qb=new Set(["1",1,"yes",!0]);function zp(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Qb.has(r))}function Wp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function Jo(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ia(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function Hb(e){if(oa(e.openingDelimiter)||oa(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ie(e.content)||oa(e.content))return e.content;if(e.highlights.length===0)return Nn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Nn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Nn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Nn(e.content.slice(n))),r}function zb(e,t){return e=Nn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?wu(n,t.notMatchDelimiters):o?wu(o,t.exactMatchDelimiters):i?wu(i,t.correctionDelimiters):r)}function wu(e,t){return t?t.open+e+t.close:e}function Nn(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();f();p();var sf=_t(rf(),1);m();d();f();p();var Dt=new Error("Failed to load reducers."),Fn=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."}},Br=class extends Error{constructor(r,n){super();we(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();f();p();function nf(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function of(e){return typeof e!="object"||!e?!1:Object.values(e).every(SA)}function SA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function af(e){return e===429}var kt=class e{static call(t){return _asyncToGenerator(function*(){let r=bA(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield A(i,a);if(af(c.status))throw c;return c});return function s(){return _ref.apply(this,arguments)}}();try{let c=yield(0,sf.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&af(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(v=>setTimeout(v,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Fn;case 404:throw new Br(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Br(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...c}=t,u=Jo(c);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function We(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function dr(e,t="prod"){return`${We(e,t)}/rest/search/v2`}function sa(e,t="prod"){return`${We(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function bA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",c=AA(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:c}),signal:a}}function AA(e,t){return t==="application/x-www-form-urlencoded"?of(e)?nf(e):"":JSON.stringify(e)}m();d();f();p();m();d();f();p();var ca=e=>e;m();d();f();p();m();d();f();p();function ua(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function Mt(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:ua(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:ua(),extendedResults:{},searchAction:void 0}}m();d();f();p();function pr(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var fr=e=>{let{response:t}=e;return t.body?wA(e):xA(t)},wA=e=>EA(e)?RA(e):CA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},xA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function CA(e){return e.body.statusCode!==void 0}function EA(e){return e.body.exception!==void 0}var RA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();f();p();var mr=class{constructor(){we(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();f();p();m();d();f();p();var ti=class{constructor(t){we(this,"_basePath");we(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();f();p();function cf(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();f();p();var Yt=(e,t,r,n)=>{let o=new ti(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var uf=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield kt.call({...Yt(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:pr(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=cf(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return IA(a)?{success:a}:{error:fr({response:r,body:a})}});return function uf(_x3,_x4){return _ref3.apply(this,arguments)}}();function IA(e){return typeof e=="string"}m();d();f();p();function TA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function _A(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function la(e,t){if(t&&e.name==="AbortError")return{error:_A(e)};if(e instanceof Br)return{error:TA(e)};throw e}var da=class{constructor(t){this.options=t;we(this,"apiCallsQueues",{unknown:new mr,mainSearch:new mr,facetValues:new mr,foldingCollection:new mr,instantResults:new mr})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/plan"),requestParams:pr(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return la(r);let n=yield r.json();return OA(n)?{success:n}:{error:fr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:pr(t),..._this3.options});if(r instanceof Error)return la(r);let n=yield r.json(),o={response:r,body:n};return kA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:fr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>kt.call({...Yt(t,"POST","application/json",""),requestParams:pr(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return la(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return lf(i)?(a.body=df(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:fr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json","/facet"),requestParams:pr(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"POST","application/json",""),requestParams:pr(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(lf(n)){let o={response:r,body:n};return o.body=df(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:fr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return uf(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield kt.call({...Yt(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return PA(n)?{success:n}:{error:fr({response:r,body:n})}})()}},pa=e=>e.success!==void 0,dt=e=>e.error!==void 0;function lf(e){return e.results!==void 0}function df(e){let t=ua();return ie(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function kA(e){return e.completions!==void 0}function OA(e){return e.preprocessingOutput!==void 0}function PA(e){return e.fields!==void 0}m();d();f();p();var pf=e=>e,ff=e=>e,mf=e=>e;m();d();f();p();m();d();f();p();m();d();f();p();function Ke(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 NA=typeof Symbol=="function"&&Symbol.observable||"@@observable",gf=NA,Pu=()=>Math.random().toString(36).substring(7).split("").join("."),FA={INIT:`@@redux/INIT${Pu()}`,REPLACE:`@@redux/REPLACE${Pu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Pu()}`},fa=FA;function jt(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 Nu(e,t,r){if(typeof e!="function")throw new Error(Ke(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ke(1));return r(Nu)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((E,C)=>{a.set(C,E)}))}function h(){if(c)throw new Error(Ke(3));return o}function v(E){if(typeof E!="function")throw new Error(Ke(4));if(c)throw new Error(Ke(5));let C=!0;u();let I=s++;return a.set(I,E),function(){if(C){if(c)throw new Error(Ke(6));C=!1,u(),a.delete(I),i=null}}}function S(E){if(!jt(E))throw new Error(Ke(7));if(typeof E.type>"u")throw new Error(Ke(8));if(typeof E.type!="string")throw new Error(Ke(17));if(c)throw new Error(Ke(9));try{c=!0,o=n(o,E)}finally{c=!1}return(i=a).forEach(I=>{I()}),E}function g(E){if(typeof E!="function")throw new Error(Ke(10));n=E,S({type:fa.REPLACE})}function y(){let E=v;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(Ke(11));function I(){let _=C;_.next&&_.next(h())}return I(),{unsubscribe:E(I)}},[gf](){return this}}}return S({type:fa.INIT}),{dispatch:S,subscribe:v,getState:h,replaceReducer:g,[gf]:y}}function DA(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:fa.INIT})>"u")throw new Error(Ke(12));if(typeof r(void 0,{type:fa.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function Dn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{DA(r)}catch(a){i=a}return function(s={},c){if(i)throw i;let u=!1,h={};for(let v=0;v<n.length;v++){let S=n[v],g=r[S],y=s[S],x=g(y,c);if(typeof x>"u"){let E=c&&c.type;throw new Error(Ke(14))}h[S]=x,u=u||x!==y}return u=u||n.length!==Object.keys(s).length,u?h:s}}function Mn(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function hf(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ke(15))},a={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},s=e.map(c=>c(a));return i=Mn(...s)(o.dispatch),{...o,dispatch:i}}}function jn(e){return jt(e)&&"type"in e&&typeof e.type=="string"}m();d();f();p();var Gu=Symbol.for("immer-nothing"),ri=Symbol.for("immer-draftable"),pt=Symbol.for("immer-state");function Ye(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qn=Object.getPrototypeOf;function vt(e){return!!e&&!!e[pt]}function ft(e){return e?wf(e)||Array.isArray(e)||!!e[ri]||!!e.constructor?.[ri]||Ln(e)||ci(e):!1}var MA=Object.prototype.constructor.toString(),yf=new WeakMap;function wf(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=yf.get(r);return n===void 0&&(n=Function.toString.call(r),yf.set(r,n)),n===MA}function $u(e){return vt(e)||Ye(15,e),e[pt].base_}function ni(e,t,r=!0){$r(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function $r(e){let t=e[pt];return t?t.type_:Array.isArray(e)?1:Ln(e)?2:ci(e)?3:0}function oi(e,t){return $r(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Fu(e,t){return $r(e)===2?e.get(t):e[t]}function xf(e,t,r){let n=$r(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function jA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ln(e){return e instanceof Map}function ci(e){return e instanceof Set}function Gr(e){return e.copy_||e.base_}function ju(e,t){if(Ln(e))return new Map(e);if(ci(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=wf(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[pt];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[a]})}return Object.create(qn(e),n)}else{let n=qn(e);if(n!==null&&r)return{...e};let o=Object.create(n);return Object.assign(o,e)}}function ya(e,t=!1){return va(e)||vt(e)||!ft(e)||($r(e)>1&&Object.defineProperties(e,{set:ma,add:ma,clear:ma,delete:ma}),Object.freeze(e),t&&Object.values(e).forEach(r=>ya(r,!0))),e}function qA(){Ye(2)}var ma={value:qA};function va(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var qu={};function Qr(e){let t=qu[e];return t||Ye(0,e),t}function LA(e,t){qu[e]||(qu[e]=t)}var ii;function Cf(){return ii}function VA(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vf(e,t){t&&(Qr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Lu(e){Vu(e),e.drafts_.forEach(UA),e.drafts_=null}function Vu(e){e===ii&&(ii=e.parent_)}function Sf(e){return ii=VA(ii,e)}function UA(e){let t=e[pt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bf(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[pt].modified_&&(Lu(t),Ye(4)),ft(e)&&(e=ga(t,e),t.parent_||ha(t,e)),t.patches_&&Qr("Patches").generateReplacementPatches_(r[pt].base_,e,t.patches_,t.inversePatches_)):e=ga(t,r,[]),Lu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gu?e:void 0}function ga(e,t,r){if(va(t))return t;let n=e.immer_.shouldUseStrictIteration(),o=t[pt];if(!o)return ni(t,(i,a)=>Af(e,o,t,i,a,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return ha(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;let i=o.copy_,a=i,s=!1;o.type_===3&&(a=new Set(i),i.clear(),s=!0),ni(a,(c,u)=>Af(e,o,i,c,u,r,s),n),ha(e,i,!1),r&&e.patches_&&Qr("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function Af(e,t,r,n,o,i,a){if(o==null||typeof o!="object"&&!a)return;let s=va(o);if(!(s&&!a)){if(vt(o)){let c=i&&t&&t.type_!==3&&!oi(t.assigned_,n)?i.concat(n):void 0,u=ga(e,o,c);if(xf(r,n,u),vt(u))e.canAutoFreeze_=!1;else return}else a&&r.add(o);if(ft(o)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===o&&s)return;ga(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Ln(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&ha(e,o)}}}function ha(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ya(t,r)}function BA(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Cf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=Qu;r&&(o=[n],i=ai);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}var Qu={get(e,t){if(t===pt)return e;let r=Gr(e);if(!oi(r,t))return GA(e,r,t);let n=r[t];return e.finalized_||!ft(n)?n:n===Du(e.base_,t)?(Mu(e),e.copy_[t]=Bu(n,e)):n},has(e,t){return t in Gr(e)},ownKeys(e){return Reflect.ownKeys(Gr(e))},set(e,t,r){let n=Ef(Gr(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Du(Gr(e),t),i=o?.[pt];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(jA(r,o)&&(r!==void 0||oi(e.base_,t)))return!0;Mu(e),Uu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Du(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mu(e),Uu(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Gr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ye(11)},getPrototypeOf(e){return qn(e.base_)},setPrototypeOf(){Ye(12)}},ai={};ni(Qu,(e,t)=>{ai[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ai.deleteProperty=function(e,t){return ai.set.call(this,e,t,void 0)};ai.set=function(e,t,r){return Qu.set.call(this,e[0],t,r,e[0])};function Du(e,t){let r=e[pt];return(r?Gr(r):e)[t]}function GA(e,t,r){let n=Ef(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Ef(e,t){if(!(t in e))return;let r=qn(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qn(r)}}function Uu(e){e.modified_||(e.modified_=!0,e.parent_&&Uu(e.parent_))}function Mu(e){e.copy_||(e.copy_=ju(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $A=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let a=this;return function(c=i,...u){return a.produce(c,h=>r.call(this,h,...u))}}typeof r!="function"&&Ye(6),n!==void 0&&typeof n!="function"&&Ye(7);let o;if(ft(t)){let i=Sf(this),a=Bu(t,void 0),s=!0;try{o=r(a),s=!1}finally{s?Lu(i):Vu(i)}return vf(i,n),bf(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Gu&&(o=void 0),this.autoFreeze_&&ya(o,!0),n){let i=[],a=[];Qr("Patches").generateReplacementPatches_(t,o,i,a),n(i,a)}return o}else Ye(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ft(e)||Ye(8),vt(e)&&(e=Rf(e));let t=Sf(this),r=Bu(e,void 0);return r[pt].isManual_=!0,Vu(t),r}finishDraft(e,t){let r=e&&e[pt];(!r||!r.isManual_)&&Ye(9);let{scope_:n}=r;return vf(n,t),bf(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=Qr("Patches").applyPatches_;return vt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Bu(e,t){let r=Ln(e)?Qr("MapSet").proxyMap_(e,t):ci(e)?Qr("MapSet").proxySet_(e,t):BA(e,t);return(t?t.scope_:Cf()).drafts_.push(r),r}function Rf(e){return vt(e)||Ye(10,e),If(e)}function If(e){if(!ft(e)||va(e))return e;let t=e[pt],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ju(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ju(e,!0);return ni(r,(o,i)=>{xf(r,o,If(i))},n),t&&(t.finalized_=!1),r}function Tf(){let t="replace",r="add",n="remove";function o(S,g,y,x){switch(S.type_){case 0:case 2:return a(S,g,y,x);case 1:return i(S,g,y,x);case 3:return s(S,g,y,x)}}function i(S,g,y,x){let{base_:E,assigned_:C}=S,I=S.copy_;I.length<E.length&&([E,I]=[I,E],[y,x]=[x,y]);for(let T=0;T<E.length;T++)if(C[T]&&I[T]!==E[T]){let _=g.concat([T]);y.push({op:t,path:_,value:v(I[T])}),x.push({op:t,path:_,value:v(E[T])})}for(let T=E.length;T<I.length;T++){let _=g.concat([T]);y.push({op:r,path:_,value:v(I[T])})}for(let T=I.length-1;E.length<=T;--T){let _=g.concat([T]);x.push({op:n,path:_})}}function a(S,g,y,x){let{base_:E,copy_:C}=S;ni(S.assigned_,(I,T)=>{let _=Fu(E,I),q=Fu(C,I),N=T?oi(E,I)?t:r:n;if(_===q&&N===t)return;let k=g.concat(I);y.push(N===n?{op:N,path:k}:{op:N,path:k,value:q}),x.push(N===r?{op:n,path:k}:N===n?{op:r,path:k,value:v(_)}:{op:t,path:k,value:v(_)})})}function s(S,g,y,x){let{base_:E,copy_:C}=S,I=0;E.forEach(T=>{if(!C.has(T)){let _=g.concat([I]);y.push({op:n,path:_,value:T}),x.unshift({op:r,path:_,value:T})}I++}),I=0,C.forEach(T=>{if(!E.has(T)){let _=g.concat([I]);y.push({op:r,path:_,value:T}),x.unshift({op:n,path:_,value:T})}I++})}function c(S,g,y,x){y.push({op:t,path:[],value:g===Gu?void 0:g}),x.push({op:t,path:[],value:S})}function u(S,g){return g.forEach(y=>{let{path:x,op:E}=y,C=S;for(let q=0;q<x.length-1;q++){let N=$r(C),k=x[q];typeof k!="string"&&typeof k!="number"&&(k=""+k),(N===0||N===1)&&(k==="__proto__"||k==="constructor")&&Ye(19),typeof C=="function"&&k==="prototype"&&Ye(19),C=Fu(C,k),typeof C!="object"&&Ye(18,x.join("/"))}let I=$r(C),T=h(y.value),_=x[x.length-1];switch(E){case t:switch(I){case 2:return C.set(_,T);case 3:Ye(16);default:return C[_]=T}case r:switch(I){case 1:return _==="-"?C.push(T):C.splice(_,0,T);case 2:return C.set(_,T);case 3:return C.add(T);default:return C[_]=T}case n:switch(I){case 1:return C.splice(_,1);case 2:return C.delete(_);case 3:return C.delete(y.value);default:return delete C[_]}default:Ye(17,E)}}),S}function h(S){if(!ft(S))return S;if(Array.isArray(S))return S.map(h);if(Ln(S))return new Map(Array.from(S.entries()).map(([y,x])=>[y,h(x)]));if(ci(S))return new Set(Array.from(S).map(h));let g=Object.create(qn(S));for(let y in S)g[y]=h(S[y]);return oi(S,ri)&&(g[ri]=S[ri]),g}function v(S){return vt(S)?h(S):S}LA("Patches",{applyPatches_:u,generatePatches_:o,generateReplacementPatches_:c})}var si=new $A,Xt=si.produce,Sa=si.produceWithPatches.bind(si);var Hu=si.applyPatches.bind(si);m();d();f();p();function QA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function HA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function zA(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var _f=e=>Array.isArray(e)?e:[e];function WA(e){let t=Array.isArray(e[0])?e[0]:e;return zA(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function KA(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var pF=Object.getPrototypeOf({});var YA=class{constructor(e){this.value=e}deref(){return this.value}},XA=typeof WeakRef<"u"?WeakRef:YA,JA=0,kf=1;function ba(){return{s:JA,v:void 0,o:null,p:null}}function Vn(e,t={}){let r=ba(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:c}=arguments;for(let v=0,S=c;v<S;v++){let g=arguments[v];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let x=y.get(g);x===void 0?(s=ba(),y.set(g,s)):s=x}else{let y=s.p;y===null&&(s.p=y=new Map);let x=y.get(g);x===void 0?(s=ba(),y.set(g,s)):s=x}}let u=s,h;if(s.s===kf)h=s.v;else if(h=e.apply(null,arguments),i++,n){let v=o?.deref?.()??o;v!=null&&n(v,h)&&(h=v,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new XA(h):h}return u.s=kf,u.v=h,h}return a.clearCache=()=>{r=ba(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function Of(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),QA(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:v,memoizeOptions:S=[],argsMemoize:g=Vn,argsMemoizeOptions:y=[],devModeChecks:x={}}=h,E=_f(S),C=_f(y),I=WA(o),T=v(function(){return i++,u.apply(null,arguments)},...E),_=!0,q=g(function(){a++;let k=KA(I,arguments);return s=T.apply(null,k),s},...C);return Object.assign(q,{resultFunc:u,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:v,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Ve=Of(Vn),ZA=Object.assign((e,t=Ve)=>{HA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((a,s,c)=>(a[r[c]]=s,a),{}))},{withTypes:()=>ZA});m();d();f();p();function Pf(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var Nf=Pf(),Ff=Pf;var ew=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Mn:Mn.apply(null,arguments)},kF=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},tw=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(st(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>jn(n)&&n.type===e,r}var Bf=class ui extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ui.prototype)}static get[Symbol.species](){return ui}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ui(...t[0].concat(this)):new ui(...t.concat(this))}};function Df(e){return ft(e)?Xt(e,()=>{}):e}function Mf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function rw(e){return typeof e=="boolean"}var nw=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Bf;return r&&(rw(r)?a.push(Nf):a.push(Ff(r.extraArgument))),a},li="RTK_autoBatch",Gn=()=>e=>({payload:e,meta:{[li]:!0}}),jf=e=>t=>{setTimeout(t,e)},ow=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:jf(10):e.type==="callback"?e.queueNotification:jf(e.timeout),u=()=>{a=!1,i&&(i=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let v=()=>o&&h(),S=n.subscribe(v);return s.add(h),()=>{S(),s.delete(h)}},dispatch(h){try{return o=!h?.meta?.[li],i=!o,i&&(a||(a=!0,c(u))),n.dispatch(h)}finally{o=!0}}})},iw=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Bf(e);return n&&o.push(ow(typeof n=="object"?n:void 0)),o};function Gf(e){let t=nw(),{reducer:r=void 0,middleware:n,devTools:o=!0,preloadedState:i=void 0,enhancers:a=void 0}=e||{},s;if(typeof r=="function")s=r;else if(jt(r))s=Dn(r);else throw new Error(st(1));let c;typeof n=="function"?c=n(t):c=t();let u=Mn;o&&(u=ew({trace:!1,...(typeof o=="object"&&o)}));let h=hf(...c),v=iw(h),S=typeof a=="function"?a(v):v(),g=u(...S);return Nu(s,i,g)}function $f(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(st(28));if(s in t)throw new Error(st(29));return t[s]=a,o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function aw(e){return typeof e=="function"}function Me(e,t){let[r,n,o]=$f(t),i;if(aw(e))i=()=>Df(e());else{let s=Df(e);i=()=>s}function a(s=i(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[o]),u.reduce((h,v)=>{if(v)if(vt(h)){let g=v(h,c);return g===void 0?h:g}else{if(ft(h))return Xt(h,S=>v(S,c));{let S=v(h,c);if(S===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return h},s)}return a.getInitialState=i,a}var Qf=(e,t)=>tw(e)?e.match(t):e(t);function qt(...e){return t=>e.some(r=>Qf(r,t))}function Bn(...e){return t=>e.every(r=>Qf(r,t))}function Ca(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function di(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Ea(...e){return e.length===0?t=>Ca(t,["pending"]):di(e)?qt(...e.map(t=>t.pending)):Ea()(e[0])}function Wr(...e){return e.length===0?t=>Ca(t,["rejected"]):di(e)?qt(...e.map(t=>t.rejected)):Wr()(e[0])}function pi(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Bn(Wr(...e),t):di(e)?Bn(Wr(...e),t):pi()(e[0])}function Jt(...e){return e.length===0?t=>Ca(t,["fulfilled"]):di(e)?qt(...e.map(t=>t.fulfilled)):Jt()(e[0])}function Ra(...e){return e.length===0?t=>Ca(t,["pending","fulfilled","rejected"]):di(e)?qt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Ra()(e[0])}var sw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",fi=(e=21)=>{let t="",r=e;for(;r--;)t+=sw[Math.random()*64|0];return t},cw=["name","message","stack","code"],zu=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},qf=class{constructor(e,t){we(this,"_type");this.payload=e,this.meta=t}},uw=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of cw)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Ee=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(c,u,h,v)=>({payload:c,meta:{...(v||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),i=P(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),a=P(t+"/rejected",(c,u,h,v,S)=>({payload:v,error:(n&&n.serializeError||uw)(c||"Rejected"),meta:{...(S||{}),arg:h,requestId:u,rejectedWithValue:!!v,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c){return(u,h,v)=>{let S=n?.idGenerator?n.idGenerator(c):fi(),g=new l.AbortController,y,x;function E(I){x=I,g.abort()}let C=_asyncToGenerator(function*(){let I;try{let _=n?.condition?.(c,{getState:h,extra:v});if(dw(_)&&(_=yield _),_===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((N,k)=>{y=()=>{k({name:"AbortError",message:x||"Aborted"})},g.signal.addEventListener("abort",y)});u(i(S,c,n?.getPendingMeta?.({requestId:S,arg:c},{getState:h,extra:v}))),I=yield Promise.race([q,Promise.resolve(r(c,{dispatch:u,getState:h,extra:v,requestId:S,signal:g.signal,abort:E,rejectWithValue:(N,k)=>new zu(N,k),fulfillWithValue:(N,k)=>new qf(N,k)})).then(N=>{if(N instanceof zu)throw N;return N instanceof qf?o(N.payload,S,c,N.meta):o(N,S,c)})])}catch(_){I=_ instanceof zu?a(null,S,c,_.payload,_.meta):a(_,S,c)}finally{y&&g.signal.removeEventListener("abort",y)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||u(I),I})();return Object.assign(C,{abort:E,requestId:S,arg:c,unwrap(){return C.then(lw)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:qt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function lw(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function dw(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Hf=Symbol.for("rtk-slice-createasyncthunk"),DF={[Hf]:Ee};function pw(e,t){return`${e}/${t}`}function fw({creators:e}={}){let t=e?.asyncThunk?.[Hf];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(st(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(gw()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,T){let _=typeof I=="string"?I:I.type;if(!_)throw new Error(st(12));if(_ in c.sliceCaseReducersByType)throw new Error(st(13));return c.sliceCaseReducersByType[_]=T,u},addMatcher(I,T){return c.sliceMatchers.push({matcher:I,reducer:T}),u},exposeAction(I,T){return c.actionCreators[I]=T,u},exposeCaseReducer(I,T){return c.sliceCaseReducersByName[I]=T,u}};s.forEach(I=>{let T=a[I],_={reducerName:I,type:pw(o,I),createNotation:typeof n.reducers=="function"};yw(T)?Sw(_,T,u,t):hw(_,T,u)});function h(){let[I={},T=[],_=void 0]=typeof n.extraReducers=="function"?$f(n.extraReducers):[n.extraReducers],q={...I,...c.sliceCaseReducersByType};return Me(n.initialState,N=>{for(let k in q)N.addCase(k,q[k]);for(let k of c.sliceMatchers)N.addMatcher(k.matcher,k.reducer);for(let k of T)N.addMatcher(k.matcher,k.reducer);_&&N.addDefaultCase(_)})}let v=I=>I,S=new Map,g;function y(I,T){return g||(g=h()),g(I,T)}function x(){return g||(g=h()),g.getInitialState()}function E(I,T=!1){function _(N){let k=N[I];return typeof k>"u"&&T&&(k=x()),k}function q(N=v){let k=Mf(S,T,()=>new WeakMap);return Mf(k,N,()=>{let O={};for(let[D,V]of Object.entries(n.selectors??{}))O[D]=mw(V,N,x,T);return O})}return{reducerPath:I,getSelectors:q,get selectors(){return q(_)},selectSlice:_}}let C={name:o,reducer:y,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...E(i),injectInto(I,{reducerPath:T,..._}={}){let q=T??i;return I.inject({reducerPath:q,reducer:y},_),{...C,...E(q,!0)}}};return C}}function mw(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var Kr=fw();function gw(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function hw({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!vw(n))throw new Error(st(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?P(e,a):P(e))}function yw(e){return e._reducerDefinitionType==="asyncThunk"}function vw(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Sw({type:e,reducerName:t},r,n,o){if(!o)throw new Error(st(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,v=o(e,i,h);n.exposeAction(t,v),a&&n.addCase(v.fulfilled,a),s&&n.addCase(v.pending,s),c&&n.addCase(v.rejected,c),u&&n.addMatcher(v.settled,u),n.exposeCaseReducer(t,{fulfilled:a||Aa,pending:s||Aa,rejected:c||Aa,settled:u||Aa})}function Aa(){}var bw="task",zf="listener",Wf="completed",Yu="cancelled",Aw=`task-${Yu}`,ww=`task-${Wf}`,Wu=`${zf}-${Yu}`,xw=`${zf}-${Wf}`,Ia=class{constructor(e){we(this,"name","TaskAbortError");we(this,"message");this.code=e,this.message=`${bw} ${Yu} (reason: ${e})`}},Xu=(e,t)=>{if(typeof e!="function")throw new TypeError(st(32))},wa=()=>{},Kf=(e,t=wa)=>(e.catch(t),e),Yf=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Hr=(e,t)=>{let r=e.signal;r.aborted||("reason"in r||Object.defineProperty(r,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))},zr=e=>{if(e.aborted){let{reason:t}=e;throw new Ia(t)}};function Xf(e,t){let r=wa;return new Promise((n,o)=>{let i=()=>o(new Ia(e.reason));if(e.aborted){i();return}r=Yf(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=wa})}var Cw=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof Ia?"cancelled":"rejected",error:r}}finally{t?.()}});return function Cw(_x5,_x6){return _ref5.apply(this,arguments)}}(),xa=e=>t=>Kf(Xf(e,t).then(r=>(zr(e),r))),Jf=e=>{let t=xa(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Un}=Object,Lf={},Ta="listenerMiddleware",Ew=(e,t)=>{let r=n=>Yf(e,()=>Hr(n,e.reason));return(n,o)=>{Xu(n,"taskExecutor");let i=new l.AbortController;r(i);let a=Cw(/*#__PURE__*/_asyncToGenerator(function*(){zr(e),zr(i.signal);let s=yield n({pause:xa(i.signal),delay:Jf(i.signal),signal:i.signal});return zr(i.signal),s}),()=>Hr(i,ww));return o?.autoJoin&&t.push(a.catch(wa)),{result:xa(e)(a),cancel(){Hr(i,Aw)}}}},Rw=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){zr(t);let i=()=>{},s=[new Promise((c,u)=>{let h=e({predicate:n,effect:(v,S)=>{S.unsubscribe(),c([v,S.getState(),S.getOriginalState()])}});i=()=>{h(),u()}})];o!=null&&s.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Xf(t,Promise.race(s));return zr(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Kf(r(n,o))},Zf=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(st(21));return Xu(i,"options.listener"),{predicate:o,type:t,effect:i}},em=Un(e=>{let{type:t,predicate:r,effect:n}=Zf(e);return{id:fi(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(st(22))}}},{withTypes:()=>em}),Vf=(e,t)=>{let{type:r,effect:n,predicate:o}=Zf(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Ku=e=>{e.pending.forEach(t=>{Hr(t,Wu)})},Iw=e=>()=>{e.forEach(Ku),e.clear()},Uf=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},tm=Un(P(`${Ta}/add`),{withTypes:()=>tm}),Tw=P(`${Ta}/removeAll`),rm=Un(P(`${Ta}/remove`),{withTypes:()=>rm}),_w=(...e)=>{console.error(`${Ta}/error`,...e)},nm=(e={})=>{let t=new Map,{extra:r,onError:n=_w}=e;Xu(n,"onError");let o=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),v=>{h.unsubscribe(),v?.cancelActive&&Ku(h)}),i=h=>{let v=Vf(t,h)??em(h);return o(v)};Un(i,{withTypes:()=>i});let a=h=>{let v=Vf(t,h);return v&&(v.unsubscribe(),h.cancelActive&&Ku(v)),!!v};Un(a,{withTypes:()=>a});let s=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,v,S,g){let y=new l.AbortController,x=Rw(i,y.signal),E=[];try{h.pending.add(y),yield Promise.resolve(h.effect(v,Un({},S,{getOriginalState:g,condition:(C,I)=>x(C,I).then(Boolean),take:x,delay:Jf(y.signal),pause:xa(y.signal),extra:r,signal:y.signal,fork:Ew(y.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((C,I,T)=>{C!==y&&(Hr(C,Wu),T.delete(C))})},cancel:()=>{Hr(y,Wu),h.pending.delete(y)},throwIfCancelled:()=>{zr(y.signal)}})))}catch(C){C instanceof Ia||Uf(n,C,{raisedBy:"effect"})}finally{yield Promise.all(E),Hr(y,xw),h.pending.delete(y)}});return function s(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),c=Iw(t);return{middleware:h=>v=>S=>{if(!jn(S))return v(S);if(tm.match(S))return i(S.payload);if(Tw.match(S)){c();return}if(rm.match(S))return a(S.payload);let g=h.getState(),y=()=>{if(g===Lf)throw new Error(st(23));return g},x;try{if(x=v(S),t.size>0){let E=h.getState(),C=Array.from(t.values());for(let I of C){let T=!1;try{T=I.predicate(S,E,g)}catch(_){T=!1,Uf(n,_,{raisedBy:"predicate"})}T&&s(I,S,h,y)}}}finally{g=Lf}return x},startListening:i,stopListening:a,clearListeners:c}};function st(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 X=new H({required:!0,emptyAllowed:!1}),Xe=new H({required:!1,emptyAllowed:!1}),Je=new H({required:!0,emptyAllowed:!0}),WF=new H({required:!1,emptyAllowed:!0}),_a=new ge({each:X,required:!0}),om=new H({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),im=new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),KF=new H({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Zt=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),At=(e,t)=>{if("required"in t)return{payload:new lt({value:t}).validate({value:e}).value};let o=new ee({options:{required:!0},values:t}).validate(e);if(o)throw new Xo(o);return{payload:e}},j=(e,t)=>{try{return At(e,t)}catch(r){return{payload:e,error:Zt(r)}}},am=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return cm(e,t,r,o,"Controller initialization error")},sm=(e,t,r,n)=>{let o=`Check the options of ${n}`;return cm(e,t,r,o,"Controller initialization error")},cm=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();f();p();var $n="3.47.1",um=["@coveo/atomic","@coveo/quantic"];var Ju=()=>Xe,lm=()=>X,gr=P("configuration/updateBasicConfiguration",e=>j(e,{accessToken:Xe,environment:new H({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:Xe})),Lt=P("configuration/updateSearchConfiguration",e=>j(e,{proxyBaseUrl:new H({required:!1,url:!0}),pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:Xe,timezone:Xe,locale:Xe,authenticationProviders:new ge({required:!1,each:X})})),kw={enabled:new ue({default:!0}),originContext:Ju(),originLevel2:Ju(),originLevel3:Ju(),proxyBaseUrl:new H({required:!1,url:!0}),runtimeEnvironment:new Oe,anonymous:new ue({default:!1}),deviceId:Xe,userDisplayName:Xe,documentLocation:Xe,trackingId:im,analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new ee({options:{required:!1},values:um.reduce((e,t)=>(e[t]=om,e),{})})},Qn=P("configuration/updateAnalyticsConfiguration",e=>j(e,kw)),Hn=P("configuration/analytics/disable"),zn=P("configuration/analytics/enable"),ka=P("configuration/analytics/originlevel2",e=>j(e,{originLevel2:lm()})),Oa=P("configuration/analytics/originlevel3",e=>j(e,{originLevel3:lm()})),dm=P("knowledge/setAgentId",e=>j(e,new H({required:!0})));m();d();f();p();m();d();f();p();m();d();f();p();var pm={q:new H,enableQuerySyntax:new ue,aq:new H,cq:new H,firstResult:new te({min:0}),numberOfResults:new te({min:0}),sortCriteria:new H,f:new ee,fExcluded:new ee,cf:new ee,nf:new ee,mnf:new ee,df:new ee,debug:new ue,sf:new ee,tab:new H,af:new ee};var hr=P("searchParameters/restore",e=>j(e,pm)),fm=P("searchParameters/restoreTab",e=>j(e,X));m();d();f();p();var Pa=P("debug/enable"),Na=P("debug/disable");m();d();f();p();var Fa=()=>!1;var Da=Me(Fa(),e=>{e.addCase(Pa,()=>!0).addCase(Na,()=>!1).addCase(hr,(t,r)=>r.payload.debug??t)});m();d();f();p();var Wn=P("pipeline/set",e=>j(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();m();d();f();p();var Ow=P("history/undo"),Pw=P("history/redo"),Vt=P("history/snapshot"),oM=Ee("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Ow()),yield t(mt())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),iM=Ee("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(Pw()),yield t(mt())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),mt=Ee("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();f();p();var Kn=()=>"";var Yn=Me(Kn(),e=>{e.addCase(Wn,(t,r)=>r.payload).addCase(mt.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Lt,(t,r)=>r.payload.pipeline||t)});m();d();f();p();m();d();f();p();var Ma=P("app/setError");m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Xn=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(s)||u.test(s)||s.indexOf(".")===-1?Zu(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Zu(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Zu(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();f();p();function Nw(){return typeof navigator<"u"}function mm(){try{return typeof localStorage<"u"}catch{return!1}}function gm(){try{return typeof sessionStorage<"u"}catch{return!1}}function hm(){return!!(Nw()&&navigator.cookieEnabled)}var ym=null;function vm(){return ym||(mm()?localStorage:hm()?new el:gm()?sessionStorage:new tl)}var Jn=class Jn{getItem(t){return Xn.get(`${Jn.prefix}${t}`)}removeItem(t){Xn.erase(`${Jn.prefix}${t}`)}setItem(t,r,n){Xn.set(`${Jn.prefix}${t}`,r,n)}};we(Jn,"prefix","coveo_");var el=Jn;var tl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ja="__coveo.analytics.history",Fw=20,Dw=1e3*60,Mw=75,Yr=class Yr{constructor(t){we(this,"store");this.store=t||vm()}static getInstance(t){return Yr.instance||(Yr.instance=new Yr(t)),Yr.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!==null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ja);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ja);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ja,JSON.stringify(t.slice(0,Fw)))}catch{}}clear(){try{this.store.removeItem(ja)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Mw)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>Dw:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};we(Yr,"instance",null);var rl=Yr,wt=rl;m();d();f();p();m();d();f();p();var Zn=Ve(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${$n}`));m();d();f();p();m();d();f();p();function er(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function M(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function il(){return typeof window<"u"}function vl(){return typeof navigator<"u"}function eo(){return typeof document<"u"}function al(){try{return typeof localStorage<"u"}catch{return!1}}function jw(){try{return typeof sessionStorage<"u"}catch{return!1}}function Pm(){return vl()&&navigator.cookieEnabled}var qw=[ve.click,ve.custom,ve.search,ve.view],Lw=(e,t)=>qw.indexOf(e)!==-1?Object.assign({language:eo()?document.documentElement.lang:"unknown",userAgent:vl()?navigator.userAgent:"unknown"},t):t,gi=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?Sm(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Sm(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Sm(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function Vw(){return al()?localStorage:Pm()?new hi:jw()?sessionStorage:new ro}var hi=class e{getItem(t){return gi.get(`${e.prefix}${t}`)}removeItem(t){gi.erase(`${e.prefix}${t}`)}setItem(t,r,n){gi.set(`${e.prefix}${t}`,r,n)}};hi.prefix="coveo_";var sl=class{constructor(){this.cookieStorage=new hi}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},ro=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},qa="__coveo.analytics.history",Uw=20,Bw=1e3*60,Gw=75,Ua=class{constructor(t){this.store=t||Vw()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return M(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return M(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(qa);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return M(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(qa);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(qa,JSON.stringify(t.slice(0,Uw)))}catch{}}clear(){try{this.store.removeItem(qa)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Gw)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Bw:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var $w=(e,t)=>M(void 0,void 0,void 0,function*(){return e===ve.view?(yield Qw(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Qw=e=>M(void 0,void 0,void 0,function*(){let t=new Ua,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),La,Hw=new Uint8Array(16);function zw(){if(!La&&(La=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!La))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return La(Hw)}var Ww=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ba(e){return typeof e=="string"&&Ww.test(e)}var Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function Nm(e,t=0){return Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]}function Kw(e){if(!Ba(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function Yw(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Xw="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Jw="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Zw(e,t,r){function n(o,i,a,s){var c;if(typeof o=="string"&&(o=Yw(o)),typeof i=="string"&&(i=Kw(i)),((c=i)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+o.length);if(u.set(i),u.set(o,i.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,a){s=s||0;for(let h=0;h<16;++h)a[s+h]=u[h];return a}return Nm(u)}try{n.name=e}catch{}return n.DNS=Xw,n.URL=Jw,n}var ex=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),bm={randomUUID:ex};function Xr(e,t,r){if(bm.randomUUID&&!t&&!e)return bm.randomUUID();e=e||{};let n=e.random||(e.rng||zw)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Nm(n)}function tx(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function nl(e,t){return e<<t|e>>>32-t}function rx(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let c=0;c<16;++c)s[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];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let g=0;g<16;++g)s[g]=i[a][g];for(let g=16;g<80;++g)s[g]=nl(s[g-3]^s[g-8]^s[g-14]^s[g-16],1);let c=r[0],u=r[1],h=r[2],v=r[3],S=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),x=nl(c,5)+tx(y,u,h,v)+S+t[y]+s[g]>>>0;S=v,v=h,h=nl(u,30)>>>0,u=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+S>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var nx=Zw("v5",80,rx),Am=nx,Fm="2.30.52",wm=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,mi={pageview:"pageview",event:"event"},Ga=class{constructor({client:t,uuidGenerator:r=Xr}){this.client=t,this.uuidGenerator=r}},cl=class extends Ga{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=wm(window.location),this.lastReferrer=eo()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:eo()?document.title:"",encoding:eo()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===mi.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===mi.pageview?this.nextPageViewId:this.pageViewId,referrer:t===mi.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===mi.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return wm(window.location)}},yr=class e{constructor(t,r){if(!Ba(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Ba(i)?new e(i,Number.parseInt(o)*1e3):null}};yr.cvo_cid="cvo_cid";yr.expirationTime=120;var ul=class extends Ga{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return M(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(yr.cvo_cid,new yr(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ul.Id="link";var Ct=Object.keys;function Va(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ol=128,Dm=192,xm=224,Cm=240;function ox(e){return(e&248)===Cm?4:(e&Cm)===xm?3:(e&xm)===Dm?2:1}function ix(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&ol)!=ol)break;if(r-=3,(n&Dm)!=ol){t-r>=ox(n)*3&&(r=t);break}}return e.substring(0,r)}var ll={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"},ax=Ct(ll).map(e=>ll[e]),sx=[...ax].join("|"),cx=new RegExp(`^(${sx}$)`),ux={svcAction:"svc_action",svcActionData:"svc_action_data"},lx=e=>Ct(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ll[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),dx=e=>cx.test(e),px=[dx],Em={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},Rm={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},ot={action:"pa",list:"pal",listSource:"pls"},$a={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},fx=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],dl={id:"quoteId",affiliation:"quoteAffiliation"},pl={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},mx={add:ot,bookmark_add:ot,bookmark_remove:ot,click:ot,checkout:ot,checkout_option:ot,detail:ot,impression:ot,remove:ot,refund:Object.assign(Object.assign({},ot),$a),purchase:Object.assign(Object.assign({},ot),$a),quickview:ot,quote:Object.assign(Object.assign({},ot),dl),review:Object.assign(Object.assign({},ot),pl)},gx=Ct(Em).map(e=>Em[e]),hx=Ct(Rm).map(e=>Rm[e]),yx=Ct(ot).map(e=>ot[e]),vx=Ct($a).map(e=>$a[e]),Sx=Ct(pl).map(e=>pl[e]),bx=Ct(dl).map(e=>dl[e]),Ax=[...gx,"custom"].join("|"),wx=[...hx,"custom"].join("|"),Mm="(pr[0-9]+)",jm="(il[0-9]+pi[0-9]+)",xx=new RegExp(`^${Mm}(${Ax})$`),Cx=new RegExp(`^(${jm}(${wx}))|(il[0-9]+nm)$`),Ex=new RegExp(`^(${yx.join("|")})$`),Rx=new RegExp(`^(${vx.join("|")})$`),Ix=new RegExp(`^${Mm}custom$`),Tx=new RegExp(`^${jm}custom$`),_x=new RegExp(`^(${[...fx,...Sx,...bx].join("|")})$`),kx=e=>xx.test(e),Ox=e=>Cx.test(e),Px=e=>Ex.test(e),Nx=e=>Rx.test(e),Fx=e=>_x.test(e),Dx=[Ox,kx,Px,Nx,Fx],Mx=[Ix,Tx],jx={anonymizeIp:"aip"},qx={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Lx={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Vx=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Ux=Object.assign(Object.assign(Object.assign(Object.assign({},jx),qx),Lx),Vx.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),fl=Object.assign(Object.assign({},Ux),ux),Bx=e=>{let t=!!e.action&&mx[e.action]||{};return Ct(e).reduce((r,n)=>{let o=t[n]||fl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Gx=Ct(fl).map(e=>fl[e]),$x=e=>Gx.indexOf(e)!==-1,Qx=e=>e==="custom",Hx=e=>[...Dx,...px,$x,Qx].some(t=>t(e)),zx=e=>Ct(e).reduce((t,r)=>{let n=Wx(r);return n?Object.assign(Object.assign({},t),Kx(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Wx=e=>{let t;return[...Mx].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Kx=(e,t)=>Ct(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ml=class{constructor(t){this.opts=t}sendEvent(t,r){return M(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,s),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return M(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:c}=a;o=s||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return M(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},gl=class{sendEvent(t,r){return M(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return M(this,void 0,void 0,function*(){return Promise.resolve()})}},Im=b.fetch,Qa=class{constructor(t){this.opts=t}sendEvent(t,r){return M(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:u}=c,h=er(c,["url"]),v;try{v=yield Im(u,h)}catch(S){console.error("An error has occured when sending the event.",S);return}if(v.ok){let S=yield v.json();return S.visitorId&&o.setCurrentVisitorId(S.visitorId),S}else{try{v.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,v,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return M(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield Im(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return M(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},hl=class{constructor(t,r){al()&&Pm()?this.storage=new sl:al()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ro),this.client=new Qa(t),this.beaconClient=new ml(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},yl=class{constructor(t,r){this.storage=r||new ro,this.client=new Qa(t)}getClientDependingOnEventType(t){return this.client}},Ha=class{constructor(){this.storage=new ro,this.client=new gl}getClientDependingOnEventType(t){return this.client}},Yx="xx",Xx=e=>e?.startsWith(Yx)||!1,Jx=`
27
27
  We've detected you're using React Native but have not provided the corresponding runtime,
28
28
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
29
29
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
30
- `;function Wx(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var Kx=["1",1,"yes",!0];function Wa(){let e=[];return ol()&&e.push(window.doNotTrack),yl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>Kx.indexOf(t)!==-1)}var qm="v15",jm={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function Yx(e=jm.default,t=qm,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var Xx="38824e1f-37f5-42d3-8372-a4b8fa9df946",Ut=class{get defaultOptions(){return{endpoint:jm.default,isCustomEndpoint:!1,token:"",version:qm,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Nm}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=[Lw,Fw].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Wa()?this.runtime=new za:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return ol()&&eo()?new gl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(Wx()&&console.warn(zx),new hl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return M(this,void 0,void 0,function*(){try{return ol()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return M(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return M(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return M(this,void 0,void 0,function*(){if($a(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(bm(t,bm(r,Xx)))}})}getParameters(t,...r){return M(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return M(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Wa())return null;try{let r=new URL(t).searchParams.get(yr.cvo_cid);if(r==null)return null;let n=yr.fromString(r);return!n||!eo()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return M(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>M(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>M(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>i?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,x)=>M(this,void 0,void 0,function*(){let E=yield y;return yield x(t,E)}),g)].reduce((g,y)=>M(this,void 0,void 0,function*(){let x=yield g;return yield y(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return M(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?qx(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>M(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return M(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>M(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return M(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return M(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Ba().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return M(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=er(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return M(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=er(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return M(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=er(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return M(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return M(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return M(this,void 0,void 0,function*(){return yield(yield A(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[ve.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(Ux(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=er(t,["custom"]),o={};r&&Ua(r)&&(o=this.lowercaseKeys(r));let i=Bx(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=er(t,["custom"]);if(r&&Ua(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=er(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=er(t,["userId"]);return Hx(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=er(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Ua(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Ua(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?ex(t,r):t}get baseUrl(){return Yx(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},tr;(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"})(tr||(tr={}));var L;(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.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.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(L||(L={}));var Im={[L.triggerNotify]:"queryPipelineTriggers",[L.triggerExecute]:"queryPipelineTriggers",[L.triggerQuery]:"queryPipelineTriggers",[L.triggerRedirect]:"queryPipelineTriggers",[L.queryErrorBack]:"errors",[L.queryErrorClear]:"errors",[L.queryErrorRetry]:"errors",[L.pagerNext]:"getMoreResults",[L.pagerPrevious]:"getMoreResults",[L.pagerNumber]:"getMoreResults",[L.pagerResize]:"getMoreResults",[L.pagerScrolling]:"getMoreResults",[L.facetSearch]:"facet",[L.facetShowLess]:"facet",[L.facetShowMore]:"facet",[L.recommendation]:"recommendation",[L.likeSmartSnippet]:"smartSnippet",[L.dislikeSmartSnippet]:"smartSnippet",[L.expandSmartSnippet]:"smartSnippet",[L.collapseSmartSnippet]:"smartSnippet",[L.openSmartSnippetFeedbackModal]:"smartSnippet",[L.closeSmartSnippetFeedbackModal]:"smartSnippet",[L.sendSmartSnippetReason]:"smartSnippet",[L.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.clearRecentQueries]:"recentQueries",[L.recentResultClick]:"recentlyClickedDocuments",[L.clearRecentResults]:"recentlyClickedDocuments",[L.showLessFoldedResults]:"folding",[L.caseDetach]:"case",[L.likeGeneratedAnswer]:"generatedAnswer",[L.dislikeGeneratedAnswer]:"generatedAnswer",[L.openGeneratedAnswerSource]:"generatedAnswer",[L.generatedAnswerStreamEnd]:"generatedAnswer",[L.generatedAnswerSourceHover]:"generatedAnswer",[L.generatedAnswerCopyToClipboard]:"generatedAnswer",[L.generatedAnswerHideAnswers]:"generatedAnswer",[L.generatedAnswerShowAnswers]:"generatedAnswer",[L.generatedAnswerExpand]:"generatedAnswer",[L.generatedAnswerCollapse]:"generatedAnswer",[L.generatedAnswerFeedbackSubmit]:"generatedAnswer",[L.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[tr.expandToFullUI]:"interface",[tr.openUserActions]:"User Actions",[tr.showPrecedingSessions]:"User Actions",[tr.showFollowingSessions]:"User Actions",[tr.clickViewedDocument]:"User Actions",[tr.clickPageView]:"User Actions",[tr.createArticle]:"createArticle"},no=class{constructor(){this.runtime=new za,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Nm}};function Jx(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function Zx(e){return e.map(t=>t.replace(/;/g,""))}function Lm(e){let r=e.join(";");return r.length<=256?r:Lm(e.slice(1))}var Tm=e=>{let t=Zx(e),r=Jx(t);return Lm(r)};function _m(e){let t=typeof e.partialQueries=="string"?e.partialQueries:Tm(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:Tm(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Ka=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Wa();this.coveoAnalyticsClient=n?new no:new Ut(t)}disable(){this.coveoAnalyticsClient=new no}enable(){this.coveoAnalyticsClient=new Ut(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(L.interfaceLoad)}logInterfaceLoad(){return M(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(L.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(L.recommendation)}logRecommendation(){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(L.recommendationOpen,t,r)}logRecommendationOpen(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(L.staticFilterClearAll,t)}logStaticFilterClearAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(L.staticFilterSelect,t)}logStaticFilterSelect(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(L.staticFilterDeselect,t)}logStaticFilterDeselect(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(L.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return M(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(L.interfaceChange,t)}logInterfaceChange(t){return M(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(L.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return M(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(L.didyoumeanClick)}logDidYouMeanClick(){return M(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(L.resultsSort,t)}logResultsSort(t){return M(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(L.searchboxSubmit)}logSearchboxSubmit(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(L.searchboxClear)}logSearchboxClear(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(L.searchboxAsYouType)}logSearchboxAsYouType(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(L.breadcrumbFacet,t)}logBreadcrumbFacet(t){return M(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(L.breadcrumbResetAll)}logBreadcrumbResetAll(){return M(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(L.documentQuickview,t,r)}logDocumentQuickview(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(L.documentOpen,t,r)}logDocumentOpen(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(L.omniboxAnalytics,_m(t))}logOmniboxAnalytics(t){return M(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(L.omniboxFromLink,_m(t))}logOmniboxFromLink(t){return M(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(L.searchFromLink)}logSearchFromLink(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(L.triggerNotify,t)}logTriggerNotify(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(L.triggerExecute,t)}logTriggerExecute(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(L.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(L.undoTriggerQuery,t)}logUndoTriggerQuery(t){return M(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(L.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(L.pagerResize,t)}logPagerResize(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(L.pagerNumber,t)}logPagerNumber(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(L.pagerNext,t)}logPagerNext(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(L.pagerPrevious,t)}logPagerPrevious(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(L.pagerScrolling)}logPagerScrolling(){return M(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(L.facetClearAll,t)}logFacetClearAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(L.facetSearch,t)}logFacetSearch(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(L.facetSelect,t)}logFacetSelect(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(L.facetDeselect,t)}logFacetDeselect(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(L.facetExclude,t)}logFacetExclude(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(L.facetUnexclude,t)}logFacetUnexclude(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(L.facetSelectAll,t)}logFacetSelectAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(L.facetUpdateSort,t)}logFacetUpdateSort(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(L.facetShowMore,t)}logFacetShowMore(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(L.facetShowLess,t)}logFacetShowLess(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(L.queryError,t)}logQueryError(t){return M(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorBack);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorBack)})}})}logQueryErrorBack(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorRetry);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorRetry)})}})}logQueryErrorRetry(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorClear);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorClear)})}})}logQueryErrorClear(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(L.likeSmartSnippet)}logLikeSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(L.dislikeSmartSnippet)}logDislikeSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(L.expandSmartSnippet)}logExpandSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(L.collapseSmartSnippet)}logCollapseSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(L.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(L.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return M(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(L.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(L.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(L.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(L.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(L.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(L.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(L.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(L.copyToClipboard,t,r)}logCopyToClipboard(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(L.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(L.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(L.recentQueryClick)}logRecentQueryClick(){return M(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(L.clearRecentQueries)}logClearRecentQueries(){return M(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(L.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(L.clearRecentResults)}logClearRecentResults(){return M(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(L.noResultsBack)}logNoResultsBack(){return M(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(L.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(L.showLessFoldedResults)}logShowLessFoldedResults(){return M(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return M(this,arguments,void 0,function*(n,o,i=Im[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return M(this,arguments,void 0,function*(n,o,i=Im[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return M(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return M(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return M(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return M(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return M(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Ut?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(L.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(L.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(L.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return M(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(L.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(L.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(L.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(L.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(L.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(L.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(L.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(L.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(L.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(L.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(L.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return M(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(L.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ya=Object.assign({},gi),km=Object.keys(Ya).map(e=>Ya[e]),to=class extends sl{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);if(r!==null)return r;switch(t){case"setTicket":return this.setTicket;default:return null}}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>km.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(km.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ya.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ya.event,{newEventType:ve.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return ix(this.ticket)}};to.Id="svc";var Xa;(function(e){e.click="click",e.flowStart="flowStart"})(Xa||(Xa={}));var xt;(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"})(xt||(xt={}));var Ja;(function(e){e.quit="Quit",e.solved="Solved"})(Ja||(Ja={}));var Za=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Wa();this.coveoAnalyticsClient=o?new Ut(t):new no,this.svc=new to({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new no,this.svc=new to({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Ut(this.options),this.svc=new to({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(xt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(xt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(xt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(xt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(xt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(xt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(xt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(xt.caseCancelled,{reason:Ja.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(xt.caseSolved,{reason:Ja.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(xt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Xa.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Xa.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return M(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Ut?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var Vm=e=>new Ut(e).getCurrentVisitorId(),vi=(e,t)=>typeof t=="function"?(...r)=>{let n=Zo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Si=(e,t)=>(...r)=>{let n=Zo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();function es(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();p();f();m();d();p();f();m();d();p();f();function Um(e){let{activeValue:t,ancestryMap:r}=eC(e);return t?tC(t,r):[]}function eC(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function tC(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var rC=(e,t)=>e.categoryFacetSet[t]?.request;var bl=(e,t)=>{let r=rC(e,t);return Um(r?.currentValues??[])};m();d();p();f();function ts(){return{}}m();d();p();f();function rs(){return{}}m();d();p();f();function ns(){return{}}m();d();p();f();function os(){return{}}function Al(e){return{facetSet:e.facetSet??os(),categoryFacetSet:e.categoryFacetSet??ts(),dateFacetSet:e.dateFacetSet??rs(),numericFacetSet:e.numericFacetSet??ns(),automaticFacetSet:e.automaticFacetSet??es()}}var wl=e=>{let t=[];return iC(e).forEach((r,n)=>{let o=pC(e,r.facetId),i=dC(r,n+1);if(oC(r)){if(!!!bl(e,r.facetId).length)return;t.push({...i,...uC(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let c=Bm(a,s+1,o),u=nC(r)?$m(a):sC(a);t.push({...i,...c,...u})})}),aC(e).forEach((r,n)=>{let o=lC(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Bm(i,a+1,"specific"),c=$m(i);t.push({...o,...s,...c})})}),t},nC=e=>e.type==="specific",oC=e=>e.type==="hierarchical",iC=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),aC=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Bm=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),sC=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),$m=e=>({displayValue:e.value,value:e.value}),cC=(e,t)=>bl(e,t).map(n=>n.value).join(";"),uC=(e,t)=>{let n=cC(e,t);return{value:n,valuePosition:1,displayValue:n}},lC=(e,t)=>({title:Gm(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),dC=(e,t)=>({title:Gm(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Gm=(e,t)=>`${e}_${t}`,fC=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,pC=(e,t)=>{let r=fC(e,t);return r?r.type:"specific"};m();d();p();f();m();d();p();f();var xl=e=>e.configuration.search.locale,Qm=e=>e.configuration.search.timezone,Hm=e=>e.configuration.accessToken,zm=e=>e.configuration.organizationId,Wm=e=>e.configuration.environment,is=e=>e.configuration?.knowledge?.agentId;var Jr=e=>{if(mC(e)||Cl(e))return e.generatedAnswer?.answerId;if(gC(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},mC=e=>"answer"in e&&"generatedAnswer"in e&&!ie(e.generatedAnswer?.answerConfigurationId),Cl=e=>{let t=is(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},gC=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",El=e=>e.generatedAnswer?.fieldsToIncludeInCitations,hC=Ve(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));m();d();p();f();var St=()=>({q:"",enableQuerySyntax:!1});m();d();p();f();m();d();p();f();var Km=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Km||{}),Ym=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Ym||{}),Rl=e=>{if(Qf(e))return e.map(t=>Rl(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""}},Xm=()=>({by:"relevancy"});var Hj=new ee({values:{by:new bu({enum:Ym,required:!0}),order:new bu({enum:Km}),field:new H}});function as(){return Rl(Xm())}m();d();p();f();m();d();p();f();var oo=()=>"default";var yC=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},rr=class{constructor(t){this.getState=t;we(this,"state");this.state=t()}getLanguage(){return yC(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Gn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||oo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var bi=class bi extends rr{constructor(){super(...arguments);we(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return wl(Al(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||bi.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Mt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||bi.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Jr(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??as()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(u=>u.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",c=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:c}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||St().q}get responseTime(){return this.state.search?.duration||Mt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Mt().response.totalCountFiltered}};we(bi,"fallbackPipelineName","default");var vr=bi,Jm=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),c=i.configuration.analytics.runtimeEnvironment,u=i.configuration.analytics.enabled,h=new Ka({token:a,endpoint:s,runtimeEnvironment:c,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(v,S)=>(e.info({...S,type:v,endpoint:s,token:a},"Analytics request"),S)]},o);return u||h.disable(),h},Il=()=>{let t=wt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var ss=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Vm(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Il()&&{pageId:Il()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Zn(e)})}}});return function ss(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();p();f();m();d();p();f();m();d();p();f();var io=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var Ai=class extends rr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:St().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||io().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||io().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||io().recommendations.length}};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 Zm=/^(?:[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 vC(e){return typeof e=="string"&&Zm.test(e)}var Tl=vC;m();d();p();f();var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function eg(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()}m();d();p();f();var _l,SC=new Uint8Array(16);function kl(){if(!_l){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_l=crypto.getRandomValues.bind(crypto)}return _l(SC)}m();d();p();f();m();d();p();f();var bC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ol={randomUUID:bC};function AC(e,t,r){e=e||{};let n=e.random??e.rng?.()??kl();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return eg(n)}function wC(e,t,r){return Ol.randomUUID&&!t&&!e?Ol.randomUUID():AC(e,t,r)}var Pl=wC;m();d();p();f();function tg(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}function xC({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;a!=="disabled"&&(n.call(r),t.send(o,i,r))}var rg="visitorId";function CC(e){return{getClientId:()=>{let t=e.get(),r=t.storage,n=r.getItem(rg),o=n&&Tl(n)?n:t.generateUUID();return r.setItem(rg,o),o}}}var sg="1.2.15",Nl=128,cg=192,ng=224,og=240,EC=248;function RC(e){return(e&EC)===og?4:(e&og)===ng?3:(e&ng)===cg?2:1}function IC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Nl)!=Nl)break;if(r-=3,(n&cg)!=Nl){t-r>=RC(n)*3&&(r=t);break}}return e.substring(0,r)}function TC(e){let{trackingId:t}=e;return{trackingId:t}}function _C(e){return(e.source||[]).concat([`relay@${sg}`])}function ug(e,t,r,n){let{getReferrer:o,getLocation:i,getUserAgent:a}=r,s=TC(t),c=n.getClientId();return Object.freeze({type:e,config:s,ts:Date.now(),source:_C(t),clientId:c,userAgent:a(),referrer:ig(o()),location:ig(i())})}function ig(e){return e!==null?IC(e,1024):null}function kC(e,t,r,n,o){return{...t,meta:ug(e,r,n,o)}}var OC="*";function PC(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>s(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function i(c){if(c===OC)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function a(c){let u=t(c);u>=0&&e.splice(u,1)}function s(c,u){u?a({type:c,callback:u}):i(c)}return{add:n,call:o,remove:s}}function ag({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function NC(e){let t=ag(e);return{get:()=>t,update:r=>{t=ag({...t,...r})}}}var Fl=FC();function FC(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function DC(){return{getItem(e){return Fl.getItem(e)||localStorage.getItem(e)},removeItem(e){Fl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Fl.setItem(e,t,31556952e3)}}}function MC(){let e=document.referrer;return e===""?null:e}function Dl(){return{runtime:"browser",send:(e,t,r)=>{let n=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([r])],{type:"application/json"}));if(tg().sendMessage({kind:"EVENT_PROTOCOL",event:r,url:e,token:t}),!n)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>MC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>Pl(),storage:DC()}}function qC(){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 jC(){return{getItem(){return null},removeItem(){},setItem(){}}}function LC(){return{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:jC()}}function VC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=LC();return t&&r?{storage:n.storage,...r,runtime:"custom"}:t&&UC()&&qC()?Dl():n}function UC(){try{return typeof window=="object"}catch{return!1}}function BC(e){return{get:()=>Object.freeze(VC(e))}}function lg(e){let t=NC(e),r=PC(),n=BC(t),o=CC(n);return{emit:(i,a)=>{let s=t.get(),c=n.get(),u=kC(i,a,s,c,o);return xC({config:s,environment:c,event:u,listenerManager:r})},getMeta:i=>ug(i,t.get(),n.get(),o),on:(i,a)=>r.add({type:i,callback:a}),off:(i,a)=>r.remove(i,a),updateConfig:i=>t.update(i),version:sg}}m();d();p();f();function dg(){return typeof window<"u"&&typeof document<"u"}var wi=Ve(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Zn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let c=GC(s);return lg({mode:i?"emit":"disabled",url:o??ca(e,t),token:r,trackingId:n??null,source:a,environment:c})}),$C={generateUUID:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:()=>{},storage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}},GC=e=>{if(!e)return;let t=e();return{...(dg()?Dl():$C),generateUUID:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();p();f();var xi=class extends rr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},fg=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new xi(t)})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),c=i.configuration.analytics.runtimeEnvironment,u=i.configuration.analytics.enabled,h=new Za({enableAnalytics:u,token:a,endpoint:s,runtimeEnvironment:c,preprocessRequest:vi(e,n),beforeSendHooks:[Si(e,r),(v,S)=>(e.info({...S,type:v,endpoint:s,token:a},"Analytics request"),S)]},o);return u||h.disable(),h};m();d();p();f();m();d();p();f();function pg(e,t){return{...new vr(t).getBaseMetadata(),actionCause:e,type:e}}function QC(e){return Object.assign(e,{instantlyCallable:!0})}function HC(e,t){let r=i=>QC(Ee(e,i)),n=r(/*#__PURE__*/function(){var _ref11=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=s;return yield(yield t({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:a(),extra:s})});return function(_x19,_x20){return _ref11.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref12=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c}){let{description:u,log:h}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x22,_x23){return _ref13.apply(this,arguments)}}())}});return function prepare(_x21){return _ref12.apply(this,arguments)}}()}),n}var mg=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return KC(i)}return n},zC=e=>e.configuration.analytics.analyticsMode==="legacy",WC=e=>e.configuration.analytics.analyticsMode==="next",KC=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),HC(e,/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref15=_asyncToGenerator(function*({state:C}){for(let I of v)yield I(C)});return function log(_x25){return _ref15.apply(this,arguments)}}()},g=s(),y=i({getState:s,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(s)}),x=yield t(y,s());S.description=x?.description,v.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(C){zC(C)&&(yield YC(x,r,C,h,y.coveoAnalyticsClient))});return function(_x26){return _ref16.apply(this,arguments)}}());let{emit:E}=wi(g);return v.push(/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*(C){if(WC(C)&&o&&n){let I=n(C);yield nE(E,o,I)}});return function(_x27){return _ref17.apply(this,arguments)}}()),S});return function(_x24){return _ref14.apply(this,arguments)}}()));function YC(_x28,_x29,_x30,_x31,_x32){return _YC.apply(this,arguments)}function _YC(){_YC=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _YC.apply(this,arguments)}var XC=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref18=_asyncToGenerator(function*(i){r(n,o)});return function log(_x33){return _ref18.apply(this,arguments)}}()}),ct=mg(e=>Jm({...e,provider:e.provider||new vr(e.getState)}),e=>e,vr),r1=mg(fg,XC("caseAssist"),xi);var Ml=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return JC(e,r,t)};function JC(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:tE(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:rE(e),queryPipeline:r.pipeline||Kn()}}var cs=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||""}),gg={urihash:new H,sourcetype:new H,permanentid:new H},hg={uniqueId:X,raw:new ee({values:gg}),title:X,uri:X,clickUri:X,rankingModifier:new H({required:!1,emptyAllowed:!0})};function ZC(e){return Object.assign({},...Object.keys(gg).map(t=>({[t]:e[t]})))}function eE(e){return Object.assign({},...Object.keys(hg).map(t=>({[t]:e[t]})),{raw:ZC(e.raw)})}function tE(e){let t=e.raw.author;return ie(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function rE(e){let t=e.raw.source;return ie(t)?"unknown":t}var ql=e=>new lt(hg).validate(eE(e));function nE(_x34,_x35,_x36){return _nE.apply(this,arguments)}function _nE(){_nE=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _nE.apply(this,arguments)}m();d();p();f();var yg=()=>ct("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new Ai(e)),vg=()=>({actionCause:"recommendationInterfaceLoad"}),ls=e=>ct({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(ql(e),t.makeRecommendationOpen(Ml(e,r),cs(e))),__legacy__provider:t=>new Ai(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=Ml(e,t),n=cs(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var ao=P("recommendation/set",e=>q(e,{id:X})),Sr=Ee("recommendation/get",/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield oE(o),s=yield n.recommendations(a),c=Date.now()-i;return dt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:yg(),duration:c,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x37,_x38){return _ref19.apply(this,arguments)}}()),oE=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?wt.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield iE(e,vg()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function oE(_x39){return _ref20.apply(this,arguments)}}(),iE=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield ss(e.configuration.analytics,r)});return function iE(_x40,_x41){return _ref21.apply(this,arguments)}}();var so=Me(io(),e=>{e.addCase(ao,(t,r)=>{t.id=r.payload.id}).addCase(Sr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Sr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Sr.pending,t=>{t.isLoading=!0}).addCase(qa,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();p();f();var co=P("searchHub/set",e=>q(e,new H({required:!0,emptyAllowed:!0})));m();d();p();f();var uo=Me(oo(),e=>{e.addCase(co,(t,r)=>r.payload).addCase(mt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Lt,(t,r)=>r.payload.searchHub||t)});m();d();p();f();m();d();p();f();m();d();p();f();function Sg(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var bg=qt;function Pg(e,t){if(e===t||!(bg(e)&&bg(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=Pg(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function lo(e){let t=0;for(let r in e)t++;return t}var Ag=e=>[].concat(...e);function aE(e){return new RegExp("(^|:)//").test(e)}function sE(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ps(e){return e!=null}function cE(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var uE=e=>e.replace(/\/$/,""),lE=e=>e.replace(/^\//,"");function dE(e,t){if(!e)return t;if(!t)return e;if(aE(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=uE(e),t=lE(t),`${e}${r}${t}`}function fE(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var wg=(...e)=>A(...e),pE=e=>e.status>=200&&e.status<=299,mE=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function xg(e){if(!qt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function Ng({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=wg,paramsSerializer:n,isJsonContentType:o=mE,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:c,validateStatus:u,...h}={}){return typeof A>"u"&&r===wg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(S,g,y){let{getState:x,extra:E,endpoint:C,forced:I,type:T}=g,_,{url:j,headers:N=new w(h.headers),params:k=void 0,responseHandler:O=c??"json",validateStatus:D=u??pE,timeout:V=s,...z}=typeof S=="string"?{url:S}:S,G,B=g.signal;V&&(G=new l.AbortController,g.signal.addEventListener("abort",G.abort),B=G.signal);let U={...h,signal:B,...z};N=new w(xg(N)),U.headers=(yield t(N,{getState:x,arg:S,extra:E,endpoint:C,forced:I,type:T,extraOptions:y}))||N;let Q=le=>typeof le=="object"&&(qt(le)||Array.isArray(le)||typeof le.toJSON=="function");if(!U.headers.has("content-type")&&Q(U.body)&&U.headers.set("content-type",i),Q(U.body)&&o(U.headers)&&(U.body=JSON.stringify(U.body,a)),k){let le=~j.indexOf("?")?"&":"?",he=n?n(k):new URLSearchParams(xg(k));j+=le+he}j=dE(e,j);let $=new Request(j,U);_={request:new Request(j,U)};let Y,ne=!1,fe=G&&setTimeout(()=>{ne=!0,G.abort()},V);try{Y=yield r($)}catch(le){return{error:{status:ne?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(le)},meta:_}}finally{fe&&clearTimeout(fe),G?.signal.removeEventListener("abort",G.abort)}let be=Y.clone();_.response=be;let de,pe="";try{let le;if(yield Promise.all([v(Y,O).then(he=>de=he,he=>le=he),be.text().then(he=>pe=he,()=>{})]),le)throw le}catch(le){return{error:{status:"PARSING_ERROR",originalStatus:Y.status,data:pe,error:String(le)},meta:_}}return D(Y,de)?{data:de,meta:_}:{error:{status:Y.status,data:de},meta:_}});return function(_x42,_x43,_x44){return _ref22.apply(this,arguments)}}());function v(_x45,_x46){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=o(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var fo=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function gE(){return _gE.apply(this,arguments)}function _gE(){_gE=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(o=>setTimeout(i=>o(i),n))});return _gE.apply(this,arguments)}function hE(e,t){throw Object.assign(new fo({error:e,meta:t}),{throwImmediately:!0})}var Cg={},yE=(e,t)=>(/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Cg).maxRetries,(o||Cg).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),c={maxRetries:a,backoff:gE,retryCondition:(h,v,{attempt:S})=>S<=a,...t,...o},u=0;for(;;)try{let h=yield e(r,n,o);if(h.error)throw new fo(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof fo)return h.value;throw h}if(h instanceof fo&&!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return h.value;yield c.backoff(u,c.maxRetries)}});return function(_x47,_x48,_x49){return _ref23.apply(this,arguments)}}()),Fg=Object.assign(yE,{fail:hE}),Bl=P("__rtkq/focused"),Dg=P("__rtkq/unfocused"),$l=P("__rtkq/online"),Mg=P("__rtkq/offline");function Gl(e){return e.type==="query"}function vE(e){return e.type==="mutation"}function Ql(e){return e.type==="infinitequery"}function Hl(e,t,r,n,o,i){return SE(e)?e(t,r,n,o).filter(ps).map(Ll).map(i):Array.isArray(e)?e.map(Ll).map(i):[]}function SE(e){return typeof e=="function"}function Ll(e){return typeof e=="string"?{type:e}:e}function bE(e,t){return e.catch(t)}var Ei=Symbol("forceQueryFn"),Vl=e=>typeof e[Ei]=="function";function AE({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i}){let a=new Map,s=new Map,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:h}=o.internalActions;return{buildInitiateQuery:C,buildInitiateInfiniteQuery:I,buildInitiateMutation:T,getRunningQueryThunk:v,getRunningMutationThunk:S,getRunningQueriesThunk:g,getRunningMutationsThunk:y};function v(_,j){return N=>{let k=i.endpointDefinitions[_],O=e({queryArgs:j,endpointDefinition:k,endpointName:_});return a.get(N)?.[O]}}function S(_,j){return N=>s.get(N)?.[j]}function g(){return _=>Object.values(a.get(_)||{}).filter(ps)}function y(){return _=>Object.values(s.get(_)||{}).filter(ps)}function x(_){}function E(_,j){let N=(k,{subscribe:O=!0,forceRefetch:D,subscriptionOptions:V,[Ei]:z,...G}={})=>(B,U)=>{let Q=e({queryArgs:k,endpointDefinition:j,endpointName:_}),$,K={...G,type:"query",subscribe:O,forceRefetch:D,subscriptionOptions:V,endpointName:_,originalArgs:k,queryCacheKey:Q,[Ei]:z};if(Gl(j))$=t(K);else{let{direction:Ce,initialPageParam:De}=G;$=r({...K,direction:Ce,initialPageParam:De})}let Y=o.endpoints[_].select(k),ne=B($),fe=Y(U());let{requestId:be,abort:de}=ne,pe=fe.requestId!==be,le=a.get(B)?.[Q],he=()=>Y(U()),Le=Object.assign(z?ne.then(he):pe&&!le?Promise.resolve(fe):Promise.all([le,ne]).then(he),{arg:k,requestId:be,subscriptionOptions:V,queryCacheKey:Q,abort:de,unwrap(){return _asyncToGenerator(function*(){let Ce=yield Le;if(Ce.isError)throw Ce.error;return Ce.data})()},refetch:()=>B(N(k,{subscribe:!1,forceRefetch:!0})),unsubscribe(){O&&B(c({queryCacheKey:Q,requestId:be}))},updateSubscriptionOptions(Ce){Le.subscriptionOptions=Ce,B(h({endpointName:_,requestId:be,queryCacheKey:Q,options:Ce}))}});if(!le&&!pe&&!z){let Ce=fE(a,B,{});Ce[Q]=Le,Le.then(()=>{delete Ce[Q],lo(Ce)||a.delete(B)})}return Le};return N}function C(_,j){return E(_,j)}function I(_,j){return E(_,j)}function T(_){return(j,{track:N=!0,fixedCacheKey:k}={})=>(O,D)=>{let V=n({type:"mutation",endpointName:_,originalArgs:j,track:N,fixedCacheKey:k}),z=O(V);let{requestId:G,abort:B,unwrap:U}=z,Q=bE(z.unwrap().then(ne=>({data:ne})),ne=>({error:ne})),$=()=>{O(u({requestId:G,fixedCacheKey:k}))},K=Object.assign(Q,{arg:z.arg,requestId:G,abort:B,unwrap:U,reset:$}),Y=s.get(O)||{};return s.set(O,Y),Y[G]=K,K.then(()=>{delete Y[G],lo(Y)||s.delete(O)}),k&&(Y[k]=K,K.then(()=>{Y[k]===K&&(delete Y[k],lo(Y)||s.delete(O))})),K}}}function wE(e){return e}var ds=(e={})=>({...e,[di]:!0});function xE({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a}){let s=(O,D,V,z)=>(G,B)=>{let U=r[O],Q=n({queryArgs:D,endpointDefinition:U,endpointName:O});if(G(o.internalActions.queryResultPatched({queryCacheKey:Q,patches:V})),!z)return;let $=o.endpoints[O].select(D)(B()),K=Hl(U.providesTags,$.data,void 0,D,{},i);G(o.internalActions.updateProvidedBy({queryCacheKey:Q,providedTags:K}))};function c(O,D,V=0){let z=[D,...O];return V&&z.length>V?z.slice(0,-1):z}function u(O,D,V=0){let z=[...O,D];return V&&z.length>V?z.slice(1):z}let h=(O,D,V,z=!0)=>(G,B)=>{let Q=o.endpoints[O].select(D)(B()),$={patches:[],inversePatches:[],undo:()=>G(o.util.patchQueryData(O,D,$.inversePatches,z))};if(Q.status==="uninitialized")return $;let K;if("data"in Q)if(pt(Q.data)){let[Y,ne,fe]=ba(Q.data,V);$.patches.push(...ne),$.inversePatches.push(...fe),K=Y}else K=V(Q.data),$.patches.push({op:"replace",path:[],value:K}),$.inversePatches.push({op:"replace",path:[],value:Q.data});return $.patches.length===0||G(o.util.patchQueryData(O,D,$.patches,z)),$},v=(O,D,V)=>z=>z(o.endpoints[O].initiate(D,{subscribe:!1,forceRefetch:!0,[Ei]:()=>({data:V})})),S=(O,D)=>O.query&&O[D]?O[D]:wE,g=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(O,{signal:D,abort:V,rejectWithValue:z,fulfillWithValue:G,dispatch:B,getState:U,extra:Q}){let $=r[O.endpointName];try{let K=S($,"transformResponse"),Y={signal:D,abort:V,dispatch:B,getState:U,extra:Q,endpoint:O.endpointName,type:O.type,forced:O.type==="query"?y(O,U()):void 0,queryCacheKey:O.type==="query"?O.queryCacheKey:void 0},ne=O.type==="query"?O[Ei]:void 0,fe,be=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(pe,le,he,Le){if(le==null&&pe.pages.length)return Promise.resolve({data:pe});let Ce={queryArg:O.originalArgs,pageParam:le},De=yield de(Ce),Be=Le?c:u;return{data:{pages:Be(pe.pages,De.data,he),pageParams:Be(pe.pageParams,le,he)}}});return function be(_x52,_x53,_x54,_x55){return _ref25.apply(this,arguments)}}();function de(_x56){return _de.apply(this,arguments)}function _de(){_de=_asyncToGenerator(function*(pe){let le,{extraOptions:he}=$;if(ne?le=ne():$.query?le=yield t($.query(pe),Y,he):le=yield $.queryFn(pe,Y,he,Ce=>t(Ce,Y,he)),typeof process<"u",le.error)throw new fo(le.error,le.meta);let Le=yield K(le.data,le.meta,pe);return{...le,data:Le}});return _de.apply(this,arguments)}if(O.type==="query"&&"infiniteQueryOptions"in $){let{infiniteQueryOptions:pe}=$,{maxPages:le=1/0}=pe,he,Le={pages:[],pageParams:[]},Ce=a.selectQueryEntry(U(),O.queryCacheKey)?.data,Be=y(O,U())&&!O.direction||!Ce?Le:Ce;if("direction"in O&&O.direction&&Be.pages.length){let ut=O.direction==="backward",lr=(ut?qg:Ul)(pe,Be);he=yield be(Be,lr,le,ut)}else{let{initialPageParam:ut=pe.initialPageParam}=O,bt=Ce?.pageParams??[],lr=bt[0]??ut,_n=bt.length;he=yield be(Be,lr,le),ne&&(he={data:he.data.pages[0]});for(let kn=1;kn<_n;kn++){let Qo=Ul(pe,he.data);he=yield be(he.data,Qo,le)}}fe=he}else fe=yield de(O.originalArgs);return G(fe.data,ds({fulfilledTimeStamp:Date.now(),baseQueryMeta:fe.meta}))}catch(K){let Y=K;if(Y instanceof fo){let ne=S($,"transformErrorResponse");try{return z(yield ne(Y.value,Y.meta,O.originalArgs),ds({baseQueryMeta:Y.meta}))}catch(fe){Y=fe}}throw typeof process<"u",console.error(Y),Y}});return function g(_x50,_x51){return _ref24.apply(this,arguments)}}();function y(O,D){let V=a.selectQueryEntry(D,O.queryCacheKey),z=a.selectConfig(D).refetchOnMountOrArgChange,G=V?.fulfilledTimeStamp,B=O.forceRefetch??(O.subscribe&&z);return B?B===!0||(Number(new Date)-Number(G))/1e3>=B:!1}let x=()=>Ee(`${e}/executeQuery`,g,{getPendingMeta({arg:D}){let V=r[D.endpointName];return ds({startedTimeStamp:Date.now(),...(Ql(V)?{direction:D.direction}:{})})},condition(D,{getState:V}){let z=V(),G=a.selectQueryEntry(z,D.queryCacheKey),B=G?.fulfilledTimeStamp,U=D.originalArgs,Q=G?.originalArgs,$=r[D.endpointName],K=D.direction;return Vl(D)?!0:G?.status==="pending"?!1:y(D,z)||Gl($)&&$?.forceRefetch?.({currentArg:U,previousArg:Q,endpointState:G,state:z})?!0:!(B&&!K)},dispatchConditionRejection:!0}),E=x(),C=x(),I=Ee(`${e}/executeMutation`,g,{getPendingMeta(){return ds({startedTimeStamp:Date.now()})}}),T=O=>"force"in O,_=O=>"ifOlderThan"in O,j=(O,D,V)=>(z,G)=>{let B=T(V)&&V.force,U=_(V)&&V.ifOlderThan,Q=(K=!0)=>{let Y={forceRefetch:K,isPrefetch:!0};return o.endpoints[O].initiate(D,Y)},$=o.endpoints[O].select(D)(G());if(B)z(Q());else if(U){let K=$?.fulfilledTimeStamp;if(!K){z(Q());return}(Number(new Date)-Number(new Date(K)))/1e3>=U&&z(Q())}else z(Q(!1))};function N(O){return D=>D?.meta?.arg?.endpointName===O}function k(O,D){return{matchPending:Bn(Ra(O),N(D)),matchFulfilled:Bn(Jt(O),N(D)),matchRejected:Bn(Wr(O),N(D))}}return{queryThunk:E,mutationThunk:I,infiniteQueryThunk:C,prefetch:j,updateQueryData:h,upsertQueryData:v,patchQueryData:s,buildMatchThunkActions:k}}function Ul(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function qg(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function jg(e,t,r,n){return Hl(r[e.meta.arg.endpointName][t],Jt(e)?e.payload:void 0,pi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function fs(e,t,r){let n=e[t];n&&r(n)}function Ri(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Eg(e,t,r){let n=e[Ri(t)];n&&r(n)}var Ci={};function CE({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:c,config:u}){let h=P(`${e}/resetApiState`);function v(N,k,O,D){var V;N[V=k.queryCacheKey]??(N[V]={status:"uninitialized",endpointName:k.endpointName}),fs(N,k.queryCacheKey,z=>{z.status="pending",z.requestId=O&&z.requestId?z.requestId:D.requestId,k.originalArgs!==void 0&&(z.originalArgs=k.originalArgs),z.startedTimeStamp=D.startedTimeStamp;let G=o[D.arg.endpointName];Ql(G)&&"direction"in k&&(z.direction=k.direction)})}function S(N,k,O,D){fs(N,k.arg.queryCacheKey,V=>{if(V.requestId!==k.requestId&&!D)return;let{merge:z}=o[k.arg.endpointName];if(V.status="fulfilled",z){if(V.data!==void 0){let{fulfilledTimeStamp:G,arg:B,baseQueryMeta:U,requestId:Q}=k,$=Xt(V.data,K=>z(K,O,{arg:B.originalArgs,baseQueryMeta:U,fulfilledTimeStamp:G,requestId:Q}));V.data=$}else V.data=O;}else V.data=o[k.arg.endpointName].structuralSharing??!0?Pg(vt(V.data)?$u(V.data):V.data,O):O;delete V.error,V.fulfilledTimeStamp=k.fulfilledTimeStamp})}let g=Kr({name:`${e}/queries`,initialState:Ci,reducers:{removeQueryResult:{reducer(N,{payload:{queryCacheKey:k}}){delete N[k]},prepare:$n()},cacheEntriesUpserted:{reducer(N,k){for(let O of k.payload){let{queryDescription:D,value:V}=O;v(N,D,!0,{arg:D,requestId:k.meta.requestId,startedTimeStamp:k.meta.timestamp}),S(N,{arg:D,requestId:k.meta.requestId,fulfilledTimeStamp:k.meta.timestamp,baseQueryMeta:{}},V,!0)}},prepare:N=>({payload:N.map(D=>{let{endpointName:V,arg:z,value:G}=D,B=o[V];return{queryDescription:{type:"query",endpointName:V,originalArgs:D.arg,queryCacheKey:n({queryArgs:z,endpointDefinition:B,endpointName:V})},value:G}}),meta:{[di]:!0,requestId:mi(),timestamp:Date.now()}})},queryResultPatched:{reducer(N,{payload:{queryCacheKey:k,patches:O}}){fs(N,k,D=>{D.data=Qu(D.data,O.concat())})},prepare:$n()}},extraReducers(N){N.addCase(t.pending,(k,{meta:O,meta:{arg:D}})=>{let V=Vl(D);v(k,D,V,O)}).addCase(t.fulfilled,(k,{meta:O,payload:D})=>{let V=Vl(O.arg);S(k,O,D,V)}).addCase(t.rejected,(k,{meta:{condition:O,arg:D,requestId:V},error:z,payload:G})=>{fs(k,D.queryCacheKey,B=>{if(!O){if(B.requestId!==V)return;B.status="rejected",B.error=G??z}})}).addMatcher(s,(k,O)=>{let{queries:D}=a(O);for(let[V,z]of Object.entries(D))(z?.status==="fulfilled"||z?.status==="rejected")&&(k[V]=z)})}}),y=Kr({name:`${e}/mutations`,initialState:Ci,reducers:{removeMutationResult:{reducer(N,{payload:k}){let O=Ri(k);O in N&&delete N[O]},prepare:$n()}},extraReducers(N){N.addCase(r.pending,(k,{meta:O,meta:{requestId:D,arg:V,startedTimeStamp:z}})=>{V.track&&(k[Ri(O)]={requestId:D,status:"pending",endpointName:V.endpointName,startedTimeStamp:z})}).addCase(r.fulfilled,(k,{payload:O,meta:D})=>{D.arg.track&&Eg(k,D,V=>{V.requestId===D.requestId&&(V.status="fulfilled",V.data=O,V.fulfilledTimeStamp=D.fulfilledTimeStamp)})}).addCase(r.rejected,(k,{payload:O,error:D,meta:V})=>{V.arg.track&&Eg(k,V,z=>{z.requestId===V.requestId&&(z.status="rejected",z.error=O??D)})}).addMatcher(s,(k,O)=>{let{mutations:D}=a(O);for(let[V,z]of Object.entries(D))(z?.status==="fulfilled"||z?.status==="rejected")&&V!==z?.requestId&&(k[V]=z)})}}),x=Kr({name:`${e}/invalidation`,initialState:Ci,reducers:{updateProvidedBy:{reducer(N,k){var V,z;let{queryCacheKey:O,providedTags:D}=k.payload;for(let G of Object.values(N))for(let B of Object.values(G)){let U=B.indexOf(O);U!==-1&&B.splice(U,1)}for(let{type:G,id:B}of D){let U=(V=N[G]??(N[G]={}))[z=B||"__internal_without_id"]??(V[z]=[]);U.includes(O)||U.push(O)}},prepare:$n()}},extraReducers(N){N.addCase(g.actions.removeQueryResult,(k,{payload:{queryCacheKey:O}})=>{for(let D of Object.values(k))for(let V of Object.values(D)){let z=V.indexOf(O);z!==-1&&V.splice(z,1)}}).addMatcher(s,(k,O)=>{var V,z;let{provided:D}=a(O);for(let[G,B]of Object.entries(D))for(let[U,Q]of Object.entries(B)){let $=(V=k[G]??(k[G]={}))[z=U||"__internal_without_id"]??(V[z]=[]);for(let K of Q)$.includes(K)||$.push(K)}}).addMatcher(jt(Jt(t),pi(t)),(k,O)=>{let D=jg(O,"providesTags",o,c),{queryCacheKey:V}=O.meta.arg;x.caseReducers.updateProvidedBy(k,x.actions.updateProvidedBy({queryCacheKey:V,providedTags:D}))})}}),E=Kr({name:`${e}/subscriptions`,initialState:Ci,reducers:{updateSubscriptionOptions(N,k){},unsubscribeQueryResult(N,k){},internal_getRTKQSubscriptions(){}}}),C=Kr({name:`${e}/internalSubscriptions`,initialState:Ci,reducers:{subscriptionsUpdated:{reducer(N,k){return Qu(N,k.payload)},prepare:$n()}}}),I=Kr({name:`${e}/config`,initialState:{online:cE(),focused:sE(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(N,{payload:k}){N.middlewareRegistered=N.middlewareRegistered==="conflict"||i!==k?"conflict":!0}},extraReducers:N=>{N.addCase($l,k=>{k.online=!0}).addCase(Mg,k=>{k.online=!1}).addCase(Bl,k=>{k.focused=!0}).addCase(Dg,k=>{k.focused=!1}).addMatcher(s,k=>({...k}))}}),T=Dn({queries:g.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:C.reducer,config:I.reducer}),_=(N,k)=>T(h.match(k)?void 0:N,k),j={...I.actions,...g.actions,...E.actions,...C.actions,...y.actions,...x.actions,resetApiState:h};return{reducer:_,actions:j}}var jl=Symbol.for("RTKQ/skipToken"),Lg={status:"uninitialized"},Rg=Xt(Lg,()=>{}),Ig=Xt(Lg,()=>{});function EE({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>Rg,o=T=>Ig;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:x,selectCachedArgsForQuery:E,selectApiState:a,selectQueries:s,selectMutations:u,selectQueryEntry:c,selectConfig:h};function i(T){return{...T,...Sg(T.status)}}function a(T){return T[t]}function s(T){return a(T)?.queries}function c(T,_){return s(T)?.[_]}function u(T){return a(T)?.mutations}function h(T){return a(T)?.config}function v(T,_,j){return N=>{if(N===jl)return r(n,j);let k=e({queryArgs:N,endpointDefinition:_,endpointName:T});return r(D=>c(D,k)??Rg,j)}}function S(T,_){return v(T,_,i)}function g(T,_){let{infiniteQueryOptions:j}=_;function N(k){let O={...k,...Sg(k.status)},{isLoading:D,isError:V,direction:z}=O,G=z==="forward",B=z==="backward";return{...O,hasNextPage:C(j,O.data),hasPreviousPage:I(j,O.data),isFetchingNextPage:D&&G,isFetchingPreviousPage:D&&B,isFetchNextPageError:V&&G,isFetchPreviousPageError:V&&B}}return v(T,_,N)}function y(){return T=>{let _;return typeof T=="object"?_=Ri(T)??jl:_=T,r(_===jl?o:k=>a(k)?.mutations?.[_]??Ig,i)}}function x(T,_){let j=T[t],N=new Set;for(let k of _.filter(ps).map(Ll)){let O=j.provided[k.type];if(!O)continue;let D=(k.id!==void 0?O[k.id]:Ag(Object.values(O)))??[];for(let V of D)N.add(V)}return Ag(Array.from(N.values()).map(k=>{let O=j.queries[k];return O?[{queryCacheKey:k,endpointName:O.endpointName,originalArgs:O.originalArgs}]:[]}))}function E(T,_){return Object.values(s(T)).filter(j=>j?.endpointName===_&&j.status!=="uninitialized").map(j=>j.originalArgs)}function C(T,_){return _?Ul(T,_)!=null:!1}function I(T,_){return!_||!T.getPreviousPageParam?!1:qg(T,_)!=null}}var Tg=WeakMap?new WeakMap:void 0,_g=({endpointName:e,queryArgs:t})=>{let r="",n=Tg?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=qt(a)?Object.keys(a).sort().reduce((s,c)=>(s[c]=a[c],s),{}):a,a));qt(t)&&Tg?.set(t,o),r=o}return`${e}(${r})`};function RE(...e){return function(r){let n=Vn(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=_g;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:_g({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:mi(),extractRehydrationInfo:n,hasRehydrationInfo:Vn(u=>n(u)!=null)},a={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(i.endpointDefinitions[v]):Object.assign(i.endpointDefinitions[v]||{},S);return a}},s=e.map(u=>u.init(a,o,i));function c(u){let h=u.endpoints({query:v=>({...v,type:"query"}),mutation:v=>({...v,type:"mutation"}),infiniteQuery:v=>({...v,type:"infinitequery"})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(st(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=S;for(let g of s)g.injectEndpoint(v,S)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function nr(e,...t){return Object.assign(e,...t)}var IE=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,o=null,i=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:s}=e.internalActions,c=(g,y)=>{var E,C;if(a.match(y)){let{queryCacheKey:I,requestId:T,options:_}=y.payload;return g?.[I]?.[T]&&(g[I][T]=_),!0}if(s.match(y)){let{queryCacheKey:I,requestId:T}=y.payload;return g[I]&&delete g[I][T],!0}if(e.internalActions.removeQueryResult.match(y))return delete g[y.payload.queryCacheKey],!0;if(t.pending.match(y)){let{meta:{arg:I,requestId:T}}=y,_=g[E=I.queryCacheKey]??(g[E]={});return _[`${T}_running`]={},I.subscribe&&(_[T]=I.subscriptionOptions??_[T]??{}),!0}let x=!1;if(t.fulfilled.match(y)||t.rejected.match(y)){let I=g[y.meta.arg.queryCacheKey]||{},T=`${y.meta.requestId}_running`;x||(x=!!I[T]),delete I[T]}if(t.rejected.match(y)){let{meta:{condition:I,arg:T,requestId:_}}=y;if(I&&T.subscribe){let j=g[C=T.queryCacheKey]??(g[C]={});j[_]=T.subscriptionOptions??j[_]??{},x=!0}}return x},u=()=>r.currentSubscriptions,S={getSubscriptions:u,getSubscriptionCount:g=>{let x=u()[g]??{};return lo(x)},isRequestSubscribed:(g,y)=>!!u()?.[g]?.[y]};return(g,y)=>{if(o||(o=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return o=r.currentSubscriptions={},i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,S];let x=c(r.currentSubscriptions,g),E=!0;if(x){i||(i=setTimeout(()=>{let T=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,_]=ba(o,()=>T);y.next(e.internalActions.subscriptionsUpdated(_)),o=T,i=null},500));let C=typeof g.type=="string"&&!!g.type.startsWith(n),I=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;E=!C&&!I}return[E,!1]}};function TE(e){for(let t in e)return!1;return!0}var _E=2147483647/1e3-1,kE=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a}})=>{let{removeQueryResult:s,unsubscribeQueryResult:c,cacheEntriesUpserted:u}=t.internalActions,h=jt(c.match,r.fulfilled,r.rejected,u.match);function v(E){let C=o.currentSubscriptions[E];return!!C&&!TE(C)}let S={},g=(E,C,I)=>{let T=C.getState(),_=a(T);if(h(E)){let j;if(u.match(E))j=E.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=c.match(E)?E.payload:E.meta.arg;j=[N]}y(j,C,_)}if(t.util.resetApiState.match(E))for(let[j,N]of Object.entries(S))N&&clearTimeout(N),delete S[j];if(n.hasRehydrationInfo(E)){let{queries:j}=n.extractRehydrationInfo(E);y(Object.keys(j),C,_)}};function y(E,C,I){let T=C.getState();for(let _ of E){let j=i(T,_);x(_,j?.endpointName,C,I)}}function x(E,C,I,T){let j=n.endpointDefinitions[C]?.keepUnusedDataFor??T.keepUnusedDataFor;if(j===1/0)return;let N=Math.max(0,Math.min(j,_E));if(!v(E)){let k=S[E];k&&clearTimeout(k),S[E]=setTimeout(()=>{v(E)||I.dispatch(s({queryCacheKey:E})),delete S[E]},N*1e3)}}return g},kg=new Error("Promise never resolved before cacheEntryRemoved."),OE=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let c=Ia(n),u=Ia(o),h=Jt(n,o),v={};function S(C,I,T){let _=v[C];_?.valueResolved&&(_.valueResolved({data:I,meta:T}),delete _.valueResolved)}function g(C){let I=v[C];I&&(delete v[C],I.cacheEntryRemoved())}let y=(C,I,T)=>{let _=x(C);function j(N,k,O,D){let V=a(T,k),z=a(I.getState(),k);!V&&z&&E(N,D,k,I,O)}if(n.pending.match(C))j(C.meta.arg.endpointName,_,C.meta.requestId,C.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(C))for(let{queryDescription:N,value:k}of C.payload){let{endpointName:O,originalArgs:D,queryCacheKey:V}=N;j(O,V,C.meta.requestId,D),S(V,k,{})}else if(o.pending.match(C))I.getState()[t].mutations[_]&&E(C.meta.arg.endpointName,C.meta.arg.originalArgs,_,I,C.meta.requestId);else if(h(C))S(_,C.payload,C.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(C)||e.internalActions.removeMutationResult.match(C))g(_);else if(e.util.resetApiState.match(C))for(let N of Object.keys(v))g(N)};function x(C){return c(C)?C.meta.arg.queryCacheKey:u(C)?C.meta.arg.fixedCacheKey??C.meta.requestId:e.internalActions.removeQueryResult.match(C)?C.payload.queryCacheKey:e.internalActions.removeMutationResult.match(C)?Ri(C.payload):""}function E(C,I,T,_,j){let N=r.endpointDefinitions[C],k=N?.onCacheEntryAdded;if(!k)return;let O={},D=new Promise(Q=>{O.cacheEntryRemoved=Q}),V=Promise.race([new Promise(Q=>{O.valueResolved=Q}),D.then(()=>{throw kg})]);V.catch(()=>{}),v[T]=O;let z=e.endpoints[C].select(N.type==="query"?I:T),G=_.dispatch((Q,$,K)=>K),B={..._,getCacheEntry:()=>z(_.getState()),requestId:j,extra:G,updateCachedData:N.type==="query"?Q=>_.dispatch(e.util.updateQueryData(C,I,Q)):void 0,cacheDataLoaded:V,cacheEntryRemoved:D},U=k(I,B);Promise.resolve(U).catch(Q=>{if(Q!==kg)throw Q})}return y},PE=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},NE=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,h=jt(Jt(n),pi(n)),v=jt(Jt(n,o),Wr(n,o)),S=[],g=(E,C)=>{h(E)?x(jg(E,"invalidatesTags",r,a),C):v(E)?x([],C):i.util.invalidateTags.match(E)&&x(Hl(E.payload,void 0,void 0,void 0,void 0,a),C)};function y(E){let{queries:C,mutations:I}=E;for(let T of[C,I])for(let _ in T)if(T[_]?.status==="pending")return!0;return!1}function x(E,C){let I=C.getState(),T=I[e];if(S.push(...E),T.config.invalidationBehavior==="delayed"&&y(T))return;let _=S;if(S=[],_.length===0)return;let j=i.util.selectInvalidatedBy(I,_);t.batch(()=>{let N=Array.from(j.values());for(let{queryCacheKey:k}of N){let O=T.queries[k],D=c.currentSubscriptions[k]??{};O&&(lo(D)===0?C.dispatch(u({queryCacheKey:k})):O.status!=="uninitialized"&&C.dispatch(s(O)))}})}return g},FE=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let i={},a=(g,y)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload,y),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg,y),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&c(g.meta.arg,y),r.util.resetApiState.match(g)&&v()};function s(g,y){let E=y.getState()[e].queries[g],C=o.currentSubscriptions[g];if(!(!E||E.status==="uninitialized"))return C}function c({queryCacheKey:g},y){let x=y.getState()[e],E=x.queries[g],C=o.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I,skipPollingIfUnfocused:T}=S(C);if(!Number.isFinite(I))return;let _=i[g];_?.timeout&&(clearTimeout(_.timeout),_.timeout=void 0);let j=Date.now()+I;i[g]={nextPollTimestamp:j,pollingInterval:I,timeout:setTimeout(()=>{(x.config.focused||!T)&&y.dispatch(n(E)),c({queryCacheKey:g},y)},I)}}function u({queryCacheKey:g},y){let E=y.getState()[e].queries[g],C=o.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I}=S(C);if(!Number.isFinite(I)){h(g);return}let T=i[g],_=Date.now()+I;(!T||_<T.nextPollTimestamp)&&c({queryCacheKey:g},y)}function h(g){let y=i[g];y?.timeout&&clearTimeout(y.timeout),delete i[g]}function v(){for(let g of Object.keys(i))h(g)}function S(g={}){let y=!1,x=Number.POSITIVE_INFINITY;for(let E in g)g[E].pollingInterval&&(x=Math.min(g[E].pollingInterval,x),y=g[E].skipPollingIfUnfocused||y);return{lowestPollingInterval:x,skipPollingIfUnfocused:y}}return a},DE=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Ra(r,n),i=Wr(r,n),a=Jt(r,n),s={};return(u,h)=>{if(o(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=t.endpointDefinitions[S],x=y?.onQueryStarted;if(x){let E={},C=new Promise((j,N)=>{E.resolve=j,E.reject=N});C.catch(()=>{}),s[v]=E;let I=e.endpoints[S].select(y.type==="query"?g:v),T=h.dispatch((j,N,k)=>k),_={...h,getCacheEntry:()=>I(h.getState()),requestId:v,extra:T,updateCachedData:y.type==="query"?j=>h.dispatch(e.util.updateQueryData(S,g,j)):void 0,queryFulfilled:C};x(g,_)}}else if(a(u)){let{requestId:v,baseQueryMeta:S}=u.meta;s[v]?.resolve({data:u.payload,meta:S}),delete s[v]}else if(i(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;s[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete s[v]}}},ME=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(c,u)=>{Bl.match(c)&&s(u,"refetchOnFocus"),$l.match(c)&&s(u,"refetchOnReconnect")};function s(c,u){let h=c.getState()[e],v=h.queries,S=o.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(S)){let y=v[g],x=S[g];if(!x||!y)continue;(Object.values(x).some(C=>C[u]===!0)||Object.values(x).every(C=>C[u]===void 0)&&h.config[u])&&(lo(x)===0?c.dispatch(i({queryCacheKey:g})):y.status!=="uninitialized"&&c.dispatch(n(y)))}})}return a};function qE(e){let{reducerPath:t,queryThunk:r,api:n,context:o}=e,{apiUid:i}=o,a={invalidateTags:P(`${t}/invalidateTags`)},s=v=>v.type.startsWith(`${t}/`),c=[PE,kE,NE,FE,OE,DE];return{middleware:v=>{let S=!1,y={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:s},x=c.map(I=>I(y)),E=IE(y),C=ME(y);return I=>T=>{if(!qn(T))return I(T);S||(S=!0,v.dispatch(n.internalActions.middlewareRegistered(i)));let _={...v,next:I},j=v.getState(),[N,k]=E(T,_,j),O;if(N?O=I(T):O=k,v.getState()[t]&&(C(T,_,j),s(T)||o.hasRehydrationInfo(T)))for(let D of x)D(T,_,j);return O}},actions:a};function h(v){return e.api.endpoints[v.endpointName].initiate(v.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Og=Symbol(),jE=({createSelector:e=Ve}={})=>({name:Og,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h},v){Ip();let S=de=>(typeof process<"u",de);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:$l,onOffline:Mg,onFocus:Bl,onFocusLost:Dg},util:{}});let g=EE({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:x,buildQuerySelector:E,buildInfiniteQuerySelector:C,buildMutationSelector:I}=g;nr(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:x});let{queryThunk:T,infiniteQueryThunk:_,mutationThunk:j,patchQueryData:N,updateQueryData:k,upsertQueryData:O,prefetch:D,buildMatchThunkActions:V}=xE({baseQuery:r,reducerPath:o,context:v,api:t,serializeQueryArgs:i,assertTagType:S,selectors:g}),{reducer:z,actions:G}=CE({context:v,queryThunk:T,infiniteQueryThunk:_,mutationThunk:j,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});nr(t.util,{patchQueryData:N,updateQueryData:k,upsertQueryData:O,prefetch:D,resetApiState:G.resetApiState,upsertQueryEntries:G.cacheEntriesUpserted}),nr(t.internalActions,G);let{middleware:B,actions:U}=qE({reducerPath:o,context:v,queryThunk:T,mutationThunk:j,infiniteQueryThunk:_,api:t,assertTagType:S,selectors:g});nr(t.util,U),nr(t,{reducer:z,middleware:B});let{buildInitiateQuery:Q,buildInitiateInfiniteQuery:$,buildInitiateMutation:K,getRunningMutationThunk:Y,getRunningMutationsThunk:ne,getRunningQueriesThunk:fe,getRunningQueryThunk:be}=AE({queryThunk:T,mutationThunk:j,infiniteQueryThunk:_,api:t,serializeQueryArgs:i,context:v});return nr(t.util,{getRunningMutationThunk:Y,getRunningMutationsThunk:ne,getRunningQueryThunk:be,getRunningQueriesThunk:fe}),{name:Og,injectEndpoint(de,pe){var Le;let he=(Le=t.endpoints)[de]??(Le[de]={});Gl(pe)&&nr(he,{name:de,select:E(de,pe),initiate:Q(de,pe)},V(T,de)),vE(pe)&&nr(he,{name:de,select:I(),initiate:K(de)},V(j,de)),Ql(pe)&&nr(he,{name:de,select:C(de,pe),initiate:$(de,pe)},V(T,de))}}}}),Vg=RE(jE());m();d();p();f();m();d();p();f();var Zr=e=>e.query,Ug=e=>e.query?.enableQuerySyntax;var _2=Ve(e=>Zr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),LE=Ve(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();p();f();m();d();p();f();var po=e=>ct({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Jr(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Jr(t)??"",answerGenerated:e??!1})}),mo=()=>ct({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Jr(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});m();d();p();f();m();d();p();f();var Bg=Ve(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();p();f();var Ii=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:Zn(e)}});m();d();p();f();var $g=e=>e.context;m();d();p();f();var zl=e=>e.pipeline;m();d();p();f();m();d();p();f();var Ti=_t(ms(),1),Kg=_t(Gg(),1);m();d();p();f();var gs=_t(ms(),1),Hg=_t(Qg(),1);gs.default.extend(Hg.default);var zg="YYYY/MM/DD@HH:mm:ss",VE="1401-01-01";function go(e,t){let r=(0,gs.default)(e,t);return!r.isValid()&&!t?(0,gs.default)(e,zg):r}function hs(e){return e.format(zg)}function Wg(e,t){let r=go(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}ed(r)}function ed(e){if(e.isBefore(VE))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ti.default.extend(Kg.default);var Yg=["past","now","next"],Xg=["minute","hour","day","week","month","quarter","year"],UE=e=>{let t=e==="now";return{amount:new te({required:!t,min:1}),unit:new H({required:!t,constrainTo:Xg}),period:new H({required:!0,constrainTo:Yg})}};function td(e){if(typeof e=="string"&&!br(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?rh(e):e;new lt(UE(t.period)).validate(t);let r=Zg(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);ed(r)}function Jg(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Zg(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ti.default)().subtract(r,n);case"next":return(0,Ti.default)().add(r,n);case"now":return(0,Ti.default)()}}function _i(e){return hs(Zg(rh(e)))}function eh(e){return e.toLocaleLowerCase().split("-")}function br(e){let[t,r,n]=eh(e);if(t==="now")return!0;if(!Yg.includes(t)||!Xg.includes(n))return!1;let o=parseInt(r);return!(Number.isNaN(o)||o<=0)}function th(e){return!!e&&typeof e=="object"&&"period"in e}function rh(e){let[t,r,n]=eh(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r):void 0,unit:n||void 0}}m();d();p();f();function nh(e){return e.type==="dateRange"}function oh(e){return`start${e}`}function ih(e){return`end${e}`}var rd=()=>({dateFacetValueMap:{}});function BE(e,t,r){let n=e.start,o=e.end;return br(n)&&(n=_i(n),r.dateFacetValueMap[t][oh(n)]=e.start),br(o)&&(o=_i(o),r.dateFacetValueMap[t][ih(o)]=e.end),{...e,start:n,end:o}}function nd(e,t){if(nh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>BE(o,r,t))}}return e}function Ar(e){let t=rd();return{request:{...e,facets:e.facets?.map(n=>nd(n,t))},mappings:t}}function $E(e,t,r){return{...e,start:r.dateFacetValueMap[t][oh(e.start)]||e.start,end:r.dateFacetValueMap[t][ih(e.end)]||e.end}}function GE(e,t){return e.facetId in t.dateFacetValueMap}function QE(e,t){return GE(e,t)?{...e,values:e.values.map(r=>$E(r,e.facetId,t))}:e}function ys(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>QE(n,t))}}:e}m();d();p();f();m();d();p();f();m();d();p();f();function wr(e){return Object.values(e).map(t=>t.request)}function od(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function ah(e){return wr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var id={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function HE(e){return wr(e).map(t=>{let r=id[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zE(e){return[...HE(e.facetSet??{}),...ah(e.numericFacetSet??{}),...ah(e.dateFacetSet??{}),...wr(e.categoryFacetSet??{})]}function WE(e){return zE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function vs(e){return od(WE(e),e.facetOrder??[])}m();d();p();f();m();d();p();f();var xr=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(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:wt.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 ss(e.configuration.analytics,t))),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function xr(_x57,_x58){return _ref26.apply(this,arguments)}}();m();d();p();f();var ho=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(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&&Ii(e.configuration.analytics,t,r)),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();p();f();var sh=Ve(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Cr=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t,r){let n=sd(e),o=KE(e),i=YE(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield xr(e,r):ho(e,t,r);return Ar({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:ad(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Cr(_x59,_x60,_x61){return _ref27.apply(this,arguments)}}();function ad(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function KE(e){return od(JE(e),e.facetOrder??[])}function YE(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(XE).filter(r=>r.currentValues.length>0):void 0}function XE(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function JE(e){return ZE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ZE(e){return[...eR(e.facetSet??{}),...ch(e.numericFacetSet??{}),...ch(e.dateFacetSet??{}),...wr(e.categoryFacetSet??{})]}function eR(e){return wr(e).map(t=>{let r=id[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function ch(e){return wr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function sd(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=sh(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();p();f();m();d();p();f();var ki=(e,t)=>{let r=e;return ie(r[t])?ie(e.raw[t])?null:e.raw[t]:r[t]},tR=e=>t=>e.every(r=>!ie(ki(t,r))),rR=e=>t=>e.every(r=>ie(ki(t,r))),nR=(e,t)=>r=>{let n=uh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},oR=(e,t)=>r=>{let n=uh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},uh=(e,t)=>{let r=ki(t,e);return Hf(r)?r:[r]},lh={getResultProperty:ki,fieldsMustBeDefined:tR,fieldsMustNotBeDefined:rR,fieldMustMatch:nR,fieldMustNotMatch:oR};var cd=Ve(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();p();f();var ud=e=>e.searchHub;m();d();p();f();var ld=Ve(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),fG=Ve(e=>e,e=>{let t=ld(e);return t&&e?e[t].expression:""});m();d();p();f();var dh=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();p();f();var fh=e=>e.excerptLength?.length;m();d();p();f();var ph=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();p();f();var mh=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 gh=e=>e.sortCriteria;var hh=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function hh(_x62){return _ref28.apply(this,arguments)}}(),yh=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:a}=aR(e),s=$g(e),c=Ii(e.configuration.analytics,t,{actionCause:cd(e)}),u=ud(e),h=zl(e),v=El(e)??[],S=Sh(e),g=ld(e.tabSet)||"default",y=xl(e),x=Qm(e),E=t.referrer||"",C=ph(e),I=gh(e),T=iR(e),_=fh(e),j=mh(e),N=dh(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Ug(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(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:ad(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...T,...(j??{}),...(_&&{excerptLength:_}),...(N&&{dictionaryFieldContext:N}),sortCriteria:I,...(C&&{facetOptions:C}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},vh=(e,t)=>{let r=Zr(e)?.q,n=Sh(e),o=Ii(e.configuration.analytics,t,{actionCause:cd(e)}),i=xl(e),a=ud(e),s=zl(e),c=El(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:c}},...(a?.length&&{searchHub:a}),...(s?.length&&{pipeline:s}),...o,locale:i}},Sh=e=>vs(e)?.map(t=>nd(t,rd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),iR=e=>({actionsHistory:e.configuration.analytics.enabled?wt.getInstance().getHistory():[]}),aR=e=>{let t=Bg(e),r=sd(e);return{...t,...(r&&{cq:r})}};m();d();p();f();var yo=["searching","thinking","answering"];m();d();p();f();var bh=["text/plain","text/markdown"];var vo=new H({required:!0}),Ah=new H,So=new ue({required:!0}),dd={id:vo,title:vo,uri:vo,permanentid:vo,clickUri:Ah},Ss=new H({required:!0,constrainTo:bh}),PQ=P("generatedAnswer/setIsVisible",e=>q(e,So)),bs=P("generatedAnswer/setAnswerId",e=>q(e,X)),NQ=P("generatedAnswer/setAnswerGenerationMode",e=>q(e,new H({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),FQ=P("generatedAnswer/setIsEnabled",e=>q(e,So)),Pi=P("generatedAnswer/updateMessage",e=>q(e,{textDelta:vo})),Ni=P("generatedAnswer/updateCitations",e=>q(e,{citations:new ge({required:!0,each:new ee({values:dd})})})),Fi=P("generatedAnswer/updateError",e=>q(e,{message:Ah,code:new te({min:0})})),As=P("generatedAnswer/resetAnswer"),DQ=P("generatedAnswer/like"),MQ=P("generatedAnswer/dislike"),qQ=P("generatedAnswer/feedbackModal/open"),jQ=P("generatedAnswer/expand"),LQ=P("generatedAnswer/collapse"),VQ=P("generatedAnswer/setId",e=>q(e,{id:new H({required:!0})})),UQ=P("generatedAnswer/feedbackModal/close"),BQ=P("generatedAnswer/sendFeedback"),Er=P("generatedAnswer/setIsLoading",e=>q(e,So)),Oi=P("generatedAnswer/setIsStreaming",e=>q(e,So)),Di=P("generatedAnswer/setAnswerContentFormat",e=>q(e,Ss)),$Q=P("generatedAnswer/updateResponseFormat",e=>q(e,{contentFormat:new ge({each:Ss,default:["text/plain"]})})),GQ=P("knowledge/updateAnswerConfigurationId",e=>q(e,vo)),QQ=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>q(e,ka)),fd=P("generatedAnswer/setIsAnswerGenerated",e=>q(e,So)),Mi=P("generatedAnswer/setCannotAnswer",e=>q(e,So)),sR=P("generatedAnswer/setAnswerApiQueryParams",e=>q(e,new ee({}))),wh=P("generatedAnswer/startStep",e=>q(e,{name:new H({required:!0,constrainTo:yo}),startedAt:new te({min:0,required:!0})})),xh=P("generatedAnswer/finishStep",e=>q(e,{name:new H({required:!0,constrainTo:yo}),finishedAt:new te({min:0,required:!0})})),HQ=Ee("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:a}=i(),{queryExecuted:s}=a,{setAbortControllerRef:c}=e,u=yield hh(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let x=JSON.parse(y);n(Di(x.contentFormat));break}case"genqa.messageType":n(Pi(JSON.parse(y)));break;case"genqa.citationsType":n(Ni(JSON.parse(y)));break;case"genqa.endOfStreamType":{let x=JSON.parse(y).answerGenerated,E=s.length!==0&&!x;n(Mi(E)),n(Oi(!1)),n(fd(x)),n(po(x)),n(mo());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${g}"`)}};n(Er(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=o.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(Er(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(Fi(g))},close:()=>{v(u)&&n(Oi(!1))},resetAnswer:()=>{v(u)&&n(As())}});S?c(S):n(Er(!1))});return function(_x63,_x64){return _ref29.apply(this,arguments)}}()),zQ=Ee("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(As());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=yh(i,n);r(sR(a)),yield r(Ch(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x65,_x66){return _ref30.apply(this,arguments)}}());m();d();p();f();m();d();p();f();function Rh(_x67,_x68){return _Rh.apply(this,arguments)}function _Rh(){_Rh=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _Rh.apply(this,arguments)}function Ih(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=uR(t,a);let s=t.length,c=0;for(;r<s;){o&&(t[r]===10&&(c=++r),o=!1);let u=-1;for(;r<s&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:o=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===s?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function Th(e,t,r){let n=Eh(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=Eh();else if(s>0){let c=o.decode(a.subarray(0,s)),u=s+(a[s+1]===32?2:1),h=o.decode(a.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
31
- ${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":cR(h,n,t);break}}}}function cR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function uR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Eh(){return{data:"",event:"",id:"",retry:void 0}}var pd="text/event-stream",lR=1e3,_h="last-event-id";function kh(){return typeof window<"u"}function Oh(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=pd);let g;function y(){g?.abort(),document.hidden||_()}!s&&kh()&&document.addEventListener("visibilitychange",y);let x=lR,E;function C(){kh()&&document.removeEventListener("visibilitychange",y),clearTimeout(E),g?.abort()}t?.addEventListener("abort",()=>{C(),h()});let I=c??A,T=n??dR;function _(){return _3.apply(this,arguments)}function _3(){_3=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let j=yield I(e,{...u,headers:S,signal:g?.signal});yield T(j),yield Rh(j.body,Ih(Th(N=>{N?S[_h]=N:delete S[_h]},N=>{x=N},o))),i?.(),C(),h()}catch(j){if(!g?.signal?.aborted)try{let N=a?.(j)??x;clearTimeout(E),E=setTimeout(_,N)}catch(N){C(),v(N)}}});return _3.apply(this,arguments)}_()})}function dR(e){let t=e.headers.get("content-type");if(!t?.startsWith(pd))throw new Error(`Expected content-type to be ${pd}, Actual: ${t}`)}m();d();p();f();var fR=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let u=We(a,i);return{data:Ng({baseUrl:`${u}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _ref32=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),A(S,g)});return function fetchFn(_x72){return _ref32.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function fR(_x69,_x70,_x71){return _ref31.apply(this,arguments)}}(),Ph=Vg({reducerPath:"answer",baseQuery:Fg(fR,{maxRetries:3}),endpoints:()=>({})});var pR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},mR=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},gR=(e,t)=>{e.citations=t.citations},hR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},yR=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},vR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&yR(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(pR(t,o),r(Di(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(mR(t,o),r(Pi({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(gR(t,o),r(Ni({citations:o.citations})));break;case"genqa.endOfStreamType":hR(t,o),r(po(o.answerGenerated??!1)),r(mo());break}},SR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},md=Ph.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x73,_x74){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:a,generatedAnswer:s,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=a,S=We(u,h),g=SR(S,u,s.answerConfigurationId,c?.insightId);yield Oh(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:A,onopen:function(){var _ref33=_asyncToGenerator(function*(y){let x=y.headers.get("x-answer-id");x&&o(E=>{E.answerId=x,i(bs(x))})});return function onopen(_x75){return _ref33.apply(this,arguments)}}(),onmessage:y=>{o(x=>{vR(y,x,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Mi(!y.generated))})}})}).apply(this,arguments)}})})}),Ch=e=>md.endpoints.getAnswer.initiate(e);m();d();p();f();var Nh=Me(Gn,e=>e);m();d();p();f();function bR(e){let t=e.payload?.analyticsAction;return Fh(e)&&!ie(t)}function Fh(e){return"type"in e}var Dh=e=>t=>r=>{let n;bR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Fh(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();p();f();m();d();p();f();m();d();p();f();var G3=P("tab/register",e=>{let t=new ee({values:{id:X,expression:Je}});return q(e,t)}),ws=P("tab/updateActiveTab",e=>q(e,X));m();d();p();f();var xs=_t(ms(),1),jh=_t(Mh(),1),Lh=_t(qh(),1);xs.default.extend(Lh.default);xs.default.extend(jh.default);var Vh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:xs.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 AR=/(^|; )Coveo-Pendragon=([^;]*)/;function Sd(){return typeof window>"u"?!1:AR.exec(document.cookie)?.pop()||null}var Uh=Me(Vh(),e=>e.addCase(gr,(t,r)=>{wR(t,r.payload)}).addCase(Lt,(t,r)=>{xR(t,r.payload)}).addCase(Qn,(t,r)=>{CR(t,r.payload)}).addCase(Hn,t=>{t.analytics.enabled=!1}).addCase(zn,t=>{t.analytics.enabled=!0}).addCase(Oa,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Pa,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(ws,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(fm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hr,(t,r)=>{ie(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(lm,(t,{payload:r})=>{t.knowledge.agentId=r}));function wR(e,t){ie(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ie(t.organizationId)||(e.organizationId=t.organizationId)}function xR(e,t){ie(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ie(t.locale)||(e.search.locale=t.locale),ie(t.timezone)||(e.search.timezone=t.timezone),ie(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function CR(e,t){ie(t.enabled)||(e.analytics.enabled=t.enabled),ie(t.originContext)||(e.analytics.originContext=t.originContext),ie(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ie(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ie(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ie(t.trackingId)||(e.analytics.trackingId=t.trackingId),ie(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ie(t.source)||(e.analytics.source=t.source);try{let r=Sd();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ie(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ie(t.anonymous)||(e.analytics.anonymous=t.anonymous),ie(t.deviceId)||(e.analytics.deviceId=t.deviceId),ie(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ie(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var Ot=Uh;m();d();p();f();function ER(e){return e.instantlyCallable}var Bh=()=>e=>t=>e(ER(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 tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));function $h(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 bd,RR=new Uint8Array(16);function Ad(){if(!bd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bd=crypto.getRandomValues.bind(crypto)}return bd(RR)}m();d();p();f();m();d();p();f();var IR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wd={randomUUID:IR};function TR(e,t,r){if(wd.randomUUID&&!t&&!e)return wd.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ad();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return $h(n)}var Rr=TR;m();d();p();f();m();d();p();f();var R={};Wo(R,{BRAND:()=>eI,DIRTY:()=>tn,EMPTY_PATH:()=>PR,INVALID:()=>se,NEVER:()=>jI,OK:()=>it,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>_r,ZodArray:()=>sr,ZodBigInt:()=>nn,ZodBoolean:()=>on,ZodBranded:()=>ji,ZodCatch:()=>hn,ZodDate:()=>an,ZodDefault:()=>gn,ZodDiscriminatedUnion:()=>Rs,ZodEffects:()=>It,ZodEnum:()=>pn,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>ce,ZodFunction:()=>Ts,ZodIntersection:()=>ln,ZodIssueCode:()=>W,ZodLazy:()=>dn,ZodLiteral:()=>fn,ZodMap:()=>Eo,ZodNaN:()=>Io,ZodNativeEnum:()=>mn,ZodNever:()=>Pt,ZodNull:()=>cn,ZodNullable:()=>Gt,ZodNumber:()=>rn,ZodObject:()=>ht,ZodOptional:()=>Et,ZodParsedType:()=>Z,ZodPipeline:()=>Li,ZodPromise:()=>kr,ZodReadonly:()=>yn,ZodRecord:()=>Is,ZodSchema:()=>ye,ZodSet:()=>Ro,ZodString:()=>Tr,ZodSymbol:()=>xo,ZodTransformer:()=>It,ZodTuple:()=>$t,ZodType:()=>ye,ZodUndefined:()=>sn,ZodUnion:()=>un,ZodUnknown:()=>ar,ZodVoid:()=>Co,addIssueToContext:()=>J,any:()=>uI,array:()=>pI,bigint:()=>oI,boolean:()=>ey,coerce:()=>qI,custom:()=>Xh,date:()=>iI,datetimeRegex:()=>Kh,defaultErrorMap:()=>or,discriminatedUnion:()=>yI,effect:()=>_I,enum:()=>RI,function:()=>xI,getErrorMap:()=>bo,getParsedType:()=>Bt,instanceof:()=>rI,intersection:()=>vI,isAborted:()=>Cs,isAsync:()=>Ao,isDirty:()=>Es,isValid:()=>Ir,late:()=>tI,lazy:()=>CI,literal:()=>EI,makeIssue:()=>qi,map:()=>AI,nan:()=>nI,nativeEnum:()=>II,never:()=>dI,null:()=>cI,nullable:()=>OI,number:()=>Zh,object:()=>mI,objectUtil:()=>xd,oboolean:()=>MI,onumber:()=>DI,optional:()=>kI,ostring:()=>FI,pipeline:()=>NI,preprocess:()=>PI,promise:()=>TI,quotelessJson:()=>_R,record:()=>bI,set:()=>wI,setErrorMap:()=>OR,strictObject:()=>gI,string:()=>Jh,symbol:()=>aI,transformer:()=>_I,tuple:()=>SI,undefined:()=>sI,union:()=>hI,unknown:()=>lI,util:()=>Ae,void:()=>fI});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 r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var xd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(xd||(xd={}));var Z=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bt=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.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"]),_R=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=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};gt.create=e=>new gt(e);var kR=(e,t)=>{let r;switch(e.code){case W.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case W.invalid_union:r="Invalid input";break;case W.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case W.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:r="Invalid function arguments";break;case W.invalid_return_type:r="Invalid function return type";break;case W.invalid_date:r="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case W.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case W.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case W.custom:r="Invalid input";break;case W.invalid_intersection_types:r="Intersection results could not be merged";break;case W.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ae.assertNever(e)}return{message:r}},or=kR;var Gh=or;function OR(e){Gh=e}function bo(){return Gh}m();d();p();f();var qi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},PR=[];function J(e,t){let r=bo(),n=qi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===or?void 0:or].filter(o=>!!o)});e.common.issues.push(n)}var rt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return se;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return se;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},se=Object.freeze({status:"aborted"}),tn=e=>({status:"dirty",value:e}),it=e=>({status:"valid",value:e}),Cs=e=>e.status==="aborted",Es=e=>e.status==="dirty",Ir=e=>e.status==="valid",Ao=e=>typeof Promise<"u"&&e instanceof Promise;m();d();p();f();m();d();p();f();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 Rt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Qh=(e,t)=>{if(Ir(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new gt(e.common.issues);return this._error=r,this._error}}};function me(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var ye=class{get description(){return this._def.description}_getType(t){return Bt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Bt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Bt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Ao(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Qh(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ir(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ir(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Bt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield Ao(o)?o:Promise.resolve(o);return Qh(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:W.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new It({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Et.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sr.create(this)}promise(){return kr.create(this,this._def)}or(t){return un.create([this,t],this._def)}and(t){return ln.create(this,t,this._def)}transform(t){return new It({...me(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new gn({...me(this._def),innerType:this,defaultValue:r,typeName:ce.ZodDefault})}brand(){return new ji({typeName:ce.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new hn({...me(this._def),innerType:this,catchValue:r,typeName:ce.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Li.create(this,t)}readonly(){return yn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},NR=/^c[^\s-]{8,}$/i,FR=/^[0-9a-z]+$/,DR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MR=/^[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,qR=/^[a-z0-9_-]{21}$/i,jR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LR=/^[-+]?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)?)??$/,VR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cd,BR=/^(?:(?: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])$/,$R=/^(?:(?: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])$/,GR=/^(([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]))$/,QR=/^(([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])$/,HR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zh="((\\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])))",WR=new RegExp(`^${zh}$`);function Wh(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KR(e){return new RegExp(`^${Wh(e)}$`)}function Kh(e){let t=`${zh}T${Wh(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function YR(e,t){return!!((t==="v4"||!t)&&BR.test(e)||(t==="v6"||!t)&&GR.test(e))}function XR(e,t){if(!jR.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function JR(e,t){return!!((t==="v4"||!t)&&$R.test(e)||(t==="v6"||!t)&&QR.test(e))}var Tr=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.string,received:i.parsedType}),se}let n=new rt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?J(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&J(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")VR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"email",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Cd||(Cd=new RegExp(UR,"u")),Cd.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"emoji",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")MR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"uuid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")qR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"nanoid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")NR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")FR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid2",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")DR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ulid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),J(o,{validation:"url",code:W.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"regex",code:W.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Kh(i).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?WR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?KR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?LR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"duration",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?YR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ip",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?XR(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"jwt",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?JR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cidr",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?HR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?zR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64url",code:W.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:W.invalid_string,...re.errToObj(n)})}_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,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Tr.create=e=>new Tr({checks:[],typeName:ce.ZodString,coerce:e?.coerce??!1,...me(e)});function ZR(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var rn=class e extends ye{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)!==Z.number){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.number,received:i.parsedType}),se}let n,o=new rt;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ZR(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),J(n,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{code:W.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,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,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ae.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};rn.create=e=>new rn({checks:[],typeName:ce.ZodNumber,coerce:e?.coerce||!1,...me(e)});var nn=class e extends ye{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)!==Z.bigint)return this._getInvalidInput(t);let n,o=new rt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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 r=this._getOrReturnCtx(t);return J(r,{code:W.invalid_type,expected:Z.bigint,received:r.parsedType}),se}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,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,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};nn.create=e=>new nn({checks:[],typeName:ce.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var on=class extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.boolean,received:n.parsedType}),se}return it(t.data)}};on.create=e=>new on({typeName:ce.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var an=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.date,received:i.parsedType}),se}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_date}),se}let n=new rt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:ce.ZodDate,...me(e)});var xo=class extends ye{_parse(t){if(this._getType(t)!==Z.symbol){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.symbol,received:n.parsedType}),se}return it(t.data)}};xo.create=e=>new xo({typeName:ce.ZodSymbol,...me(e)});var sn=class extends ye{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.undefined,received:n.parsedType}),se}return it(t.data)}};sn.create=e=>new sn({typeName:ce.ZodUndefined,...me(e)});var cn=class extends ye{_parse(t){if(this._getType(t)!==Z.null){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.null,received:n.parsedType}),se}return it(t.data)}};cn.create=e=>new cn({typeName:ce.ZodNull,...me(e)});var _r=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return it(t.data)}};_r.create=e=>new _r({typeName:ce.ZodAny,...me(e)});var ar=class extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return it(t.data)}};ar.create=e=>new ar({typeName:ce.ZodUnknown,...me(e)});var Pt=class extends ye{_parse(t){let r=this._getOrReturnCtx(t);return J(r,{code:W.invalid_type,expected:Z.never,received:r.parsedType}),se}};Pt.create=e=>new Pt({typeName:ce.ZodNever,...me(e)});var Co=class extends ye{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.void,received:n.parsedType}),se}return it(t.data)}};Co.create=e=>new Co({typeName:ce.ZodVoid,...me(e)});var sr=class e extends ye{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==Z.array)return J(r,{code:W.invalid_type,expected:Z.array,received:r.parsedType}),se;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(J(r,{code:a?W.too_big:W.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(J(r,{code:W.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(J(r,{code:W.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Rt(r,a,r.path,s)))).then(a=>rt.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Rt(r,a,r.path,s)));return rt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};sr.create=(e,t)=>new sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...me(t)});function wo(e){if(e instanceof ht){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(wo(n))}return new ht({...e._def,shape:()=>t})}else return e instanceof sr?new sr({...e._def,type:wo(e.element)}):e instanceof Et?Et.create(wo(e.unwrap())):e instanceof Gt?Gt.create(wo(e.unwrap())):e instanceof $t?$t.create(e.items.map(t=>wo(t))):e}var ht=class e extends ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return J(u,{code:W.invalid_type,expected:Z.object,received:u.parsedType}),se}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let h=i[u],v=o.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new Rt(o,v,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Pt){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of s)c.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(u==="strict")s.length>0&&(J(o,{code:W.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of s){let v=o.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new Rt(o,v,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>rt.mergeObjectSync(n,u)):rt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message: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:ce.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Ae.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return wo(this)}partial(t){let r={};for(let n of Ae.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Et;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Yh(Ae.objectKeys(this.shape))}};ht.create=(e,t)=>new ht({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});ht.strictCreate=(e,t)=>new ht({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});ht.lazycreate=(e,t)=>new ht({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});var un=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new gt(s.ctx.common.issues));return J(r,{code:W.invalid_union,unionErrors:a}),se}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x76){return _ref35.apply(this,arguments)}}())).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new gt(c));return J(r,{code:W.invalid_union,unionErrors:s}),se}}get options(){return this._def.options}};un.create=(e,t)=>new un({options:e,typeName:ce.ZodUnion,...me(t)});var ir=e=>e instanceof dn?ir(e.schema):e instanceof It?ir(e.innerType()):e instanceof fn?[e.value]:e instanceof pn?e.options:e instanceof mn?Ae.objectValues(e.enum):e instanceof gn?ir(e._def.innerType):e instanceof sn?[void 0]:e instanceof cn?[null]:e instanceof Et?[void 0,...ir(e.unwrap())]:e instanceof Gt?[null,...ir(e.unwrap())]:e instanceof ji||e instanceof yn?ir(e.unwrap()):e instanceof hn?ir(e._def.innerType):[],Rs=class e extends ye{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return J(r,{code:W.invalid_type,expected:Z.object,received:r.parsedType}),se;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(J(r,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=ir(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:ce.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function Ed(e,t){let r=Bt(e),n=Bt(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Ed(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Ed(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ln=class extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Cs(i)||Cs(a))return se;let s=Ed(i.value,a.value);return s.valid?((Es(i)||Es(a))&&r.dirty(),{status:r.value,value:s.data}):(J(n,{code:W.invalid_intersection_types}),se)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ln.create=(e,t,r)=>new ln({left:e,right:t,typeName:ce.ZodIntersection,...me(r)});var $t=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return J(n,{code:W.invalid_type,expected:Z.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return J(n,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(J(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Rt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>rt.mergeArray(r,a)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};$t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $t({items:e,typeName:ce.ZodTuple,rest:null,...me(t)})};var Is=class e extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.object)return J(n,{code:W.invalid_type,expected:Z.object,received:n.parsedType}),se;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Rt(n,s,n.path,s)),value:a._parse(new Rt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?rt.mergeObjectAsync(r,o):rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ye?new e({keyType:t,valueType:r,typeName:ce.ZodRecord,...me(n)}):new e({keyType:Tr.create(),valueType:t,typeName:ce.ZodRecord,...me(r)})}},Eo=class extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return J(n,{code:W.invalid_type,expected:Z.map,received:n.parsedType}),se;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new Rt(n,s,n.path,[u,"key"])),value:i._parse(new Rt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of a){let u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return se;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let c of a){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return se;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}}};Eo.create=(e,t,r)=>new Eo({valueType:t,keyType:e,typeName:ce.ZodMap,...me(r)});var Ro=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return J(n,{code:W.invalid_type,expected:Z.set,received:n.parsedType}),se;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(J(n,{code:W.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(J(n,{code:W.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let h of c){if(h.status==="aborted")return se;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new Rt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ro.create=(e,t)=>new Ro({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...me(t)});var Ts=class e extends ye{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return J(r,{code:W.invalid_type,expected:Z.function,received:r.parsedType}),se;function n(s,c){return qi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bo(),or].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:c}})}function o(s,c){return qi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bo(),or].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof kr){let s=this;return it(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new gt([]),h=yield s._def.args.parseAsync(c,i).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(a,this,h);return yield s._def.returns._def.type.parseAsync(v,i).catch(g=>{throw u.addIssue(o(v,g)),u})}))}else{let s=this;return it(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new gt([n(c,u.error)]);let h=Reflect.apply(a,this,u.data),v=s._def.returns.safeParse(h,i);if(!v.success)throw new gt([o(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:$t.create(t).rest(ar.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||$t.create([]).rest(ar.create()),returns:r||ar.create(),typeName:ce.ZodFunction,...me(n)})}},dn=class extends ye{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};dn.create=(e,t)=>new dn({getter:e,typeName:ce.ZodLazy,...me(t)});var fn=class extends ye{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return J(r,{received:r.data,code:W.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:t.data}}get value(){return this._def.value}};fn.create=(e,t)=>new fn({value:e,typeName:ce.ZodLiteral,...me(t)});function Yh(e,t){return new pn({values:e,typeName:ce.ZodEnum,...me(t)})}var pn=class e extends ye{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{expected:Ae.joinValues(n),received:r.parsedType,code:W.invalid_type}),se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{received:r.data,code:W.invalid_enum_value,options:n}),se}return it(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};pn.create=Yh;var mn=class extends ye{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let o=Ae.objectValues(r);return J(n,{expected:Ae.joinValues(o),received:n.parsedType,code:W.invalid_type}),se}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return J(n,{received:n.data,code:W.invalid_enum_value,options:o}),se}return it(t.data)}get enum(){return this._def.values}};mn.create=(e,t)=>new mn({values:e,typeName:ce.ZodNativeEnum,...me(t)});var kr=class extends ye{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return J(r,{code:W.invalid_type,expected:Z.promise,received:r.parsedType}),se;let n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return it(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};kr.create=(e,t)=>new kr({type:e,typeName:ce.ZodPromise,...me(t)});var It=class extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{J(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(s){if(r.value==="aborted")return se;let c=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?se:c.status==="dirty"?tn(c.value):r.value==="dirty"?tn(c.value):c});return function(_x77){return _ref38.apply(this,arguments)}}());{if(r.value==="aborted")return se;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?tn(s.value):r.value==="dirty"?tn(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?se:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ir(a))return se;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Ir(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):se);Ae.assertNever(o)}};It.create=(e,t,r)=>new It({schema:e,typeName:ce.ZodEffects,effect:t,...me(r)});It.createWithPreprocess=(e,t,r)=>new It({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...me(r)});var Et=class extends ye{_parse(t){return this._getType(t)===Z.undefined?it(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:ce.ZodOptional,...me(t)});var Gt=class extends ye{_parse(t){return this._getType(t)===Z.null?it(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:ce.ZodNullable,...me(t)});var gn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};gn.create=(e,t)=>new gn({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var hn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ao(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var Io=class extends ye{_parse(t){if(this._getType(t)!==Z.nan){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.nan,received:n.parsedType}),se}return{status:"valid",value:t.data}}};Io.create=e=>new Io({typeName:ce.ZodNaN,...me(e)});var eI=Symbol("zod_brand"),ji=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Li=class e extends ye{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?se:i.status==="dirty"?(r.dirty(),tn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?se:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ce.ZodPipeline})}},yn=class extends ye{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ir(o)&&(o.value=Object.freeze(o.value)),o);return Ao(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:ce.ZodReadonly,...me(t)});function Hh(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Xh(e,t={},r){return e?_r.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Hh(t,n),c=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:c})}});if(!i){let a=Hh(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):_r.create()}var tI={object:ht.lazycreate},ce;(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"})(ce||(ce={}));var rI=(e,t={message:`Input not instance of ${e.name}`})=>Xh(r=>r instanceof e,t),Jh=Tr.create,Zh=rn.create,nI=Io.create,oI=nn.create,ey=on.create,iI=an.create,aI=xo.create,sI=sn.create,cI=cn.create,uI=_r.create,lI=ar.create,dI=Pt.create,fI=Co.create,pI=sr.create,mI=ht.create,gI=ht.strictCreate,hI=un.create,yI=Rs.create,vI=ln.create,SI=$t.create,bI=Is.create,AI=Eo.create,wI=Ro.create,xI=Ts.create,CI=dn.create,EI=fn.create,RI=pn.create,II=mn.create,TI=kr.create,_I=It.create,kI=Et.create,OI=Gt.create,PI=It.createWithPreprocess,NI=Li.create,FI=()=>Jh().optional(),DI=()=>Zh().optional(),MI=()=>ey().optional(),qI={string:e=>Tr.create({...e,coerce:!0}),number:e=>rn.create({...e,coerce:!0}),boolean:e=>on.create({...e,coerce:!0}),bigint:e=>nn.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var jI=se;var LI=R.object({name:R.string(),arguments:R.string()}),VI=R.object({id:R.string(),type:R.literal("function"),function:LI,encryptedValue:R.string().optional()}),_s=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),UI=R.object({type:R.literal("text"),text:R.string()}),ty=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),ry=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},A4=ty.superRefine((e,t)=>{ry(e,t)}),BI=R.discriminatedUnion("type",[UI,ty]),$I=BI.superRefine((e,t)=>{e.type==="binary"&&ry(e,t)}),GI=_s.extend({role:R.literal("developer"),content:R.string()}),QI=_s.extend({role:R.literal("system"),content:R.string()}),HI=_s.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(VI).optional()}),zI=_s.extend({role:R.literal("user"),content:R.union([R.string(),R.array($I)])}),WI=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),KI=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),YI=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),ny=R.discriminatedUnion("role",[GI,QI,HI,zI,WI,KI,YI]),w4=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),XI=R.object({description:R.string(),value:R.string()}),JI=R.object({name:R.string(),description:R.string(),parameters:R.any()}),ZI=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(ny),tools:R.array(JI),context:R.array(XI),forwardedProps:R.any()}),eT=R.any(),qe=class extends Error{constructor(e){super(e)}},Rd=class extends qe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},oy=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.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}({}),Re=R.object({type:R.nativeEnum(F),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),tT=Re.extend({type:R.literal(F.TEXT_MESSAGE_START),messageId:R.string(),role:oy.default("assistant")}),iy=Re.extend({type:R.literal(F.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),rT=Re.extend({type:R.literal(F.TEXT_MESSAGE_END),messageId:R.string()}),nT=Re.extend({type:R.literal(F.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:oy.optional(),delta:R.string().optional()}),oT=Re.extend({type:R.literal(F.THINKING_TEXT_MESSAGE_START)}),iT=iy.omit({messageId:!0,type:!0}).extend({type:R.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),aT=Re.extend({type:R.literal(F.THINKING_TEXT_MESSAGE_END)}),sT=Re.extend({type:R.literal(F.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),cT=Re.extend({type:R.literal(F.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),uT=Re.extend({type:R.literal(F.TOOL_CALL_END),toolCallId:R.string()}),lT=Re.extend({messageId:R.string(),type:R.literal(F.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),dT=Re.extend({type:R.literal(F.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),fT=Re.extend({type:R.literal(F.THINKING_START),title:R.string().optional()}),pT=Re.extend({type:R.literal(F.THINKING_END)}),mT=Re.extend({type:R.literal(F.STATE_SNAPSHOT),snapshot:eT}),gT=Re.extend({type:R.literal(F.STATE_DELTA),delta:R.array(R.any())}),hT=Re.extend({type:R.literal(F.MESSAGES_SNAPSHOT),messages:R.array(ny)}),yT=Re.extend({type:R.literal(F.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),vT=Re.extend({type:R.literal(F.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),ST=Re.extend({type:R.literal(F.RAW),event:R.any(),source:R.string().optional()}),bT=Re.extend({type:R.literal(F.CUSTOM),name:R.string(),value:R.any()}),AT=Re.extend({type:R.literal(F.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:ZI.optional()}),wT=Re.extend({type:R.literal(F.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),xT=Re.extend({type:R.literal(F.RUN_ERROR),message:R.string(),code:R.string().optional()}),CT=Re.extend({type:R.literal(F.STEP_STARTED),stepName:R.string()}),ET=Re.extend({type:R.literal(F.STEP_FINISHED),stepName:R.string()}),RT=R.union([R.literal("tool-call"),R.literal("message")]),IT=Re.extend({type:R.literal(F.REASONING_START),messageId:R.string()}),TT=Re.extend({type:R.literal(F.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),_T=Re.extend({type:R.literal(F.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),kT=Re.extend({type:R.literal(F.REASONING_MESSAGE_END),messageId:R.string()}),OT=Re.extend({type:R.literal(F.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),PT=Re.extend({type:R.literal(F.REASONING_END),messageId:R.string()}),NT=Re.extend({type:R.literal(F.REASONING_ENCRYPTED_VALUE),subtype:RT,entityId:R.string(),encryptedValue:R.string()}),ks=R.discriminatedUnion("type",[tT,iy,rT,nT,fT,pT,oT,iT,aT,sT,cT,uT,dT,lT,mT,gT,hT,yT,vT,ST,bT,AT,wT,xT,CT,ET,IT,TT,_T,kT,OT,PT,NT]);m();d();p();f();var Id={};Wo(Id,{JsonPatchError:()=>Ue,_areEquals:()=>Bi,applyOperation:()=>vn,applyPatch:()=>Or,applyReducer:()=>jT,deepClone:()=>MT,getValueByPointer:()=>Ds,validate:()=>sy,validator:()=>Ms});m();d();p();f();m();d();p();f();var FT=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),DT=Object.prototype.hasOwnProperty;function Ps(e,t){return DT.call(e,t)}function Ns(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Ps(e,o)&&n.push(o);return n}function nt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Fs(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function Qt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vi(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Os(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Os(e[t]))return!0}else if(typeof e=="object"){for(var n=Ns(e),o=n.length,i=0;i<o;i++)if(Os(e[n[i]]))return!0}}return!1}function ay(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
32
- `)}var Ui=function(e){FT(t,e);function t(r,n,o,i,a){var s=this.constructor,c=e.call(this,ay(r,{name:n,index:o,operation:i,tree:a}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=a,Object.setPrototypeOf(c,s.prototype),c.message=ay(r,{name:n,index:o,operation:i,tree:a}),c}return t}(Error);var Ue=Ui,MT=nt,To={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ds(r,this.path);n&&(n=nt(n));var o=vn(r,{op:"remove",path:this.from}).removed;return vn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ds(r,this.from);return vn(r,{op:"add",path:this.path,value:nt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Bi(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},qT={add:function(e,t,r){return Fs(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:To.move,copy:To.copy,test:To.test,_get:To._get};function Ds(e,t){if(t=="")return e;var r={op:"_get",path:t};return vn(e,r),r.value}function vn(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ms(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=Ds(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=Bi(e,t.value),a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=nt(e));var s=t.path||"",c=s.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=Ms;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=Vi(g)),o&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!Fs(g))throw new Ue("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);Fs(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Ue("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=qT[t.op].call(t,u,g,e);if(a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=v){var a=To[t.op].call(t,u,g,e);if(a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Ue("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Or(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=nt(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=vn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function jT(e,t,r){var n=vn(e,t);if(n.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Ms(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ue("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(To[e.op]){if(typeof e.path!="string")throw new Ue("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ue("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ue("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ue("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Os(e.value))throw new Ue("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Ue("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Ue("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=sy([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ue("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function sy(e,t,r){try{if(!Array.isArray(e))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Or(nt(t),nt(e),r||!0);else{r=r||Ms;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ue)return o;throw o}}function Bi(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Bi(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!Bi(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Od={};Wo(Od,{compare:()=>HT,generate:()=>Td,observe:()=>QT,unobserve:()=>GT});m();d();p();f();var _d=new WeakMap,LT=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),VT=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function UT(e){return _d.get(e)}function BT(e,t){return e.observers.get(t)}function $T(e,t){e.observers.delete(t.callback)}function GT(e,t){t.unobserve()}function QT(e,t){var r=[],n,o=UT(e);if(!o)o=new LT(e),_d.set(e,o);else{var i=BT(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=nt(e),t){n.callback=t,n.next=null;var a=function(){Td(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){Td(n),clearTimeout(n.next),$T(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new VT(t,n)),n}function Td(e,t){t===void 0&&(t=!1);var r=_d.get(e.object);kd(r.value,e.object,e.patches,"",t),e.patches.length&&Or(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function kd(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Ns(t),a=Ns(e),s=!1,c=!1,u=a.length-1;u>=0;u--){var h=a[u],v=e[h];if(Ps(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?kd(v,S,r,n+"/"+Qt(h),o):v!==S&&(s=!0,o&&r.push({op:"test",path:n+"/"+Qt(h),value:nt(v)}),r.push({op:"replace",path:n+"/"+Qt(h),value:nt(S)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Qt(h),value:nt(v)}),r.push({op:"remove",path:n+"/"+Qt(h)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!c&&i.length==a.length))for(var u=0;u<i.length;u++){var h=i[u];!Ps(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Qt(h),value:nt(t[h])})}}}function HT(e,t,r){r===void 0&&(r=!1);var n=[];return kd(e,t,n,"",r),n}var z4=Object.assign({},Id,Od,{JsonPatchError:Ui,deepClone:nt,escapePathComponent:Qt,unescapePathComponent:Vi});m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Pd=function(e,t){return Pd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Pd(e,t)};function Ht(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Pd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function cy(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}function qs(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function cr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _o(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function ko(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Sn(e){return this instanceof Sn?(this.v=e,this):new Sn(e)}function uy(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(g){return function(y){return Promise.resolve(y).then(g,v)}}function s(g,y){n[g]&&(o[g]=function(x){return new Promise(function(E,C){i.push([g,x,E,C])>1||c(g,x)})},y&&(o[g]=y(o[g])))}function c(g,y){try{u(n[g](y))}catch(x){S(i[0][3],x)}}function u(g){g.value instanceof Sn?Promise.resolve(g.value.v).then(h,v):S(i[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function ly(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof cr=="function"?cr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,c){a=e[i](a),o(s,c,a.done,a.value)})}}function o(i,a,s,c){Promise.resolve(c).then(function(u){i({value:u,done:s})},a)}}m();d();p();f();function Se(e){return typeof e=="function"}m();d();p();f();m();d();p();f();m();d();p();f();function Oo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var js=Oo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
30
+ `;function Zx(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var eC=["1",1,"yes",!0];function za(){let e=[];return il()&&e.push(window.doNotTrack),vl()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>eC.indexOf(t)!==-1)}var qm="v15",Lm={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function tC(e=Lm.default,t=qm,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var rC="38824e1f-37f5-42d3-8372-a4b8fa9df946",Ut=class{get defaultOptions(){return{endpoint:Lm.default,isCustomEndpoint:!1,token:"",version:qm,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Fm}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=[$w,Lw].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};za()?this.runtime=new Ha:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(ve.view,{newEventType:ve.view,addClientIdParameter:!0}),this.addEventTypeMapping(ve.click,{newEventType:ve.click,addClientIdParameter:!0}),this.addEventTypeMapping(ve.custom,{newEventType:ve.custom,addClientIdParameter:!0}),this.addEventTypeMapping(ve.search,{newEventType:ve.search,addClientIdParameter:!0})}initRuntime(t){return il()&&eo()?new hl(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(Zx()&&console.warn(Jx),new yl(t))}get storage(){return this.runtime.storage}determineVisitorId(){return M(this,void 0,void 0,function*(){try{return il()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Xr()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Xr()}})}getCurrentVisitorId(){return M(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return M(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return M(this,void 0,void 0,function*(){if(Ba(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Am(t,Am(r,rC)))}})}getParameters(t,...r){return M(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return M(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Xr()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(za())return null;try{let r=new URL(t).searchParams.get(yr.cvo_cid);if(r==null)return null;let n=yr.fromString(r);return!n||!eo()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return M(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:i=!1,addClientIdParameter:a=!1}=this.eventTypeMapping[t]||{};return yield[g=>n.length>0?this.parseVariableArgumentsPayload(n,g):g[0],g=>M(this,void 0,void 0,function*(){return Object.assign(Object.assign({},g),{visitorId:o?yield this.getCurrentVisitorId():""})}),g=>M(this,void 0,void 0,function*(){return a?Object.assign(Object.assign({},g),{clientId:yield this.getCurrentVisitorId()}):g}),g=>i?this.ensureAnonymousUserWhenUsingApiKey(g):g,g=>this.beforeSendHooks.reduce((y,x)=>M(this,void 0,void 0,function*(){let E=yield y;return yield x(t,E)}),g)].reduce((g,y)=>M(this,void 0,void 0,function*(){let x=yield g;return yield y(x)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return M(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[v=>this.setTrackingIdIfTrackingIdNotPresent(v),v=>this.removeEmptyPayloadValues(v,t),v=>this.validateParams(v,t),v=>n?Bx(v):v,v=>n?this.removeUnknownParameters(v):v,v=>n?this.processCustomParameters(v):this.mapCustomParametersToCustomData(v)].reduce((v,S)=>M(this,void 0,void 0,function*(){let g=yield v;return yield S(g)}),Promise.resolve(r))})}makeEvent(t,...r){return M(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),i=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:i,log:a=>M(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},i),a)}),yield Promise.all(this.afterSendHooks.map(s=>s(t,Object.assign(Object.assign({},o),a)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return M(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return M(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Ua().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.search,t)})}sendSearchEvent(t){return M(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=er(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.click,t)})}sendClickEvent(t){return M(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=er(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.custom,t)})}sendCustomEvent(t){return M(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=er(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return M(this,void 0,void 0,function*(){return this.makeEvent(ve.view,t)})}sendViewEvent(t){return M(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return M(this,void 0,void 0,function*(){let r=yield(yield A(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return M(this,void 0,void 0,function*(){return yield(yield A(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,i=r.length;o<i;o++){let a=r[o];if(typeof a=="string")n[t[o]]=a;else if(typeof a=="object")return Object.assign(Object.assign({},n),a)}return n}isKeyAllowedEmpty(t,r){return({[ve.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,i)=>Object.assign(Object.assign({},o),{[i]:t[i]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(Hx(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=er(t,["custom"]),o={};r&&Va(r)&&(o=this.lowercaseKeys(r));let i=zx(n);return Object.assign(Object.assign({},o),i)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=er(t,["custom"]);if(r&&Va(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=er(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==ve.view||r==ve.click||r==ve.search||r==ve.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==ve.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=er(t,["userId"]);return Xx(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=er(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Va(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Va(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?ix(t,r):t}get baseUrl(){return tC(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},tr;(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"})(tr||(tr={}));var L;(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.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.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(L||(L={}));var Tm={[L.triggerNotify]:"queryPipelineTriggers",[L.triggerExecute]:"queryPipelineTriggers",[L.triggerQuery]:"queryPipelineTriggers",[L.triggerRedirect]:"queryPipelineTriggers",[L.queryErrorBack]:"errors",[L.queryErrorClear]:"errors",[L.queryErrorRetry]:"errors",[L.pagerNext]:"getMoreResults",[L.pagerPrevious]:"getMoreResults",[L.pagerNumber]:"getMoreResults",[L.pagerResize]:"getMoreResults",[L.pagerScrolling]:"getMoreResults",[L.facetSearch]:"facet",[L.facetShowLess]:"facet",[L.facetShowMore]:"facet",[L.recommendation]:"recommendation",[L.likeSmartSnippet]:"smartSnippet",[L.dislikeSmartSnippet]:"smartSnippet",[L.expandSmartSnippet]:"smartSnippet",[L.collapseSmartSnippet]:"smartSnippet",[L.openSmartSnippetFeedbackModal]:"smartSnippet",[L.closeSmartSnippetFeedbackModal]:"smartSnippet",[L.sendSmartSnippetReason]:"smartSnippet",[L.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[L.clearRecentQueries]:"recentQueries",[L.recentResultClick]:"recentlyClickedDocuments",[L.clearRecentResults]:"recentlyClickedDocuments",[L.showLessFoldedResults]:"folding",[L.caseDetach]:"case",[L.likeGeneratedAnswer]:"generatedAnswer",[L.dislikeGeneratedAnswer]:"generatedAnswer",[L.openGeneratedAnswerSource]:"generatedAnswer",[L.generatedAnswerStreamEnd]:"generatedAnswer",[L.generatedAnswerSourceHover]:"generatedAnswer",[L.generatedAnswerCopyToClipboard]:"generatedAnswer",[L.generatedAnswerHideAnswers]:"generatedAnswer",[L.generatedAnswerShowAnswers]:"generatedAnswer",[L.generatedAnswerExpand]:"generatedAnswer",[L.generatedAnswerCollapse]:"generatedAnswer",[L.generatedAnswerFeedbackSubmit]:"generatedAnswer",[L.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[tr.expandToFullUI]:"interface",[tr.openUserActions]:"User Actions",[tr.showPrecedingSessions]:"User Actions",[tr.showFollowingSessions]:"User Actions",[tr.clickViewedDocument]:"User Actions",[tr.clickPageView]:"User Actions",[tr.createArticle]:"createArticle"},no=class{constructor(){this.runtime=new Ha,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(ve.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(ve.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(ve.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(ve.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Fm}};function nC(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function oC(e){return e.map(t=>t.replace(/;/g,""))}function Vm(e){let r=e.join(";");return r.length<=256?r:Vm(e.slice(1))}var _m=e=>{let t=oC(e),r=nC(t);return Vm(r)};function km(e){let t=typeof e.partialQueries=="string"?e.partialQueries:_m(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:_m(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Wa=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||za();this.coveoAnalyticsClient=n?new no:new Ut(t)}disable(){this.coveoAnalyticsClient=new no}enable(){this.coveoAnalyticsClient=new Ut(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(L.interfaceLoad)}logInterfaceLoad(){return M(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(L.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(L.recommendation)}logRecommendation(){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(L.recommendationOpen,t,r)}logRecommendationOpen(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(L.staticFilterClearAll,t)}logStaticFilterClearAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(L.staticFilterSelect,t)}logStaticFilterSelect(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(L.staticFilterDeselect,t)}logStaticFilterDeselect(t){return M(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(L.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return M(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(L.interfaceChange,t)}logInterfaceChange(t){return M(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(L.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return M(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(L.didyoumeanClick)}logDidYouMeanClick(){return M(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(L.resultsSort,t)}logResultsSort(t){return M(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(L.searchboxSubmit)}logSearchboxSubmit(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(L.searchboxClear)}logSearchboxClear(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(L.searchboxAsYouType)}logSearchboxAsYouType(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(L.breadcrumbFacet,t)}logBreadcrumbFacet(t){return M(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(L.breadcrumbResetAll)}logBreadcrumbResetAll(){return M(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(L.documentQuickview,t,r)}logDocumentQuickview(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(L.documentOpen,t,r)}logDocumentOpen(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(L.omniboxAnalytics,km(t))}logOmniboxAnalytics(t){return M(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(L.omniboxFromLink,km(t))}logOmniboxFromLink(t){return M(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(L.searchFromLink)}logSearchFromLink(){return M(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(L.triggerNotify,t)}logTriggerNotify(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(L.triggerExecute,t)}logTriggerExecute(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(L.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(L.undoTriggerQuery,t)}logUndoTriggerQuery(t){return M(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(L.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return M(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(L.pagerResize,t)}logPagerResize(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(L.pagerNumber,t)}logPagerNumber(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(L.pagerNext,t)}logPagerNext(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(L.pagerPrevious,t)}logPagerPrevious(t){return M(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(L.pagerScrolling)}logPagerScrolling(){return M(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(L.facetClearAll,t)}logFacetClearAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(L.facetSearch,t)}logFacetSearch(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(L.facetSelect,t)}logFacetSelect(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(L.facetDeselect,t)}logFacetDeselect(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(L.facetExclude,t)}logFacetExclude(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(L.facetUnexclude,t)}logFacetUnexclude(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(L.facetSelectAll,t)}logFacetSelectAll(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(L.facetUpdateSort,t)}logFacetUpdateSort(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(L.facetShowMore,t)}logFacetShowMore(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(L.facetShowLess,t)}logFacetShowLess(t){return M(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(L.queryError,t)}logQueryError(t){return M(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorBack);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorBack)})}})}logQueryErrorBack(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorRetry);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorRetry)})}})}logQueryErrorRetry(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return M(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(L.queryErrorClear);return{description:t.description,log:()=>M(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(L.queryErrorClear)})}})}logQueryErrorClear(){return M(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(L.likeSmartSnippet)}logLikeSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(L.dislikeSmartSnippet)}logDislikeSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(L.expandSmartSnippet)}logExpandSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(L.collapseSmartSnippet)}logCollapseSmartSnippet(){return M(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(L.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(L.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return M(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(L.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(L.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(L.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(L.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(L.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return M(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(L.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(L.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(L.copyToClipboard,t,r)}logCopyToClipboard(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(L.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(L.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(L.recentQueryClick)}logRecentQueryClick(){return M(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(L.clearRecentQueries)}logClearRecentQueries(){return M(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(L.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(L.clearRecentResults)}logClearRecentResults(){return M(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(L.noResultsBack)}logNoResultsBack(){return M(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(L.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(L.showLessFoldedResults)}logShowLessFoldedResults(){return M(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return M(this,arguments,void 0,function*(n,o,i=Tm[n]){this.coveoAnalyticsClient.getParameters;let a=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),s=Object.assign(Object.assign({},yield this.getBaseEventRequest(a)),{eventType:i,eventValue:n}),c=yield this.coveoAnalyticsClient.makeCustomEvent(s);return{description:this.makeEventDescription(c,n),log:({searchUID:u})=>c.log({lastSearchQueryUid:u})}})}logCustomEvent(t,r){return M(this,arguments,void 0,function*(n,o,i=Tm[n]){return(yield this.makeCustomEvent(n,o,i)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return M(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),i=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),a=yield this.coveoAnalyticsClient.makeCustomEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({lastSearchQueryUid:s})}})}logCustomEventWithType(t,r,n){return M(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return M(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:i})=>o.log({searchQueryUid:i})}})}makeClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){let i=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),a=yield this.coveoAnalyticsClient.makeClickEvent(i);return{description:this.makeEventDescription(a,t),log:({searchUID:s})=>a.log({searchQueryUid:s})}})}logClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return M(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return M(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof Ut?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(L.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(L.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(L.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return M(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(L.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(L.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(L.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(L.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(L.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(L.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(L.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(L.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(L.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(L.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return M(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(L.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return M(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(L.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return M(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Ka=Object.assign({},mi),Om=Object.keys(Ka).map(e=>Ka[e]),to=class extends cl{constructor({client:t,uuidGenerator:r=Xr}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>Om.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(Om.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Ka.pageview,{newEventType:ve.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Ka.event,{newEventType:ve.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),i=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},i),o),r)}getTicketPayload(){return lx(this.ticket)}};to.Id="svc";var Ya;(function(e){e.click="click",e.flowStart="flowStart"})(Ya||(Ya={}));var xt;(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"})(xt||(xt={}));var Xa;(function(e){e.quit="Quit",e.solved="Solved"})(Xa||(Xa={}));var Ja=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!za();this.coveoAnalyticsClient=o?new Ut(t):new no,this.svc=new to({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new no,this.svc=new to({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Ut(this.options),this.svc=new to({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(xt.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(xt.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(xt.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(xt.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(xt.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(xt.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(xt.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(xt.caseCancelled,{reason:Xa.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(xt.caseSolved,{reason:Xa.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(xt.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ya.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ya.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return M(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof Ut?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,i;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(i=this.provider)===null||i===void 0?void 0:i.getOriginLevel3()}}logClickEvent(t,r,n,o){return M(this,void 0,void 0,function*(){var i,a;let s=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(a=(i=this.provider)===null||i===void 0?void 0:i.getSearchUID())!==null&&a!==void 0?a:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(s)})}};var Um=e=>new Ut(e).getCurrentVisitorId(),yi=(e,t)=>typeof t=="function"?(...r)=>{let n=Jo(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,vi=(e,t)=>(...r)=>{let n=Jo(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function Za(){return{desiredCount:5,numberOfValues:8,set:{}}}m();d();f();p();m();d();f();p();m();d();f();p();function Bm(e){let{activeValue:t,ancestryMap:r}=iC(e);return t?aC(t,r):[]}function iC(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function aC(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}var sC=(e,t)=>e.categoryFacetSet[t]?.request;var Al=(e,t)=>{let r=sC(e,t);return Bm(r?.currentValues??[])};m();d();f();p();function es(){return{}}m();d();f();p();function ts(){return{}}m();d();f();p();function rs(){return{}}m();d();f();p();function ns(){return{}}function wl(e){return{facetSet:e.facetSet??ns(),categoryFacetSet:e.categoryFacetSet??es(),dateFacetSet:e.dateFacetSet??ts(),numericFacetSet:e.numericFacetSet??rs(),automaticFacetSet:e.automaticFacetSet??Za()}}var xl=e=>{let t=[];return lC(e).forEach((r,n)=>{let o=vC(e,r.facetId),i=hC(r,n+1);if(uC(r)){if(!!!Al(e,r.facetId).length)return;t.push({...i,...mC(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((a,s)=>{if(a.state==="idle")return;let c=Gm(a,s+1,o),u=cC(r)?$m(a):pC(a);t.push({...i,...c,...u})})}),dC(e).forEach((r,n)=>{let o=gC(r,n+1);r.values.forEach((i,a)=>{if(i.state==="idle")return;let s=Gm(i,a+1,"specific"),c=$m(i);t.push({...o,...s,...c})})}),t},cC=e=>e.type==="specific",uC=e=>e.type==="hierarchical",lC=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),dC=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Gm=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),pC=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),$m=e=>({displayValue:e.value,value:e.value}),fC=(e,t)=>Al(e,t).map(n=>n.value).join(";"),mC=(e,t)=>{let n=fC(e,t);return{value:n,valuePosition:1,displayValue:n}},gC=(e,t)=>({title:Qm(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),hC=(e,t)=>({title:Qm(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Qm=(e,t)=>`${e}_${t}`,yC=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,vC=(e,t)=>{let r=yC(e,t);return r?r.type:"specific"};m();d();f();p();m();d();f();p();var Cl=e=>e.configuration.search.locale,Hm=e=>e.configuration.search.timezone,zm=e=>e.configuration.accessToken,Wm=e=>e.configuration.organizationId,Km=e=>e.configuration.environment,os=e=>e.configuration?.knowledge?.agentId;var Jr=e=>{if(SC(e)||El(e))return e.generatedAnswer?.answerId;if(bC(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},SC=e=>"answer"in e&&"generatedAnswer"in e&&!ie(e.generatedAnswer?.answerConfigurationId),El=e=>{let t=os(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},bC=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Rl=e=>e.generatedAnswer?.fieldsToIncludeInCitations,AC=Ve(e=>e.generatedAnswer?.citations,(e,t)=>t,(e,t)=>e?.find(r=>r.id===t));m();d();f();p();var St=()=>({q:"",enableQuerySyntax:!1});m();d();f();p();m();d();f();p();var Ym=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Ym||{}),Xm=(i=>(i.Relevancy="relevancy",i.QRE="qre",i.Date="date",i.Field="field",i.NoSort="nosort",i))(Xm||{}),Il=e=>{if(Qp(e))return e.map(t=>Il(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""}},Jm=()=>({by:"relevancy"});var zq=new ee({values:{by:new Au({enum:Xm,required:!0}),order:new Au({enum:Ym}),field:new H}});function is(){return Il(Jm())}m();d();f();p();m();d();f();p();var oo=()=>"default";var wC=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},rr=class{constructor(t){this.getState=t;we(this,"state");this.state=t()}getLanguage(){return wC(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[i,a]of Object.entries(n)){let s=`context_${i}`;o[s]=a}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=$n),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||oo()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var Si=class Si extends rr{constructor(){super(...arguments);we(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return xl(wl(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Si.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||Mt().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Si.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Jr(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetValue:n,facetTitle:`${i}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,criteria:n,facetTitle:`${i}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:i,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${i}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??is()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let i=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:i,categoryFacetPath:n,categoryFacetTitle:`${i}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],i=o.completions.map(u=>u.expression),a=o.partialQueries.length-1,s=o.partialQueries[a]||"",c=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:i.indexOf(n),partialQuery:s,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:i.length>0?i:"",querySuggestResponseId:c}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||St().q}get responseTime(){return this.state.search?.duration||Mt().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||Mt().response.totalCountFiltered}};we(Si,"fallbackPipelineName","default");var vr=Si,Zm=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),c=i.configuration.analytics.runtimeEnvironment,u=i.configuration.analytics.enabled,h=new Wa({token:a,endpoint:s,runtimeEnvironment:c,preprocessRequest:yi(e,n),beforeSendHooks:[vi(e,r),(v,S)=>(e.info({...S,type:v,endpoint:s,token:a},"Analytics request"),S)]},o);return u||h.disable(),h},Tl=()=>{let t=wt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var as=/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Um(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Tl()&&{pageId:Tl()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Zn(e)})}}});return function as(_x17,_x18){return _ref10.apply(this,arguments)}}();m();d();f();p();m();d();f();p();m();d();f();p();var io=()=>({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[],searchUid:"",splitTestRun:"",pipeline:""});var bi=class extends rr{getPipeline(){return this.state.pipeline||this.state.recommendation?.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:St().q,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getSearchUID(){return this.getState().recommendation?.searchUid||io().searchUid}getSplitTestRunName(){return this.state.recommendation?.splitTestRun}getSplitTestRunVersion(){let t=!!this.getSplitTestRunName(),r=this.state.recommendation?.pipeline||this.state.pipeline||"default";return t?r:void 0}get responseTime(){return this.state.recommendation?.duration||io().duration}mapResultsToAnalyticsDocument(){return this.state.recommendation?.recommendations.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.recommendation?.recommendations.length||io().recommendations.length}};m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();function eg(){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 tg=/^(?:[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 xC(e){return typeof e=="string"&&tg.test(e)}var _l=xC;m();d();f();p();var et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function rg(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()}m();d();f();p();var kl,CC=new Uint8Array(16);function Ol(){if(!kl){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");kl=crypto.getRandomValues.bind(crypto)}return kl(CC)}m();d();f();p();m();d();f();p();var EC=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Pl={randomUUID:EC};function RC(e,t,r){e=e||{};let n=e.random??e.rng?.()??Ol();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return rg(n)}function IC(e,t,r){return Pl.randomUUID&&!t&&!e?Pl.randomUUID():RC(e,t,r)}var Nl=IC;function TC(_x19){return _TC.apply(this,arguments)}function _TC(){_TC=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:i,mode:a}=e;if(a!=="disabled")return n.call(r),t.send(o,i,r)});return _TC.apply(this,arguments)}var cg="2.0.4",Fl=128,ug=192,ng=224,og=240,_C=248;function kC(e){return(e&_C)===og?4:(e&og)===ng?3:(e&ng)===ug?2:1}function OC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&Fl)!=Fl)break;if(r-=3,(n&ug)!=Fl){t-r>=kC(n)*3&&(r=t);break}}return e.substring(0,r)}function PC(e){let{trackingId:t}=e;return{trackingId:t}}function NC(e){return(e.source||[]).concat([`relay@${cg}`])}function lg(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:i}=r,a=PC(t),s=r.getClientId();return Object.freeze({type:e,config:a,ts:Date.now(),source:NC(t),clientId:s,userAgent:i(),referrer:ig(n()),location:ig(o())})}function ig(e){return e!==null?OC(e,1024):null}function FC(e,t,r,n){return{...t,meta:lg(e,r,n)}}var DC="*";function MC(){let e=[];function t({type:c,callback:u}){return e.findIndex(h=>h.type===c&&h.callback===u)}function r(c,u){return c.type==="*"||u===c.type}function n(c){return t(c)<0&&e.push(c),()=>s(c.type,c.callback)}function o(c){e.forEach(u=>{if(r(u,c.meta.type))try{u.callback(c)}catch(h){console.error(h)}})}function i(c){if(c===DC)e.length=0;else for(let u=e.length-1;u>=0;u--)e[u].type===c&&e.splice(u,1)}function a(c){let u=t(c);u>=0&&e.splice(u,1)}function s(c,u){u?a({type:c,callback:u}):i(c)}return{add:n,call:o,remove:s}}function ag({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function jC(e){let t=ag(e);return{get:()=>t,update:r=>{t=ag({...t,...r})}}}var Dl=qC();function qC(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let i of o){let a=i.replace(/^\s+/,"");if(a.lastIndexOf(n,0)===0)return a.substring(n.length,a.length)}return null},setItem(r,n,o){let i=t(window.location.hostname),a=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,s=i?`;domain=${i}`:"";document.cookie=`${e}${r}=${n}${a}${s};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function LC(){return{getItem(e){return Dl.getItem(e)||localStorage.getItem(e)},removeItem(e){Dl.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Dl.setItem(e,t,31556952e3)}}}var sg="visitorId";function VC(){let e=document.referrer;return e===""?null:e}function Ml(){let e=LC();return{runtime:"browser",send:function(){var _ref11=_asyncToGenerator(function*(t,r,n){let o=A(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});eg().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let a=yield o;if(a?.ok){let s;try{s=yield a.json()}catch{return}for(let c of s.events)if(!c.accepted)throw new Error(`Received event was rejected for processing: ${c.errorMessage}`)}else throw new Error(`Error ${a.status}: Failed to send the event(s).`)});return function send(_x20,_x21,_x22){return _ref11.apply(this,arguments)}}(),getReferrer:()=>VC(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(sg);if(t&&_l(t))return t;let r=Nl();return e.setItem(sg,r),r}}}function UC(){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 BC(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function GC(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=BC();return t&&r?{...r,runtime:"custom"}:t&&$C()&&UC()?Ml():n}function $C(){try{return typeof window=="object"}catch{return!1}}function QC(e){return{get:()=>Object.freeze(GC(e))}}function dg(e){let t=jC(e),r=MC(),n=QC(t);return{emit:function(){var _ref12=_asyncToGenerator(function*(o,i){let a=t.get(),s=n.get(),c=FC(o,i,a,s);return TC({config:a,environment:s,event:c,listenerManager:r})});return function emit(_x23,_x24){return _ref12.apply(this,arguments)}}(),getMeta:o=>lg(o,t.get(),n.get()),on:(o,i)=>r.add({type:o,callback:i}),off:(o,i)=>r.remove(o,i),updateConfig:o=>t.update(o),version:cg}}m();d();f();p();function pg(){return typeof window<"u"&&typeof document<"u"}var Ai=Ve(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Zn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:i},a,s)=>{let c=zC(s);return dg({mode:i?"emit":"disabled",url:o??sa(e,t),token:r,trackingId:n??null,source:a,environment:c})}),HC={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref13=_asyncToGenerator(function*(){});return function send(){return _ref13.apply(this,arguments)}}()},zC=e=>{if(!e)return;let t=e();return{...(pg()?Ml():HC),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};m();d();f();p();var wi=class extends rr{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},fg=({logger:e,getState:t,analyticsClientMiddleware:r=(i,a)=>a,preprocessRequest:n,provider:o=new wi(t)})=>{let i=t(),a=i.configuration.accessToken,s=i.configuration.analytics.apiBaseUrl??We(i.configuration.organizationId,i.configuration.environment,"analytics"),c=i.configuration.analytics.runtimeEnvironment,u=i.configuration.analytics.enabled,h=new Ja({enableAnalytics:u,token:a,endpoint:s,runtimeEnvironment:c,preprocessRequest:yi(e,n),beforeSendHooks:[vi(e,r),(v,S)=>(e.info({...S,type:v,endpoint:s,token:a},"Analytics request"),S)]},o);return u||h.disable(),h};m();d();f();p();m();d();f();p();function mg(e,t){return{...new vr(t).getBaseMetadata(),actionCause:e,type:e}}function WC(e){return Object.assign(e,{instantlyCallable:!0})}function KC(e,t){let r=i=>WC(Ee(e,i)),n=r(/*#__PURE__*/function(){var _ref14=_asyncToGenerator(function*(i,{getState:a,extra:s}){let{analyticsClientMiddleware:c,preprocessRequest:u,logger:h}=s;return yield(yield t({getState:a,analyticsClientMiddleware:c,preprocessRequest:u,logger:h})).log({state:a(),extra:s})});return function(_x25,_x26){return _ref14.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref15=_asyncToGenerator(function*({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c}){let{description:u,log:h}=yield t({getState:i,analyticsClientMiddleware:a,preprocessRequest:s,logger:c});return{description:u,action:r(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(v,{getState:S,extra:g}){return yield h({state:S(),extra:g})});return function(_x28,_x29){return _ref16.apply(this,arguments)}}())}});return function prepare(_x27){return _ref15.apply(this,arguments)}}()}),n}var gg=(e,t,r)=>{function n(...o){let i=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return JC(i)}return n},YC=e=>e.configuration.analytics.analyticsMode==="legacy",XC=e=>e.configuration.analytics.analyticsMode==="next",JC=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:i,providerClass:a})=>(r??(r=s=>new a(s)),KC(e,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(function*({getState:s,analyticsClientMiddleware:c,preprocessRequest:u,logger:h}){let v=[],S={log:function(){var _ref18=_asyncToGenerator(function*({state:C}){for(let I of v)yield I(C)});return function log(_x31){return _ref18.apply(this,arguments)}}()},g=s(),y=i({getState:s,logger:h,analyticsClientMiddleware:c,preprocessRequest:u,provider:r(s)}),x=yield t(y,s());S.description=x?.description,v.push(/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(C){YC(C)&&(yield ZC(x,r,C,h,y.coveoAnalyticsClient))});return function(_x32){return _ref19.apply(this,arguments)}}());let{emit:E}=Ai(g);return v.push(/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(C){if(XC(C)&&o&&n){let I=n(C);yield aE(E,o,I)}});return function(_x33){return _ref20.apply(this,arguments)}}()),S});return function(_x30){return _ref17.apply(this,arguments)}}()));function ZC(_x34,_x35,_x36,_x37,_x38){return _ZC.apply(this,arguments)}function _ZC(){_ZC=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let i=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:i},"Analytics response")});return _ZC.apply(this,arguments)}var eE=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref21=_asyncToGenerator(function*(i){r(n,o)});return function log(_x39){return _ref21.apply(this,arguments)}}()}),ct=gg(e=>Zm({...e,provider:e.provider||new vr(e.getState)}),e=>e,vr),n1=gg(fg,eE("caseAssist"),wi);var jl=(e,t)=>{let r=t.recommendation?.recommendations.findIndex(({uniqueId:n})=>e.uniqueId===n)||0;return tE(e,r,t)};function tE(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:oE(e),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:iE(e),queryPipeline:r.pipeline||Kn()}}var ss=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||""}),hg={urihash:new H,sourcetype:new H,permanentid:new H},yg={uniqueId:X,raw:new ee({values:hg}),title:X,uri:X,clickUri:X,rankingModifier:new H({required:!1,emptyAllowed:!0})};function rE(e){return Object.assign({},...Object.keys(hg).map(t=>({[t]:e[t]})))}function nE(e){return Object.assign({},...Object.keys(yg).map(t=>({[t]:e[t]})),{raw:rE(e.raw)})}function oE(e){let t=e.raw.author;return ie(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function iE(e){let t=e.raw.source;return ie(t)?"unknown":t}var ql=e=>new lt(yg).validate(nE(e));function aE(_x40,_x41,_x42){return _aE.apply(this,arguments)}function _aE(){_aE=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _aE.apply(this,arguments)}m();d();f();p();var vg=()=>ct("analytics/recommendation/update",e=>e.makeRecommendationInterfaceLoad(),e=>new bi(e)),Sg=()=>({actionCause:"recommendationInterfaceLoad"}),us=e=>ct({prefix:"analytics/recommendation/open",__legacy__getBuilder:(t,r)=>(ql(e),t.makeRecommendationOpen(jl(e,r),ss(e))),__legacy__provider:t=>new bi(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=jl(e,t),n=ss(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});var ao=P("recommendation/set",e=>j(e,{id:X})),Sr=Ee("recommendation/get",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),i=Date.now(),a=yield sE(o),s=yield n.recommendations(a),c=Date.now()-i;return dt(s)?r(s.error):{recommendations:s.success.results,analyticsAction:vg(),duration:c,searchUid:s.success.searchUid,splitTestRun:s.success.splitTestRun,pipeline:s.success.pipeline}});return function(_x43,_x44){return _ref22.apply(this,arguments)}}()),sE=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(e.configuration.organizationId,e.configuration.environment),recommendation:e.recommendation.id,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,locale:e.configuration.search.locale,actionsHistory:e.configuration.analytics.enabled?wt.getInstance().getHistory():[],...(e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.context&&{context:e.context.contextValues}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.configuration.analytics.enabled&&(yield cE(e,Sg()))),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}),...(e.pagination&&{numberOfResults:e.pagination.numberOfResults})}});return function sE(_x45){return _ref23.apply(this,arguments)}}(),cE=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=e.configuration.analytics.analyticsMode==="legacy"?void 0:{actionCause:t.actionCause,type:t.actionCause};return yield as(e.configuration.analytics,r)});return function cE(_x46,_x47){return _ref24.apply(this,arguments)}}();var so=Me(io(),e=>{e.addCase(ao,(t,r)=>{t.id=r.payload.id}).addCase(Sr.rejected,(t,r)=>{t.error=r.payload?r.payload:null,t.isLoading=!1}).addCase(Sr.fulfilled,(t,r)=>{t.error=null,t.recommendations=r.payload.recommendations.map(n=>({...n,searchUid:r.payload.searchUid})),t.duration=r.payload.duration,t.isLoading=!1,t.searchUid=r.payload.searchUid,t.splitTestRun=r.payload.splitTestRun,t.pipeline=r.payload.pipeline}).addCase(Sr.pending,t=>{t.isLoading=!0}).addCase(Ma,(t,r)=>{t.error=r.payload,t.isLoading=!1})});m();d();f();p();var co=P("searchHub/set",e=>j(e,new H({required:!0,emptyAllowed:!0})));m();d();f();p();var uo=Me(oo(),e=>{e.addCase(co,(t,r)=>r.payload).addCase(mt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Lt,(t,r)=>r.payload.searchHub||t)});m();d();f();p();m();d();f();p();m();d();f();p();function bg(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}var Ag=jt;function Ng(e,t){if(e===t||!(Ag(e)&&Ag(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,i=Array.isArray(t)?[]:{};for(let a of r)i[a]=Ng(e[a],t[a]),o&&(o=e[a]===i[a]);return o?e:i}function lo(e){let t=0;for(let r in e)t++;return t}var wg=e=>[].concat(...e);function uE(e){return new RegExp("(^|:)//").test(e)}function lE(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ps(e){return e!=null}function dE(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var pE=e=>e.replace(/\/$/,""),fE=e=>e.replace(/^\//,"");function mE(e,t){if(!e)return t;if(!t)return e;if(uE(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=pE(e),t=fE(t),`${e}${r}${t}`}function gE(e,t,r){return e.has(t)?e.get(t):e.set(t,r).get(t)}var xg=(...e)=>A(...e),hE=e=>e.status>=200&&e.status<=299,yE=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Cg(e){if(!jt(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}function Fg({baseUrl:e,prepareHeaders:t=v=>v,fetchFn:r=xg,paramsSerializer:n,isJsonContentType:o=yE,jsonContentType:i="application/json",jsonReplacer:a,timeout:s,responseHandler:c,validateStatus:u,...h}={}){return typeof A>"u"&&r===xg&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(S,g,y){let{getState:x,extra:E,endpoint:C,forced:I,type:T}=g,_,{url:q,headers:N=new w(h.headers),params:k=void 0,responseHandler:O=c??"json",validateStatus:D=u??hE,timeout:V=s,...z}=typeof S=="string"?{url:S}:S,$,B=g.signal;V&&($=new l.AbortController,g.signal.addEventListener("abort",$.abort),B=$.signal);let U={...h,signal:B,...z};N=new w(Cg(N)),U.headers=(yield t(N,{getState:x,arg:S,extra:E,endpoint:C,forced:I,type:T,extraOptions:y}))||N;let Q=le=>typeof le=="object"&&(jt(le)||Array.isArray(le)||typeof le.toJSON=="function");if(!U.headers.has("content-type")&&Q(U.body)&&U.headers.set("content-type",i),Q(U.body)&&o(U.headers)&&(U.body=JSON.stringify(U.body,a)),k){let le=~q.indexOf("?")?"&":"?",he=n?n(k):new URLSearchParams(Cg(k));q+=le+he}q=mE(e,q);let G=new Request(q,U);_={request:new Request(q,U)};let Y,ne=!1,pe=$&&setTimeout(()=>{ne=!0,$.abort()},V);try{Y=yield r(G)}catch(le){return{error:{status:ne?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(le)},meta:_}}finally{pe&&clearTimeout(pe),$?.signal.removeEventListener("abort",$.abort)}let be=Y.clone();_.response=be;let de,fe="";try{let le;if(yield Promise.all([v(Y,O).then(he=>de=he,he=>le=he),be.text().then(he=>fe=he,()=>{})]),le)throw le}catch(le){return{error:{status:"PARSING_ERROR",originalStatus:Y.status,data:fe,error:String(le)},meta:_}}return D(Y,de)?{data:de,meta:_}:{error:{status:Y.status,data:de},meta:_}});return function(_x48,_x49,_x50){return _ref25.apply(this,arguments)}}());function v(_x51,_x52){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(S,g){if(typeof g=="function")return g(S);if(g==="content-type"&&(g=o(S.headers)?"json":"text"),g==="json"){let y=yield S.text();return y.length?JSON.parse(y):null}return S.text()});return _v2.apply(this,arguments)}}var po=class{constructor(e,t=void 0){this.value=e,this.meta=t}};function vE(){return _vE.apply(this,arguments)}function _vE(){_vE=_asyncToGenerator(function*(e=0,t=5){let r=Math.min(e,t),n=~~((Math.random()+.4)*(300<<r));yield new Promise(o=>setTimeout(i=>o(i),n))});return _vE.apply(this,arguments)}function SE(e,t){throw Object.assign(new po({error:e,meta:t}),{throwImmediately:!0})}var Eg={},bE=(e,t)=>(/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(r,n,o){let i=[5,(t||Eg).maxRetries,(o||Eg).maxRetries].filter(h=>h!==void 0),[a]=i.slice(-1),c={maxRetries:a,backoff:vE,retryCondition:(h,v,{attempt:S})=>S<=a,...t,...o},u=0;for(;;)try{let h=yield e(r,n,o);if(h.error)throw new po(h);return h}catch(h){if(u++,h.throwImmediately){if(h instanceof po)return h.value;throw h}if(h instanceof po&&!c.retryCondition(h.value.error,r,{attempt:u,baseQueryApi:n,extraOptions:o}))return h.value;yield c.backoff(u,c.maxRetries)}});return function(_x53,_x54,_x55){return _ref26.apply(this,arguments)}}()),Dg=Object.assign(bE,{fail:SE}),Gl=P("__rtkq/focused"),Mg=P("__rtkq/unfocused"),$l=P("__rtkq/online"),jg=P("__rtkq/offline");function Ql(e){return e.type==="query"}function AE(e){return e.type==="mutation"}function Hl(e){return e.type==="infinitequery"}function zl(e,t,r,n,o,i){return wE(e)?e(t,r,n,o).filter(ps).map(Vl).map(i):Array.isArray(e)?e.map(Vl).map(i):[]}function wE(e){return typeof e=="function"}function Vl(e){return typeof e=="string"?{type:e}:e}function xE(e,t){return e.catch(t)}var Ci=Symbol("forceQueryFn"),Ul=e=>typeof e[Ci]=="function";function CE({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:i}){let a=new Map,s=new Map,{unsubscribeQueryResult:c,removeMutationResult:u,updateSubscriptionOptions:h}=o.internalActions;return{buildInitiateQuery:C,buildInitiateInfiniteQuery:I,buildInitiateMutation:T,getRunningQueryThunk:v,getRunningMutationThunk:S,getRunningQueriesThunk:g,getRunningMutationsThunk:y};function v(_,q){return N=>{let k=i.endpointDefinitions[_],O=e({queryArgs:q,endpointDefinition:k,endpointName:_});return a.get(N)?.[O]}}function S(_,q){return N=>s.get(N)?.[q]}function g(){return _=>Object.values(a.get(_)||{}).filter(ps)}function y(){return _=>Object.values(s.get(_)||{}).filter(ps)}function x(_){}function E(_,q){let N=(k,{subscribe:O=!0,forceRefetch:D,subscriptionOptions:V,[Ci]:z,...$}={})=>(B,U)=>{let Q=e({queryArgs:k,endpointDefinition:q,endpointName:_}),G,K={...$,type:"query",subscribe:O,forceRefetch:D,subscriptionOptions:V,endpointName:_,originalArgs:k,queryCacheKey:Q,[Ci]:z};if(Ql(q))G=t(K);else{let{direction:Ce,initialPageParam:De}=$;G=r({...K,direction:Ce,initialPageParam:De})}let Y=o.endpoints[_].select(k),ne=B(G),pe=Y(U());let{requestId:be,abort:de}=ne,fe=pe.requestId!==be,le=a.get(B)?.[Q],he=()=>Y(U()),Le=Object.assign(z?ne.then(he):fe&&!le?Promise.resolve(pe):Promise.all([le,ne]).then(he),{arg:k,requestId:be,subscriptionOptions:V,queryCacheKey:Q,abort:de,unwrap(){return _asyncToGenerator(function*(){let Ce=yield Le;if(Ce.isError)throw Ce.error;return Ce.data})()},refetch:()=>B(N(k,{subscribe:!1,forceRefetch:!0})),unsubscribe(){O&&B(c({queryCacheKey:Q,requestId:be}))},updateSubscriptionOptions(Ce){Le.subscriptionOptions=Ce,B(h({endpointName:_,requestId:be,queryCacheKey:Q,options:Ce}))}});if(!le&&!fe&&!z){let Ce=gE(a,B,{});Ce[Q]=Le,Le.then(()=>{delete Ce[Q],lo(Ce)||a.delete(B)})}return Le};return N}function C(_,q){return E(_,q)}function I(_,q){return E(_,q)}function T(_){return(q,{track:N=!0,fixedCacheKey:k}={})=>(O,D)=>{let V=n({type:"mutation",endpointName:_,originalArgs:q,track:N,fixedCacheKey:k}),z=O(V);let{requestId:$,abort:B,unwrap:U}=z,Q=xE(z.unwrap().then(ne=>({data:ne})),ne=>({error:ne})),G=()=>{O(u({requestId:$,fixedCacheKey:k}))},K=Object.assign(Q,{arg:z.arg,requestId:$,abort:B,unwrap:U,reset:G}),Y=s.get(O)||{};return s.set(O,Y),Y[$]=K,K.then(()=>{delete Y[$],lo(Y)||s.delete(O)}),k&&(Y[k]=K,K.then(()=>{Y[k]===K&&(delete Y[k],lo(Y)||s.delete(O))})),K}}}function EE(e){return e}var ls=(e={})=>({...e,[li]:!0});function RE({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:i,selectors:a}){let s=(O,D,V,z)=>($,B)=>{let U=r[O],Q=n({queryArgs:D,endpointDefinition:U,endpointName:O});if($(o.internalActions.queryResultPatched({queryCacheKey:Q,patches:V})),!z)return;let G=o.endpoints[O].select(D)(B()),K=zl(U.providesTags,G.data,void 0,D,{},i);$(o.internalActions.updateProvidedBy({queryCacheKey:Q,providedTags:K}))};function c(O,D,V=0){let z=[D,...O];return V&&z.length>V?z.slice(0,-1):z}function u(O,D,V=0){let z=[...O,D];return V&&z.length>V?z.slice(1):z}let h=(O,D,V,z=!0)=>($,B)=>{let Q=o.endpoints[O].select(D)(B()),G={patches:[],inversePatches:[],undo:()=>$(o.util.patchQueryData(O,D,G.inversePatches,z))};if(Q.status==="uninitialized")return G;let K;if("data"in Q)if(ft(Q.data)){let[Y,ne,pe]=Sa(Q.data,V);G.patches.push(...ne),G.inversePatches.push(...pe),K=Y}else K=V(Q.data),G.patches.push({op:"replace",path:[],value:K}),G.inversePatches.push({op:"replace",path:[],value:Q.data});return G.patches.length===0||$(o.util.patchQueryData(O,D,G.patches,z)),G},v=(O,D,V)=>z=>z(o.endpoints[O].initiate(D,{subscribe:!1,forceRefetch:!0,[Ci]:()=>({data:V})})),S=(O,D)=>O.query&&O[D]?O[D]:EE,g=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(O,{signal:D,abort:V,rejectWithValue:z,fulfillWithValue:$,dispatch:B,getState:U,extra:Q}){let G=r[O.endpointName];try{let K=S(G,"transformResponse"),Y={signal:D,abort:V,dispatch:B,getState:U,extra:Q,endpoint:O.endpointName,type:O.type,forced:O.type==="query"?y(O,U()):void 0,queryCacheKey:O.type==="query"?O.queryCacheKey:void 0},ne=O.type==="query"?O[Ci]:void 0,pe,be=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(fe,le,he,Le){if(le==null&&fe.pages.length)return Promise.resolve({data:fe});let Ce={queryArg:O.originalArgs,pageParam:le},De=yield de(Ce),Be=Le?c:u;return{data:{pages:Be(fe.pages,De.data,he),pageParams:Be(fe.pageParams,le,he)}}});return function be(_x58,_x59,_x60,_x61){return _ref28.apply(this,arguments)}}();function de(_x62){return _de2.apply(this,arguments)}function _de2(){_de2=_asyncToGenerator(function*(fe){let le,{extraOptions:he}=G;if(ne?le=ne():G.query?le=yield t(G.query(fe),Y,he):le=yield G.queryFn(fe,Y,he,Ce=>t(Ce,Y,he)),typeof process<"u",le.error)throw new po(le.error,le.meta);let Le=yield K(le.data,le.meta,fe);return{...le,data:Le}});return _de2.apply(this,arguments)}if(O.type==="query"&&"infiniteQueryOptions"in G){let{infiniteQueryOptions:fe}=G,{maxPages:le=1/0}=fe,he,Le={pages:[],pageParams:[]},Ce=a.selectQueryEntry(U(),O.queryCacheKey)?.data,Be=y(O,U())&&!O.direction||!Ce?Le:Ce;if("direction"in O&&O.direction&&Be.pages.length){let ut=O.direction==="backward",lr=(ut?qg:Bl)(fe,Be);he=yield be(Be,lr,le,ut)}else{let{initialPageParam:ut=fe.initialPageParam}=O,bt=Ce?.pageParams??[],lr=bt[0]??ut,_n=bt.length;he=yield be(Be,lr,le),ne&&(he={data:he.data.pages[0]});for(let kn=1;kn<_n;kn++){let $o=Bl(fe,he.data);he=yield be(he.data,$o,le)}}pe=he}else pe=yield de(O.originalArgs);return $(pe.data,ls({fulfilledTimeStamp:Date.now(),baseQueryMeta:pe.meta}))}catch(K){let Y=K;if(Y instanceof po){let ne=S(G,"transformErrorResponse");try{return z(yield ne(Y.value,Y.meta,O.originalArgs),ls({baseQueryMeta:Y.meta}))}catch(pe){Y=pe}}throw typeof process<"u",console.error(Y),Y}});return function g(_x56,_x57){return _ref27.apply(this,arguments)}}();function y(O,D){let V=a.selectQueryEntry(D,O.queryCacheKey),z=a.selectConfig(D).refetchOnMountOrArgChange,$=V?.fulfilledTimeStamp,B=O.forceRefetch??(O.subscribe&&z);return B?B===!0||(Number(new Date)-Number($))/1e3>=B:!1}let x=()=>Ee(`${e}/executeQuery`,g,{getPendingMeta({arg:D}){let V=r[D.endpointName];return ls({startedTimeStamp:Date.now(),...(Hl(V)?{direction:D.direction}:{})})},condition(D,{getState:V}){let z=V(),$=a.selectQueryEntry(z,D.queryCacheKey),B=$?.fulfilledTimeStamp,U=D.originalArgs,Q=$?.originalArgs,G=r[D.endpointName],K=D.direction;return Ul(D)?!0:$?.status==="pending"?!1:y(D,z)||Ql(G)&&G?.forceRefetch?.({currentArg:U,previousArg:Q,endpointState:$,state:z})?!0:!(B&&!K)},dispatchConditionRejection:!0}),E=x(),C=x(),I=Ee(`${e}/executeMutation`,g,{getPendingMeta(){return ls({startedTimeStamp:Date.now()})}}),T=O=>"force"in O,_=O=>"ifOlderThan"in O,q=(O,D,V)=>(z,$)=>{let B=T(V)&&V.force,U=_(V)&&V.ifOlderThan,Q=(K=!0)=>{let Y={forceRefetch:K,isPrefetch:!0};return o.endpoints[O].initiate(D,Y)},G=o.endpoints[O].select(D)($());if(B)z(Q());else if(U){let K=G?.fulfilledTimeStamp;if(!K){z(Q());return}(Number(new Date)-Number(new Date(K)))/1e3>=U&&z(Q())}else z(Q(!1))};function N(O){return D=>D?.meta?.arg?.endpointName===O}function k(O,D){return{matchPending:Bn(Ea(O),N(D)),matchFulfilled:Bn(Jt(O),N(D)),matchRejected:Bn(Wr(O),N(D))}}return{queryThunk:E,mutationThunk:I,infiniteQueryThunk:C,prefetch:q,updateQueryData:h,upsertQueryData:v,patchQueryData:s,buildMatchThunkActions:k}}function Bl(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function qg(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function Lg(e,t,r,n){return zl(r[e.meta.arg.endpointName][t],Jt(e)?e.payload:void 0,pi(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ds(e,t,r){let n=e[t];n&&r(n)}function Ei(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Rg(e,t,r){let n=e[Ei(t)];n&&r(n)}var xi={};function IE({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:i,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:c,config:u}){let h=P(`${e}/resetApiState`);function v(N,k,O,D){var V;N[V=k.queryCacheKey]??(N[V]={status:"uninitialized",endpointName:k.endpointName}),ds(N,k.queryCacheKey,z=>{z.status="pending",z.requestId=O&&z.requestId?z.requestId:D.requestId,k.originalArgs!==void 0&&(z.originalArgs=k.originalArgs),z.startedTimeStamp=D.startedTimeStamp;let $=o[D.arg.endpointName];Hl($)&&"direction"in k&&(z.direction=k.direction)})}function S(N,k,O,D){ds(N,k.arg.queryCacheKey,V=>{if(V.requestId!==k.requestId&&!D)return;let{merge:z}=o[k.arg.endpointName];if(V.status="fulfilled",z){if(V.data!==void 0){let{fulfilledTimeStamp:$,arg:B,baseQueryMeta:U,requestId:Q}=k,G=Xt(V.data,K=>z(K,O,{arg:B.originalArgs,baseQueryMeta:U,fulfilledTimeStamp:$,requestId:Q}));V.data=G}else V.data=O;}else V.data=o[k.arg.endpointName].structuralSharing??!0?Ng(vt(V.data)?$u(V.data):V.data,O):O;delete V.error,V.fulfilledTimeStamp=k.fulfilledTimeStamp})}let g=Kr({name:`${e}/queries`,initialState:xi,reducers:{removeQueryResult:{reducer(N,{payload:{queryCacheKey:k}}){delete N[k]},prepare:Gn()},cacheEntriesUpserted:{reducer(N,k){for(let O of k.payload){let{queryDescription:D,value:V}=O;v(N,D,!0,{arg:D,requestId:k.meta.requestId,startedTimeStamp:k.meta.timestamp}),S(N,{arg:D,requestId:k.meta.requestId,fulfilledTimeStamp:k.meta.timestamp,baseQueryMeta:{}},V,!0)}},prepare:N=>({payload:N.map(D=>{let{endpointName:V,arg:z,value:$}=D,B=o[V];return{queryDescription:{type:"query",endpointName:V,originalArgs:D.arg,queryCacheKey:n({queryArgs:z,endpointDefinition:B,endpointName:V})},value:$}}),meta:{[li]:!0,requestId:fi(),timestamp:Date.now()}})},queryResultPatched:{reducer(N,{payload:{queryCacheKey:k,patches:O}}){ds(N,k,D=>{D.data=Hu(D.data,O.concat())})},prepare:Gn()}},extraReducers(N){N.addCase(t.pending,(k,{meta:O,meta:{arg:D}})=>{let V=Ul(D);v(k,D,V,O)}).addCase(t.fulfilled,(k,{meta:O,payload:D})=>{let V=Ul(O.arg);S(k,O,D,V)}).addCase(t.rejected,(k,{meta:{condition:O,arg:D,requestId:V},error:z,payload:$})=>{ds(k,D.queryCacheKey,B=>{if(!O){if(B.requestId!==V)return;B.status="rejected",B.error=$??z}})}).addMatcher(s,(k,O)=>{let{queries:D}=a(O);for(let[V,z]of Object.entries(D))(z?.status==="fulfilled"||z?.status==="rejected")&&(k[V]=z)})}}),y=Kr({name:`${e}/mutations`,initialState:xi,reducers:{removeMutationResult:{reducer(N,{payload:k}){let O=Ei(k);O in N&&delete N[O]},prepare:Gn()}},extraReducers(N){N.addCase(r.pending,(k,{meta:O,meta:{requestId:D,arg:V,startedTimeStamp:z}})=>{V.track&&(k[Ei(O)]={requestId:D,status:"pending",endpointName:V.endpointName,startedTimeStamp:z})}).addCase(r.fulfilled,(k,{payload:O,meta:D})=>{D.arg.track&&Rg(k,D,V=>{V.requestId===D.requestId&&(V.status="fulfilled",V.data=O,V.fulfilledTimeStamp=D.fulfilledTimeStamp)})}).addCase(r.rejected,(k,{payload:O,error:D,meta:V})=>{V.arg.track&&Rg(k,V,z=>{z.requestId===V.requestId&&(z.status="rejected",z.error=O??D)})}).addMatcher(s,(k,O)=>{let{mutations:D}=a(O);for(let[V,z]of Object.entries(D))(z?.status==="fulfilled"||z?.status==="rejected")&&V!==z?.requestId&&(k[V]=z)})}}),x=Kr({name:`${e}/invalidation`,initialState:xi,reducers:{updateProvidedBy:{reducer(N,k){var V,z;let{queryCacheKey:O,providedTags:D}=k.payload;for(let $ of Object.values(N))for(let B of Object.values($)){let U=B.indexOf(O);U!==-1&&B.splice(U,1)}for(let{type:$,id:B}of D){let U=(V=N[$]??(N[$]={}))[z=B||"__internal_without_id"]??(V[z]=[]);U.includes(O)||U.push(O)}},prepare:Gn()}},extraReducers(N){N.addCase(g.actions.removeQueryResult,(k,{payload:{queryCacheKey:O}})=>{for(let D of Object.values(k))for(let V of Object.values(D)){let z=V.indexOf(O);z!==-1&&V.splice(z,1)}}).addMatcher(s,(k,O)=>{var V,z;let{provided:D}=a(O);for(let[$,B]of Object.entries(D))for(let[U,Q]of Object.entries(B)){let G=(V=k[$]??(k[$]={}))[z=U||"__internal_without_id"]??(V[z]=[]);for(let K of Q)G.includes(K)||G.push(K)}}).addMatcher(qt(Jt(t),pi(t)),(k,O)=>{let D=Lg(O,"providesTags",o,c),{queryCacheKey:V}=O.meta.arg;x.caseReducers.updateProvidedBy(k,x.actions.updateProvidedBy({queryCacheKey:V,providedTags:D}))})}}),E=Kr({name:`${e}/subscriptions`,initialState:xi,reducers:{updateSubscriptionOptions(N,k){},unsubscribeQueryResult(N,k){},internal_getRTKQSubscriptions(){}}}),C=Kr({name:`${e}/internalSubscriptions`,initialState:xi,reducers:{subscriptionsUpdated:{reducer(N,k){return Hu(N,k.payload)},prepare:Gn()}}}),I=Kr({name:`${e}/config`,initialState:{online:dE(),focused:lE(),middlewareRegistered:!1,...u},reducers:{middlewareRegistered(N,{payload:k}){N.middlewareRegistered=N.middlewareRegistered==="conflict"||i!==k?"conflict":!0}},extraReducers:N=>{N.addCase($l,k=>{k.online=!0}).addCase(jg,k=>{k.online=!1}).addCase(Gl,k=>{k.focused=!0}).addCase(Mg,k=>{k.focused=!1}).addMatcher(s,k=>({...k}))}}),T=Dn({queries:g.reducer,mutations:y.reducer,provided:x.reducer,subscriptions:C.reducer,config:I.reducer}),_=(N,k)=>T(h.match(k)?void 0:N,k),q={...I.actions,...g.actions,...E.actions,...C.actions,...y.actions,...x.actions,resetApiState:h};return{reducer:_,actions:q}}var Ll=Symbol.for("RTKQ/skipToken"),Vg={status:"uninitialized"},Ig=Xt(Vg,()=>{}),Tg=Xt(Vg,()=>{});function TE({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=T=>Ig,o=T=>Tg;return{buildQuerySelector:S,buildInfiniteQuerySelector:g,buildMutationSelector:y,selectInvalidatedBy:x,selectCachedArgsForQuery:E,selectApiState:a,selectQueries:s,selectMutations:u,selectQueryEntry:c,selectConfig:h};function i(T){return{...T,...bg(T.status)}}function a(T){return T[t]}function s(T){return a(T)?.queries}function c(T,_){return s(T)?.[_]}function u(T){return a(T)?.mutations}function h(T){return a(T)?.config}function v(T,_,q){return N=>{if(N===Ll)return r(n,q);let k=e({queryArgs:N,endpointDefinition:_,endpointName:T});return r(D=>c(D,k)??Ig,q)}}function S(T,_){return v(T,_,i)}function g(T,_){let{infiniteQueryOptions:q}=_;function N(k){let O={...k,...bg(k.status)},{isLoading:D,isError:V,direction:z}=O,$=z==="forward",B=z==="backward";return{...O,hasNextPage:C(q,O.data),hasPreviousPage:I(q,O.data),isFetchingNextPage:D&&$,isFetchingPreviousPage:D&&B,isFetchNextPageError:V&&$,isFetchPreviousPageError:V&&B}}return v(T,_,N)}function y(){return T=>{let _;return typeof T=="object"?_=Ei(T)??Ll:_=T,r(_===Ll?o:k=>a(k)?.mutations?.[_]??Tg,i)}}function x(T,_){let q=T[t],N=new Set;for(let k of _.filter(ps).map(Vl)){let O=q.provided[k.type];if(!O)continue;let D=(k.id!==void 0?O[k.id]:wg(Object.values(O)))??[];for(let V of D)N.add(V)}return wg(Array.from(N.values()).map(k=>{let O=q.queries[k];return O?[{queryCacheKey:k,endpointName:O.endpointName,originalArgs:O.originalArgs}]:[]}))}function E(T,_){return Object.values(s(T)).filter(q=>q?.endpointName===_&&q.status!=="uninitialized").map(q=>q.originalArgs)}function C(T,_){return _?Bl(T,_)!=null:!1}function I(T,_){return!_||!T.getPreviousPageParam?!1:qg(T,_)!=null}}var _g=WeakMap?new WeakMap:void 0,kg=({endpointName:e,queryArgs:t})=>{let r="",n=_g?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(i,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=jt(a)?Object.keys(a).sort().reduce((s,c)=>(s[c]=a[c],s),{}):a,a));jt(t)&&_g?.set(t,o),r=o}return`${e}(${r})`};function _E(...e){return function(r){let n=Vn(u=>r.extractRehydrationInfo?.(u,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(u){let h=kg;if("serializeQueryArgs"in u.endpointDefinition){let v=u.endpointDefinition.serializeQueryArgs;h=S=>{let g=v(S);return typeof g=="string"?g:kg({...S,queryArgs:g})}}else r.serializeQueryArgs&&(h=r.serializeQueryArgs);return h(u)},tagTypes:[...(r.tagTypes||[])]},i={endpointDefinitions:{},batch(u){u()},apiUid:fi(),extractRehydrationInfo:n,hasRehydrationInfo:Vn(u=>n(u)!=null)},a={injectEndpoints:c,enhanceEndpoints({addTagTypes:u,endpoints:h}){if(u)for(let v of u)o.tagTypes.includes(v)||o.tagTypes.push(v);if(h)for(let[v,S]of Object.entries(h))typeof S=="function"?S(i.endpointDefinitions[v]):Object.assign(i.endpointDefinitions[v]||{},S);return a}},s=e.map(u=>u.init(a,o,i));function c(u){let h=u.endpoints({query:v=>({...v,type:"query"}),mutation:v=>({...v,type:"mutation"}),infiniteQuery:v=>({...v,type:"infinitequery"})});for(let[v,S]of Object.entries(h)){if(u.overrideExisting!==!0&&v in i.endpointDefinitions){if(u.overrideExisting==="throw")throw new Error(st(39));typeof process<"u";continue}typeof process<"u",i.endpointDefinitions[v]=S;for(let g of s)g.injectEndpoint(v,S)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function nr(e,...t){return Object.assign(e,...t)}var kE=({api:e,queryThunk:t,internalState:r})=>{let n=`${e.reducerPath}/subscriptions`,o=null,i=null,{updateSubscriptionOptions:a,unsubscribeQueryResult:s}=e.internalActions,c=(g,y)=>{var E,C;if(a.match(y)){let{queryCacheKey:I,requestId:T,options:_}=y.payload;return g?.[I]?.[T]&&(g[I][T]=_),!0}if(s.match(y)){let{queryCacheKey:I,requestId:T}=y.payload;return g[I]&&delete g[I][T],!0}if(e.internalActions.removeQueryResult.match(y))return delete g[y.payload.queryCacheKey],!0;if(t.pending.match(y)){let{meta:{arg:I,requestId:T}}=y,_=g[E=I.queryCacheKey]??(g[E]={});return _[`${T}_running`]={},I.subscribe&&(_[T]=I.subscriptionOptions??_[T]??{}),!0}let x=!1;if(t.fulfilled.match(y)||t.rejected.match(y)){let I=g[y.meta.arg.queryCacheKey]||{},T=`${y.meta.requestId}_running`;x||(x=!!I[T]),delete I[T]}if(t.rejected.match(y)){let{meta:{condition:I,arg:T,requestId:_}}=y;if(I&&T.subscribe){let q=g[C=T.queryCacheKey]??(g[C]={});q[_]=T.subscriptionOptions??q[_]??{},x=!0}}return x},u=()=>r.currentSubscriptions,S={getSubscriptions:u,getSubscriptionCount:g=>{let x=u()[g]??{};return lo(x)},isRequestSubscribed:(g,y)=>!!u()?.[g]?.[y]};return(g,y)=>{if(o||(o=JSON.parse(JSON.stringify(r.currentSubscriptions))),e.util.resetApiState.match(g))return o=r.currentSubscriptions={},i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,S];let x=c(r.currentSubscriptions,g),E=!0;if(x){i||(i=setTimeout(()=>{let T=JSON.parse(JSON.stringify(r.currentSubscriptions)),[,_]=Sa(o,()=>T);y.next(e.internalActions.subscriptionsUpdated(_)),o=T,i=null},500));let C=typeof g.type=="string"&&!!g.type.startsWith(n),I=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;E=!C&&!I}return[E,!1]}};function OE(e){for(let t in e)return!1;return!0}var PE=2147483647/1e3-1,NE=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:i,selectConfig:a}})=>{let{removeQueryResult:s,unsubscribeQueryResult:c,cacheEntriesUpserted:u}=t.internalActions,h=qt(c.match,r.fulfilled,r.rejected,u.match);function v(E){let C=o.currentSubscriptions[E];return!!C&&!OE(C)}let S={},g=(E,C,I)=>{let T=C.getState(),_=a(T);if(h(E)){let q;if(u.match(E))q=E.payload.map(N=>N.queryDescription.queryCacheKey);else{let{queryCacheKey:N}=c.match(E)?E.payload:E.meta.arg;q=[N]}y(q,C,_)}if(t.util.resetApiState.match(E))for(let[q,N]of Object.entries(S))N&&clearTimeout(N),delete S[q];if(n.hasRehydrationInfo(E)){let{queries:q}=n.extractRehydrationInfo(E);y(Object.keys(q),C,_)}};function y(E,C,I){let T=C.getState();for(let _ of E){let q=i(T,_);x(_,q?.endpointName,C,I)}}function x(E,C,I,T){let q=n.endpointDefinitions[C]?.keepUnusedDataFor??T.keepUnusedDataFor;if(q===1/0)return;let N=Math.max(0,Math.min(q,PE));if(!v(E)){let k=S[E];k&&clearTimeout(k),S[E]=setTimeout(()=>{v(E)||I.dispatch(s({queryCacheKey:E})),delete S[E]},N*1e3)}}return g},Og=new Error("Promise never resolved before cacheEntryRemoved."),FE=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:i,selectors:{selectQueryEntry:a,selectApiState:s}})=>{let c=Ra(n),u=Ra(o),h=Jt(n,o),v={};function S(C,I,T){let _=v[C];_?.valueResolved&&(_.valueResolved({data:I,meta:T}),delete _.valueResolved)}function g(C){let I=v[C];I&&(delete v[C],I.cacheEntryRemoved())}let y=(C,I,T)=>{let _=x(C);function q(N,k,O,D){let V=a(T,k),z=a(I.getState(),k);!V&&z&&E(N,D,k,I,O)}if(n.pending.match(C))q(C.meta.arg.endpointName,_,C.meta.requestId,C.meta.arg.originalArgs);else if(e.internalActions.cacheEntriesUpserted.match(C))for(let{queryDescription:N,value:k}of C.payload){let{endpointName:O,originalArgs:D,queryCacheKey:V}=N;q(O,V,C.meta.requestId,D),S(V,k,{})}else if(o.pending.match(C))I.getState()[t].mutations[_]&&E(C.meta.arg.endpointName,C.meta.arg.originalArgs,_,I,C.meta.requestId);else if(h(C))S(_,C.payload,C.meta.baseQueryMeta);else if(e.internalActions.removeQueryResult.match(C)||e.internalActions.removeMutationResult.match(C))g(_);else if(e.util.resetApiState.match(C))for(let N of Object.keys(v))g(N)};function x(C){return c(C)?C.meta.arg.queryCacheKey:u(C)?C.meta.arg.fixedCacheKey??C.meta.requestId:e.internalActions.removeQueryResult.match(C)?C.payload.queryCacheKey:e.internalActions.removeMutationResult.match(C)?Ei(C.payload):""}function E(C,I,T,_,q){let N=r.endpointDefinitions[C],k=N?.onCacheEntryAdded;if(!k)return;let O={},D=new Promise(Q=>{O.cacheEntryRemoved=Q}),V=Promise.race([new Promise(Q=>{O.valueResolved=Q}),D.then(()=>{throw Og})]);V.catch(()=>{}),v[T]=O;let z=e.endpoints[C].select(N.type==="query"?I:T),$=_.dispatch((Q,G,K)=>K),B={..._,getCacheEntry:()=>z(_.getState()),requestId:q,extra:$,updateCachedData:N.type==="query"?Q=>_.dispatch(e.util.updateQueryData(C,I,Q)):void 0,cacheDataLoaded:V,cacheEntryRemoved:D},U=k(I,B);Promise.resolve(U).catch(Q=>{if(Q!==Og)throw Q})}return y},DE=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},ME=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:i,assertTagType:a,refetchQuery:s,internalState:c})=>{let{removeQueryResult:u}=i.internalActions,h=qt(Jt(n),pi(n)),v=qt(Jt(n,o),Wr(n,o)),S=[],g=(E,C)=>{h(E)?x(Lg(E,"invalidatesTags",r,a),C):v(E)?x([],C):i.util.invalidateTags.match(E)&&x(zl(E.payload,void 0,void 0,void 0,void 0,a),C)};function y(E){let{queries:C,mutations:I}=E;for(let T of[C,I])for(let _ in T)if(T[_]?.status==="pending")return!0;return!1}function x(E,C){let I=C.getState(),T=I[e];if(S.push(...E),T.config.invalidationBehavior==="delayed"&&y(T))return;let _=S;if(S=[],_.length===0)return;let q=i.util.selectInvalidatedBy(I,_);t.batch(()=>{let N=Array.from(q.values());for(let{queryCacheKey:k}of N){let O=T.queries[k],D=c.currentSubscriptions[k]??{};O&&(lo(D)===0?C.dispatch(u({queryCacheKey:k})):O.status!=="uninitialized"&&C.dispatch(s(O)))}})}return g},jE=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let i={},a=(g,y)=>{(r.internalActions.updateSubscriptionOptions.match(g)||r.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload,y),(t.pending.match(g)||t.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg,y),(t.fulfilled.match(g)||t.rejected.match(g)&&!g.meta.condition)&&c(g.meta.arg,y),r.util.resetApiState.match(g)&&v()};function s(g,y){let E=y.getState()[e].queries[g],C=o.currentSubscriptions[g];if(!(!E||E.status==="uninitialized"))return C}function c({queryCacheKey:g},y){let x=y.getState()[e],E=x.queries[g],C=o.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I,skipPollingIfUnfocused:T}=S(C);if(!Number.isFinite(I))return;let _=i[g];_?.timeout&&(clearTimeout(_.timeout),_.timeout=void 0);let q=Date.now()+I;i[g]={nextPollTimestamp:q,pollingInterval:I,timeout:setTimeout(()=>{(x.config.focused||!T)&&y.dispatch(n(E)),c({queryCacheKey:g},y)},I)}}function u({queryCacheKey:g},y){let E=y.getState()[e].queries[g],C=o.currentSubscriptions[g];if(!E||E.status==="uninitialized")return;let{lowestPollingInterval:I}=S(C);if(!Number.isFinite(I)){h(g);return}let T=i[g],_=Date.now()+I;(!T||_<T.nextPollTimestamp)&&c({queryCacheKey:g},y)}function h(g){let y=i[g];y?.timeout&&clearTimeout(y.timeout),delete i[g]}function v(){for(let g of Object.keys(i))h(g)}function S(g={}){let y=!1,x=Number.POSITIVE_INFINITY;for(let E in g)g[E].pollingInterval&&(x=Math.min(g[E].pollingInterval,x),y=g[E].skipPollingIfUnfocused||y);return{lowestPollingInterval:x,skipPollingIfUnfocused:y}}return a},qE=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Ea(r,n),i=Wr(r,n),a=Jt(r,n),s={};return(u,h)=>{if(o(u)){let{requestId:v,arg:{endpointName:S,originalArgs:g}}=u.meta,y=t.endpointDefinitions[S],x=y?.onQueryStarted;if(x){let E={},C=new Promise((q,N)=>{E.resolve=q,E.reject=N});C.catch(()=>{}),s[v]=E;let I=e.endpoints[S].select(y.type==="query"?g:v),T=h.dispatch((q,N,k)=>k),_={...h,getCacheEntry:()=>I(h.getState()),requestId:v,extra:T,updateCachedData:y.type==="query"?q=>h.dispatch(e.util.updateQueryData(S,g,q)):void 0,queryFulfilled:C};x(g,_)}}else if(a(u)){let{requestId:v,baseQueryMeta:S}=u.meta;s[v]?.resolve({data:u.payload,meta:S}),delete s[v]}else if(i(u)){let{requestId:v,rejectedWithValue:S,baseQueryMeta:g}=u.meta;s[v]?.reject({error:u.payload??u.error,isUnhandledError:!S,meta:g}),delete s[v]}}},LE=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:i}=r.internalActions,a=(c,u)=>{Gl.match(c)&&s(u,"refetchOnFocus"),$l.match(c)&&s(u,"refetchOnReconnect")};function s(c,u){let h=c.getState()[e],v=h.queries,S=o.currentSubscriptions;t.batch(()=>{for(let g of Object.keys(S)){let y=v[g],x=S[g];if(!x||!y)continue;(Object.values(x).some(C=>C[u]===!0)||Object.values(x).every(C=>C[u]===void 0)&&h.config[u])&&(lo(x)===0?c.dispatch(i({queryCacheKey:g})):y.status!=="uninitialized"&&c.dispatch(n(y)))}})}return a};function VE(e){let{reducerPath:t,queryThunk:r,api:n,context:o}=e,{apiUid:i}=o,a={invalidateTags:P(`${t}/invalidateTags`)},s=v=>v.type.startsWith(`${t}/`),c=[DE,NE,ME,jE,FE,qE];return{middleware:v=>{let S=!1,y={...e,internalState:{currentSubscriptions:{}},refetchQuery:h,isThisApiSliceAction:s},x=c.map(I=>I(y)),E=kE(y),C=LE(y);return I=>T=>{if(!jn(T))return I(T);S||(S=!0,v.dispatch(n.internalActions.middlewareRegistered(i)));let _={...v,next:I},q=v.getState(),[N,k]=E(T,_,q),O;if(N?O=I(T):O=k,v.getState()[t]&&(C(T,_,q),s(T)||o.hasRehydrationInfo(T)))for(let D of x)D(T,_,q);return O}},actions:a};function h(v){return e.api.endpoints[v.endpointName].initiate(v.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Pg=Symbol(),UE=({createSelector:e=Ve}={})=>({name:Pg,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:i,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:c,refetchOnReconnect:u,invalidationBehavior:h},v){Tf();let S=de=>(typeof process<"u",de);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:$l,onOffline:jg,onFocus:Gl,onFocusLost:Mg},util:{}});let g=TE({serializeQueryArgs:i,reducerPath:o,createSelector:e}),{selectInvalidatedBy:y,selectCachedArgsForQuery:x,buildQuerySelector:E,buildInfiniteQuerySelector:C,buildMutationSelector:I}=g;nr(t.util,{selectInvalidatedBy:y,selectCachedArgsForQuery:x});let{queryThunk:T,infiniteQueryThunk:_,mutationThunk:q,patchQueryData:N,updateQueryData:k,upsertQueryData:O,prefetch:D,buildMatchThunkActions:V}=RE({baseQuery:r,reducerPath:o,context:v,api:t,serializeQueryArgs:i,assertTagType:S,selectors:g}),{reducer:z,actions:$}=IE({context:v,queryThunk:T,infiniteQueryThunk:_,mutationThunk:q,serializeQueryArgs:i,reducerPath:o,assertTagType:S,config:{refetchOnFocus:c,refetchOnReconnect:u,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:o,invalidationBehavior:h}});nr(t.util,{patchQueryData:N,updateQueryData:k,upsertQueryData:O,prefetch:D,resetApiState:$.resetApiState,upsertQueryEntries:$.cacheEntriesUpserted}),nr(t.internalActions,$);let{middleware:B,actions:U}=VE({reducerPath:o,context:v,queryThunk:T,mutationThunk:q,infiniteQueryThunk:_,api:t,assertTagType:S,selectors:g});nr(t.util,U),nr(t,{reducer:z,middleware:B});let{buildInitiateQuery:Q,buildInitiateInfiniteQuery:G,buildInitiateMutation:K,getRunningMutationThunk:Y,getRunningMutationsThunk:ne,getRunningQueriesThunk:pe,getRunningQueryThunk:be}=CE({queryThunk:T,mutationThunk:q,infiniteQueryThunk:_,api:t,serializeQueryArgs:i,context:v});return nr(t.util,{getRunningMutationThunk:Y,getRunningMutationsThunk:ne,getRunningQueryThunk:be,getRunningQueriesThunk:pe}),{name:Pg,injectEndpoint(de,fe){var Le;let he=(Le=t.endpoints)[de]??(Le[de]={});Ql(fe)&&nr(he,{name:de,select:E(de,fe),initiate:Q(de,fe)},V(T,de)),AE(fe)&&nr(he,{name:de,select:I(),initiate:K(de)},V(q,de)),Hl(fe)&&nr(he,{name:de,select:C(de,fe),initiate:G(de,fe)},V(T,de))}}}}),Ug=_E(UE());m();d();f();p();m();d();f();p();var Zr=e=>e.query,Bg=e=>e.query?.enableQuerySyntax;var k2=Ve(e=>Zr(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),BE=Ve(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);m();d();f();p();m();d();f();p();var fo=e=>ct({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Jr(r),o=e?!r.generatedAnswer?.answer||!r.generatedAnswer?.answer.length:void 0;return n?t.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o}):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Jr(t)??"",answerGenerated:e??!1})}),mo=()=>ct({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:e=>({answerId:Jr(e)??"",responseId:e.search?.searchResponseId||e.search?.response.searchUid||""})});m();d();f();p();m();d();f();p();var Gg=Ve(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});m();d();f();p();var Ri=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:Zn(e)}});m();d();f();p();var $g=e=>e.context;m();d();f();p();var Wl=e=>e.pipeline;m();d();f();p();m();d();f();p();var Ii=_t(fs(),1),Yg=_t(Qg(),1);m();d();f();p();var ms=_t(fs(),1),zg=_t(Hg(),1);ms.default.extend(zg.default);var Wg="YYYY/MM/DD@HH:mm:ss",GE="1401-01-01";function go(e,t){let r=(0,ms.default)(e,t);return!r.isValid()&&!t?(0,ms.default)(e,Wg):r}function gs(e){return e.format(Wg)}function Kg(e,t){let r=go(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}td(r)}function td(e){if(e.isBefore(GE))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Ii.default.extend(Yg.default);var Xg=["past","now","next"],Jg=["minute","hour","day","week","month","quarter","year"],$E=e=>{let t=e==="now";return{amount:new te({required:!t,min:1}),unit:new H({required:!t,constrainTo:Jg}),period:new H({required:!0,constrainTo:Xg})}};function rd(e){if(typeof e=="string"&&!br(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?nh(e):e;new lt($E(t.period)).validate(t);let r=eh(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);td(r)}function Zg(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function eh(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Ii.default)().subtract(r,n);case"next":return(0,Ii.default)().add(r,n);case"now":return(0,Ii.default)()}}function Ti(e){return gs(eh(nh(e)))}function th(e){return e.toLocaleLowerCase().split("-")}function br(e){let[t,r,n]=th(e);if(t==="now")return!0;if(!Xg.includes(t)||!Jg.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function rh(e){return!!e&&typeof e=="object"&&"period"in e}function nh(e){let[t,r,n]=th(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}m();d();f();p();function oh(e){return e.type==="dateRange"}function ih(e){return`start${e}`}function ah(e){return`end${e}`}var nd=()=>({dateFacetValueMap:{}});function QE(e,t,r){let n=e.start,o=e.end;return br(n)&&(n=Ti(n),r.dateFacetValueMap[t][ih(n)]=e.start),br(o)&&(o=Ti(o),r.dateFacetValueMap[t][ah(o)]=e.end),{...e,start:n,end:o}}function od(e,t){if(oh(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>QE(o,r,t))}}return e}function Ar(e){let t=nd();return{request:{...e,facets:e.facets?.map(n=>od(n,t))},mappings:t}}function HE(e,t,r){return{...e,start:r.dateFacetValueMap[t][ih(e.start)]||e.start,end:r.dateFacetValueMap[t][ah(e.end)]||e.end}}function zE(e,t){return e.facetId in t.dateFacetValueMap}function WE(e,t){return zE(e,t)?{...e,values:e.values.map(r=>HE(r,e.facetId,t))}:e}function hs(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>WE(n,t))}}:e}m();d();f();p();m();d();f();p();m();d();f();p();function wr(e){return Object.values(e).map(t=>t.request)}function id(e,t){let r={};e.forEach(i=>{r[i.facetId]=i});let n=[];t.forEach(i=>{i in r&&(n.push(r[i]),delete r[i])});let o=Object.values(r);return[...n,...o]}function sh(e){return wr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var ad={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function KE(e){return wr(e).map(t=>{let r=ad[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function YE(e){return[...KE(e.facetSet??{}),...sh(e.numericFacetSet??{}),...sh(e.dateFacetSet??{}),...wr(e.categoryFacetSet??{})]}function XE(e){return YE(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ys(e){return id(XE(e),e.facetOrder??[])}m();d();f();p();m();d();f();p();var xr=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(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:wt.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 as(e.configuration.analytics,t))),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function xr(_x63,_x64){return _ref29.apply(this,arguments)}}();m();d();f();p();var ho=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??dr(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&&Ri(e.configuration.analytics,t,r)),...(e.excerptLength&&!ie(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});m();d();f();p();var ch=Ve(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o}));var Cr=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=cd(e),o=JE(e),i=ZE(e),a=e.configuration.analytics.analyticsMode==="legacy"?yield xr(e,r):ho(e,t,r);return Ar({...a,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:sd(e),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:i}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Cr(_x65,_x66,_x67){return _ref30.apply(this,arguments)}}();function sd(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function JE(e){return id(tR(e),e.facetOrder??[])}function ZE(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(eR).filter(r=>r.currentValues.length>0):void 0}function eR(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function tR(e){return rR(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function rR(e){return[...nR(e.facetSet??{}),...uh(e.numericFacetSet??{}),...uh(e.dateFacetSet??{}),...wr(e.categoryFacetSet??{})]}function nR(e){return wr(e).map(t=>{let r=ad[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function uh(e){return wr(e).map(t=>{let r=t.currentValues,n=r.some(({state:i})=>i!=="idle"),o=r.some(i=>i.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function cd(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=ch(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}m();d();f();p();m();d();f();p();var _i=(e,t)=>{let r=e;return ie(r[t])?ie(e.raw[t])?null:e.raw[t]:r[t]},oR=e=>t=>e.every(r=>!ie(_i(t,r))),iR=e=>t=>e.every(r=>ie(_i(t,r))),aR=(e,t)=>r=>{let n=lh(e,r);return t.some(o=>n.some(i=>`${i}`.toLowerCase()===o.toLowerCase()))},sR=(e,t)=>r=>{let n=lh(e,r);return t.every(o=>n.every(i=>`${i}`.toLowerCase()!==o.toLowerCase()))},lh=(e,t)=>{let r=_i(t,e);return Hp(r)?r:[r]},dh={getResultProperty:_i,fieldsMustBeDefined:oR,fieldsMustNotBeDefined:iR,fieldMustMatch:aR,fieldMustNotMatch:sR};var ud=Ve(e=>e.search,e=>e?.searchAction?.actionCause||"");m();d();f();p();var ld=e=>e.searchHub;m();d();f();p();var dd=Ve(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),f$=Ve(e=>e,e=>{let t=dd(e);return t&&e?e[t].expression:""});m();d();f();p();var ph=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};m();d();f();p();var fh=e=>e.excerptLength?.length;m();d();f();p();var mh=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};m();d();f();p();var gh=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 hh=e=>e.sortCriteria;var yh=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:We(e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function yh(_x68){return _ref31.apply(this,arguments)}}(),vh=(e,t)=>{let r=Zr(e)?.q,{aq:n,cq:o,dq:i,lq:a}=uR(e),s=$g(e),c=Ri(e.configuration.analytics,t,{actionCause:ud(e)}),u=ld(e),h=Wl(e),v=Rl(e)??[],S=bh(e),g=dd(e.tabSet)||"default",y=Cl(e),x=Hm(e),E=t.referrer||"",C=mh(e),I=hh(e),T=cR(e),_=fh(e),q=gh(e),N=ph(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(i&&{dq:i}),...(a&&{lq:a}),...(e.query&&{enableQuerySyntax:Bg(e)}),...(s?.contextValues&&{context:s.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:v}},...(u?.length&&{searchHub:u}),...(h?.length&&{pipeline:h}),...(S.length&&{facets:S}),...(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:sd(e),firstResult:e.pagination.firstResult}),tab:g,locale:y,timezone:x,...(e.debug!==void 0&&{debug:e.debug}),referrer:E,...T,...(q??{}),...(_&&{excerptLength:_}),...(N&&{dictionaryFieldContext:N}),sortCriteria:I,...(C&&{facetOptions:C}),...c,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Sh=(e,t)=>{let r=Zr(e)?.q,n=bh(e),o=Ri(e.configuration.analytics,t,{actionCause:ud(e)}),i=Cl(e),a=ld(e),s=Wl(e),c=Rl(e)??[];return{q:r||"",...(n.length&&{facets:n}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:c}},...(a?.length&&{searchHub:a}),...(s?.length&&{pipeline:s}),...o,locale:i}},bh=e=>ys(e)?.map(t=>od(t,nd())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),cR=e=>({actionsHistory:e.configuration.analytics.enabled?wt.getInstance().getHistory():[]}),uR=e=>{let t=Gg(e),r=cd(e);return{...t,...(r&&{cq:r})}};m();d();f();p();var vs=["searching","thinking","answering"];function Ss(e){return e.toLowerCase()}m();d();f();p();var Ah=["text/plain","text/markdown"];var yo=new H({required:!0}),wh=new H,vo=new ue({required:!0}),pd={id:yo,title:yo,uri:yo,permanentid:yo,clickUri:wh},bs=new H({required:!0,constrainTo:Ah}),xh=new H({required:!0,constrainTo:vs}),Ch=e=>({...e,name:Ss(e.name)}),NQ=P("generatedAnswer/setIsVisible",e=>j(e,vo)),As=P("generatedAnswer/setAnswerId",e=>j(e,X)),FQ=P("generatedAnswer/setAnswerGenerationMode",e=>j(e,new H({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),DQ=P("generatedAnswer/setIsEnabled",e=>j(e,vo)),Oi=P("generatedAnswer/updateMessage",e=>j(e,{textDelta:yo})),Pi=P("generatedAnswer/updateCitations",e=>j(e,{citations:new ge({required:!0,each:new ee({values:pd})})})),Ni=P("generatedAnswer/updateError",e=>j(e,{message:wh,code:new te({min:0})})),ws=P("generatedAnswer/resetAnswer"),MQ=P("generatedAnswer/like"),jQ=P("generatedAnswer/dislike"),qQ=P("generatedAnswer/feedbackModal/open"),LQ=P("generatedAnswer/expand"),VQ=P("generatedAnswer/collapse"),UQ=P("generatedAnswer/setId",e=>j(e,{id:new H({required:!0})})),BQ=P("generatedAnswer/feedbackModal/close"),GQ=P("generatedAnswer/sendFeedback"),Er=P("generatedAnswer/setIsLoading",e=>j(e,vo)),ki=P("generatedAnswer/setIsStreaming",e=>j(e,vo)),Fi=P("generatedAnswer/setAnswerContentFormat",e=>j(e,bs)),$Q=P("generatedAnswer/updateResponseFormat",e=>j(e,{contentFormat:new ge({each:bs,default:["text/plain"]})})),QQ=P("knowledge/updateAnswerConfigurationId",e=>j(e,yo)),HQ=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>j(e,_a)),fd=P("generatedAnswer/setIsAnswerGenerated",e=>j(e,vo)),Di=P("generatedAnswer/setCannotAnswer",e=>j(e,vo)),lR=P("generatedAnswer/setAnswerApiQueryParams",e=>j(e,new ee({}))),Eh=P("generatedAnswer/startStep",e=>j(Ch(e),{name:xh,startedAt:new te({min:0,required:!0})})),Rh=P("generatedAnswer/finishStep",e=>j(Ch(e),{name:xh,finishedAt:new te({min:0,required:!0})})),zQ=Ee("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:i}=t,{search:a}=i(),{queryExecuted:s}=a,{setAbortControllerRef:c}=e,u=yield yh(r),h=(g,y)=>{switch(g){case"genqa.headerMessageType":{let x=JSON.parse(y);n(Fi(x.contentFormat));break}case"genqa.messageType":n(Oi(JSON.parse(y)));break;case"genqa.citationsType":n(Pi(JSON.parse(y)));break;case"genqa.endOfStreamType":{let x=JSON.parse(y).answerGenerated,E=s.length!==0&&!x;n(Di(E)),n(ki(!1)),n(fd(x)),n(fo(x)),n(mo());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${g}"`)}};n(Er(!0));let v=g=>g.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,S=o.streamingClient?.streamGeneratedAnswer(u,{write:g=>{v(u)&&(n(Er(!1)),g.payload&&g.payloadType&&h(g.payloadType,g.payload))},abort:g=>{v(u)&&n(Ni(g))},close:()=>{v(u)&&n(ki(!1))},resetAnswer:()=>{v(u)&&n(ws())}});S?c(S):n(Er(!1))});return function(_x69,_x70){return _ref32.apply(this,arguments)}}()),WQ=Ee("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(ws());let i=t();if(i.generatedAnswer.answerConfigurationId){let a=vh(i,n);r(lR(a)),yield r(Ih(a))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x71,_x72){return _ref33.apply(this,arguments)}}());m();d();f();p();m();d();f();p();function _h(_x73,_x74){return _h2.apply(this,arguments)}function _h2(){_h2=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _h2.apply(this,arguments)}function kh(e){let t,r,n,o=!1;return function(a){t===void 0?(t=a,r=0,n=-1):t=pR(t,a);let s=t.length,c=0;for(;r<s;){o&&(t[r]===10&&(c=++r),o=!1);let u=-1;for(;r<s&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-c);break;case 13:o=!0,u=r;break;case 10:u=r;break}if(u===-1)break;e(t.subarray(c,u),n),c=r,n=-1}c===s?t=void 0:c!==0&&(t=t.subarray(c),r-=c)}}function Oh(e,t,r){let n=Th(),o=new TextDecoder;return function(a,s){if(a.length===0)r?.(n),n=Th();else if(s>0){let c=o.decode(a.subarray(0,s)),u=s+(a[s+1]===32?2:1),h=o.decode(a.subarray(u));switch(c){case"data":n.data=n.data?`${n.data}
31
+ ${h}`:h;break;case"event":n.event=h;break;case"id":e(n.id=h);break;case"retry":dR(h,n,t);break}}}}function dR(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function pR(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Th(){return{data:"",event:"",id:"",retry:void 0}}var md="text/event-stream",fR=1e3,Ph="last-event-id";function Nh(){return typeof window<"u"}function Fh(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:i,onerror:a,openWhenHidden:s,fetch:c,...u}){return new Promise((h,v)=>{let S={...r};S.accept||(S.accept=md);let g;function y(){g?.abort(),document.hidden||_()}!s&&Nh()&&document.addEventListener("visibilitychange",y);let x=fR,E;function C(){Nh()&&document.removeEventListener("visibilitychange",y),clearTimeout(E),g?.abort()}t?.addEventListener("abort",()=>{C(),h()});let I=c??A,T=n??mR;function _(){return _2.apply(this,arguments)}function _2(){_2=_asyncToGenerator(function*(){g=l.AbortController?new l.AbortController:null;try{let q=yield I(e,{...u,headers:S,signal:g?.signal});yield T(q),yield _h(q.body,kh(Oh(N=>{N?S[Ph]=N:delete S[Ph]},N=>{x=N},o))),i?.(),C(),h()}catch(q){if(!g?.signal?.aborted)try{let N=a?.(q)??x;clearTimeout(E),E=setTimeout(_,N)}catch(N){C(),v(N)}}});return _2.apply(this,arguments)}_()})}function mR(e){let t=e.headers.get("content-type");if(!t?.startsWith(md))throw new Error(`Expected content-type to be ${md}, Actual: ${t}`)}m();d();f();p();var gR=/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:i,organizationId:a}=n.configuration,s=n.generatedAnswer.answerConfigurationId,c={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let u=We(a,i);return{data:Fg({baseUrl:`${u}/rest/organizations/${a}/answer/v1/configs/${s}`,fetchFn:function(){var _ref35=_asyncToGenerator(function*(v){if(v instanceof String)throw new Error("The provided 'request' must be a Request object.");let S=v.url,g={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(y=>{g[y]=v[y]}),g.duplex="half",g.body=yield v.text(),A(S,g)});return function fetchFn(_x78){return _ref35.apply(this,arguments)}}()})(c,{...t,signal:null},r)}}catch(u){return{error:u}}});return function gR(_x75,_x76,_x77){return _ref34.apply(this,arguments)}}(),Dh=Ug({reducerPath:"answer",baseQuery:Dg(gR,{maxRetries:3}),endpoints:()=>({})});var hR=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},yR=(e,t)=>{e.answer===void 0?e.answer=t.textDelta:typeof t.textDelta=="string"&&(e.answer=e.answer.concat(t.textDelta))},vR=(e,t)=>{e.citations=t.citations},SR=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},bR=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},AR=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&bR(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(hR(t,o),r(Fi(o.contentFormat)));break;case"genqa.messageType":o.textDelta&&(yR(t,o),r(Oi({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(vR(t,o),r(Pi({citations:o.citations})));break;case"genqa.endOfStreamType":SR(t,o),r(fo(o.answerGenerated??!1)),r(mo());break}},wR=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,i=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${i}/${r}/generate`},gd=Dh.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x79,_x80){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:i}){yield n;let{configuration:a,generatedAnswer:s,insightConfiguration:c}=r(),{organizationId:u,environment:h,accessToken:v}=a,S=We(u,h),g=wR(S,u,s.answerConfigurationId,c?.insightId);yield Fh(g,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${v}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:A,onopen:function(){var _ref36=_asyncToGenerator(function*(y){let x=y.headers.get("x-answer-id");x&&o(E=>{E.answerId=x,i(As(x))})});return function onopen(_x81){return _ref36.apply(this,arguments)}}(),onmessage:y=>{o(x=>{AR(y,x,i)})},onerror:y=>{throw y},onclose:()=>{o(y=>{i(Di(!y.generated))})}})}).apply(this,arguments)}})})}),Ih=e=>gd.endpoints.getAnswer.initiate(e);m();d();f();p();var Mh=Me($n,e=>e);m();d();f();p();function xR(e){let t=e.payload?.analyticsAction;return jh(e)&&!ie(t)}function jh(e){return"type"in e}var qh=e=>t=>r=>{let n;xR(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return jh(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};m();d();f();p();m();d();f();p();m();d();f();p();var Q3=P("tab/register",e=>{let t=new ee({values:{id:X,expression:Je}});return j(e,t)}),xs=P("tab/updateActiveTab",e=>j(e,X));m();d();f();p();var Cs=_t(fs(),1),Uh=_t(Lh(),1),Bh=_t(Vh(),1);Cs.default.extend(Bh.default);Cs.default.extend(Uh.default);var Gh=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Cs.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 CR=/(^|; )Coveo-Pendragon=([^;]*)/;function bd(){return typeof window>"u"?!1:CR.exec(document.cookie)?.pop()||null}var $h=Me(Gh(),e=>e.addCase(gr,(t,r)=>{ER(t,r.payload)}).addCase(Lt,(t,r)=>{RR(t,r.payload)}).addCase(Qn,(t,r)=>{IR(t,r.payload)}).addCase(Hn,t=>{t.analytics.enabled=!1}).addCase(zn,t=>{t.analytics.enabled=!0}).addCase(ka,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Oa,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(xs,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(fm,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hr,(t,r)=>{ie(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(dm,(t,{payload:r})=>{t.knowledge.agentId=r}));function ER(e,t){ie(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ie(t.organizationId)||(e.organizationId=t.organizationId)}function RR(e,t){ie(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ie(t.locale)||(e.search.locale=t.locale),ie(t.timezone)||(e.search.timezone=t.timezone),ie(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function IR(e,t){ie(t.enabled)||(e.analytics.enabled=t.enabled),ie(t.originContext)||(e.analytics.originContext=t.originContext),ie(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ie(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ie(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ie(t.trackingId)||(e.analytics.trackingId=t.trackingId),ie(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ie(t.source)||(e.analytics.source=t.source);try{let r=bd();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ie(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ie(t.anonymous)||(e.analytics.anonymous=t.anonymous),ie(t.deviceId)||(e.analytics.deviceId=t.deviceId),ie(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ie(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}var Ot=$h;m();d();f();p();function TR(e){return e.instantlyCallable}var Qh=()=>e=>t=>e(TR(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 Hh(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 Ad,_R=new Uint8Array(16);function wd(){if(!Ad){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ad=crypto.getRandomValues.bind(crypto)}return Ad(_R)}m();d();f();p();m();d();f();p();var kR=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xd={randomUUID:kR};function OR(e,t,r){if(xd.randomUUID&&!t&&!e)return xd.randomUUID();e=e||{};let n=e.random??e.rng?.()??wd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return Hh(n)}var Rr=OR;m();d();f();p();m();d();f();p();var R={};zo(R,{BRAND:()=>nI,DIRTY:()=>tn,EMPTY_PATH:()=>DR,INVALID:()=>se,NEVER:()=>UI,OK:()=>it,ParseStatus:()=>rt,Schema:()=>ye,ZodAny:()=>_r,ZodArray:()=>sr,ZodBigInt:()=>nn,ZodBoolean:()=>on,ZodBranded:()=>ji,ZodCatch:()=>hn,ZodDate:()=>an,ZodDefault:()=>gn,ZodDiscriminatedUnion:()=>Is,ZodEffects:()=>It,ZodEnum:()=>fn,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>ce,ZodFunction:()=>_s,ZodIntersection:()=>ln,ZodIssueCode:()=>W,ZodLazy:()=>dn,ZodLiteral:()=>pn,ZodMap:()=>Co,ZodNaN:()=>Ro,ZodNativeEnum:()=>mn,ZodNever:()=>Pt,ZodNull:()=>cn,ZodNullable:()=>$t,ZodNumber:()=>rn,ZodObject:()=>ht,ZodOptional:()=>Et,ZodParsedType:()=>Z,ZodPipeline:()=>qi,ZodPromise:()=>kr,ZodReadonly:()=>yn,ZodRecord:()=>Ts,ZodSchema:()=>ye,ZodSet:()=>Eo,ZodString:()=>Tr,ZodSymbol:()=>wo,ZodTransformer:()=>It,ZodTuple:()=>Gt,ZodType:()=>ye,ZodUndefined:()=>sn,ZodUnion:()=>un,ZodUnknown:()=>ar,ZodVoid:()=>xo,addIssueToContext:()=>J,any:()=>pI,array:()=>hI,bigint:()=>sI,boolean:()=>ny,coerce:()=>VI,custom:()=>ey,date:()=>cI,datetimeRegex:()=>Jh,defaultErrorMap:()=>or,discriminatedUnion:()=>bI,effect:()=>PI,enum:()=>_I,function:()=>RI,getErrorMap:()=>So,getParsedType:()=>Bt,instanceof:()=>iI,intersection:()=>AI,isAborted:()=>Es,isAsync:()=>bo,isDirty:()=>Rs,isValid:()=>Ir,late:()=>oI,lazy:()=>II,literal:()=>TI,makeIssue:()=>Mi,map:()=>CI,nan:()=>aI,nativeEnum:()=>kI,never:()=>mI,null:()=>dI,nullable:()=>FI,number:()=>ry,object:()=>yI,objectUtil:()=>Cd,oboolean:()=>LI,onumber:()=>qI,optional:()=>NI,ostring:()=>jI,pipeline:()=>MI,preprocess:()=>DI,promise:()=>OI,quotelessJson:()=>PR,record:()=>xI,set:()=>EI,setErrorMap:()=>FR,strictObject:()=>vI,string:()=>ty,symbol:()=>uI,transformer:()=>PI,tuple:()=>wI,undefined:()=>lI,union:()=>SI,unknown:()=>fI,util:()=>Ae,void:()=>gI});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ae||(Ae={}));var Cd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cd||(Cd={}));var Z=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bt=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.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"]),PR=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=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};gt.create=e=>new gt(e);var NR=(e,t)=>{let r;switch(e.code){case W.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case W.invalid_union:r="Invalid input";break;case W.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case W.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:r="Invalid function arguments";break;case W.invalid_return_type:r="Invalid function return type";break;case W.invalid_date:r="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case W.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case W.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case W.custom:r="Invalid input";break;case W.invalid_intersection_types:r="Intersection results could not be merged";break;case W.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ae.assertNever(e)}return{message:r}},or=NR;var zh=or;function FR(e){zh=e}function So(){return zh}m();d();f();p();var Mi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...(o.path||[])],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}},DR=[];function J(e,t){let r=So(),n=Mi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===or?void 0:or].filter(o=>!!o)});e.common.issues.push(n)}var rt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return se;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let i=yield o.key,a=yield o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return se;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},se=Object.freeze({status:"aborted"}),tn=e=>({status:"dirty",value:e}),it=e=>({status:"valid",value:e}),Es=e=>e.status==="aborted",Rs=e=>e.status==="dirty",Ir=e=>e.status==="valid",bo=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 Rt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Wh=(e,t)=>{if(Ir(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new gt(e.common.issues);return this._error=r,this._error}}};function me(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var ye=class{get description(){return this._def.description}_getType(t){return Bt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Bt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Bt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(bo(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Wh(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ir(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ir(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this10=this;return _asyncToGenerator(function*(){let n=yield _this10.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this11=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this11._def.errorMap,parent:null,data:t,parsedType:Bt(t)},o=_this11._parse({data:t,path:n.path,parent:n}),i=yield bo(o)?o:Promise.resolve(o);return Wh(n,i)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:W.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new It({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Et.create(this,this._def)}nullable(){return $t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sr.create(this)}promise(){return kr.create(this,this._def)}or(t){return un.create([this,t],this._def)}and(t){return ln.create(this,t,this._def)}transform(t){return new It({...me(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new gn({...me(this._def),innerType:this,defaultValue:r,typeName:ce.ZodDefault})}brand(){return new ji({typeName:ce.ZodBranded,type:this,...me(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new hn({...me(this._def),innerType:this,catchValue:r,typeName:ce.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return qi.create(this,t)}readonly(){return yn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},MR=/^c[^\s-]{8,}$/i,jR=/^[0-9a-z]+$/,qR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,LR=/^[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,VR=/^[a-z0-9_-]{21}$/i,UR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BR=/^[-+]?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)?)??$/,GR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$R="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ed,QR=/^(?:(?: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])$/,HR=/^(?:(?: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])$/,zR=/^(([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]))$/,WR=/^(([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])$/,KR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,YR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yh="((\\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])))",XR=new RegExp(`^${Yh}$`);function Xh(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function JR(e){return new RegExp(`^${Xh(e)}$`)}function Jh(e){let t=`${Yh}T${Xh(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ZR(e,t){return!!((t==="v4"||!t)&&QR.test(e)||(t==="v6"||!t)&&zR.test(e))}function eI(e,t){if(!UR.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function tI(e,t){return!!((t==="v4"||!t)&&HR.test(e)||(t==="v6"||!t)&&WR.test(e))}var Tr=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.string,received:i.parsedType}),se}let n=new rt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?J(o,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&J(o,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")GR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"email",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ed||(Ed=new RegExp($R,"u")),Ed.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"emoji",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")LR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"uuid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")VR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"nanoid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")MR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")jR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid2",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")qR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ulid",code:W.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),J(o,{validation:"url",code:W.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"regex",code:W.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Jh(i).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?XR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?JR(i).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:W.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?BR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"duration",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ZR(t.data,i.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ip",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?eI(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"jwt",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?tI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cidr",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?KR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64",code:W.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?YR.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64url",code:W.invalid_string,message:i.message}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:W.invalid_string,...re.errToObj(n)})}_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,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Tr.create=e=>new Tr({checks:[],typeName:ce.ZodString,coerce:e?.coerce??!1,...me(e)});function rI(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var rn=class e extends ye{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)!==Z.number){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.number,received:i.parsedType}),se}let n,o=new rt;for(let i of this._def.checks)i.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?rI(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),J(n,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{code:W.not_finite,message:i.message}),o.dirty()):Ae.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,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,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}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 r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ae.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};rn.create=e=>new rn({checks:[],typeName:ce.ZodNumber,coerce:e?.coerce||!1,...me(e)});var nn=class e extends ye{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)!==Z.bigint)return this._getInvalidInput(t);let n,o=new rt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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)&&(n=this._getOrReturnCtx(t,n),J(n,{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 r=this._getOrReturnCtx(t);return J(r,{code:W.invalid_type,expected:Z.bigint,received:r.parsedType}),se}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,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,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};nn.create=e=>new nn({checks:[],typeName:ce.ZodBigInt,coerce:e?.coerce??!1,...me(e)});var on=class extends ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.boolean,received:n.parsedType}),se}return it(t.data)}};on.create=e=>new on({typeName:ce.ZodBoolean,coerce:e?.coerce||!1,...me(e)});var an=class e extends ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_type,expected:Z.date,received:i.parsedType}),se}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return J(i,{code:W.invalid_date}),se}let n=new rt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ae.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};an.create=e=>new an({checks:[],coerce:e?.coerce||!1,typeName:ce.ZodDate,...me(e)});var wo=class extends ye{_parse(t){if(this._getType(t)!==Z.symbol){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.symbol,received:n.parsedType}),se}return it(t.data)}};wo.create=e=>new wo({typeName:ce.ZodSymbol,...me(e)});var sn=class extends ye{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.undefined,received:n.parsedType}),se}return it(t.data)}};sn.create=e=>new sn({typeName:ce.ZodUndefined,...me(e)});var cn=class extends ye{_parse(t){if(this._getType(t)!==Z.null){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.null,received:n.parsedType}),se}return it(t.data)}};cn.create=e=>new cn({typeName:ce.ZodNull,...me(e)});var _r=class extends ye{constructor(){super(...arguments),this._any=!0}_parse(t){return it(t.data)}};_r.create=e=>new _r({typeName:ce.ZodAny,...me(e)});var ar=class extends ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return it(t.data)}};ar.create=e=>new ar({typeName:ce.ZodUnknown,...me(e)});var Pt=class extends ye{_parse(t){let r=this._getOrReturnCtx(t);return J(r,{code:W.invalid_type,expected:Z.never,received:r.parsedType}),se}};Pt.create=e=>new Pt({typeName:ce.ZodNever,...me(e)});var xo=class extends ye{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.void,received:n.parsedType}),se}return it(t.data)}};xo.create=e=>new xo({typeName:ce.ZodVoid,...me(e)});var sr=class e extends ye{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==Z.array)return J(r,{code:W.invalid_type,expected:Z.array,received:r.parsedType}),se;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(J(r,{code:a?W.too_big:W.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(J(r,{code:W.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(J(r,{code:W.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Rt(r,a,r.path,s)))).then(a=>rt.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Rt(r,a,r.path,s)));return rt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};sr.create=(e,t)=>new sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...me(t)});function Ao(e){if(e instanceof ht){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Et.create(Ao(n))}return new ht({...e._def,shape:()=>t})}else return e instanceof sr?new sr({...e._def,type:Ao(e.element)}):e instanceof Et?Et.create(Ao(e.unwrap())):e instanceof $t?$t.create(Ao(e.unwrap())):e instanceof Gt?Gt.create(e.items.map(t=>Ao(t))):e}var ht=class e extends ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return J(u,{code:W.invalid_type,expected:Z.object,received:u.parsedType}),se}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let h=i[u],v=o.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new Rt(o,v,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Pt){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of s)c.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(u==="strict")s.length>0&&(J(o,{code:W.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of s){let v=o.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new Rt(o,v,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let u=[];for(let h of c){let v=yield h.key,S=yield h.value;u.push({key:v,value:S,alwaysSet:h.alwaysSet})}return u})).then(u=>rt.mergeObjectSync(n,u)):rt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message: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:ce.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Ae.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ao(this)}partial(t){let r={};for(let n of Ae.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Et;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Zh(Ae.objectKeys(this.shape))}};ht.create=(e,t)=>new ht({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});ht.strictCreate=(e,t)=>new ht({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});ht.lazycreate=(e,t)=>new ht({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:ce.ZodObject,...me(t)});var un=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new gt(s.ctx.common.issues));return J(r,{code:W.invalid_union,unionErrors:a}),se}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(i){let a={...r,common:{...r.common,issues:[]},parent:null};return{result:yield i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}});return function(_x82){return _ref38.apply(this,arguments)}}())).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new gt(c));return J(r,{code:W.invalid_union,unionErrors:s}),se}}get options(){return this._def.options}};un.create=(e,t)=>new un({options:e,typeName:ce.ZodUnion,...me(t)});var ir=e=>e instanceof dn?ir(e.schema):e instanceof It?ir(e.innerType()):e instanceof pn?[e.value]:e instanceof fn?e.options:e instanceof mn?Ae.objectValues(e.enum):e instanceof gn?ir(e._def.innerType):e instanceof sn?[void 0]:e instanceof cn?[null]:e instanceof Et?[void 0,...ir(e.unwrap())]:e instanceof $t?[null,...ir(e.unwrap())]:e instanceof ji||e instanceof yn?ir(e.unwrap()):e instanceof hn?ir(e._def.innerType):[],Is=class e extends ye{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return J(r,{code:W.invalid_type,expected:Z.object,received:r.parsedType}),se;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(J(r,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=ir(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:ce.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...me(n)})}};function Rd(e,t){let r=Bt(e),n=Bt(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){let o=Ae.objectKeys(t),i=Ae.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Rd(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Rd(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ln=class extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Es(i)||Es(a))return se;let s=Rd(i.value,a.value);return s.valid?((Rs(i)||Rs(a))&&r.dirty(),{status:r.value,value:s.data}):(J(n,{code:W.invalid_intersection_types}),se)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ln.create=(e,t,r)=>new ln({left:e,right:t,typeName:ce.ZodIntersection,...me(r)});var Gt=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return J(n,{code:W.invalid_type,expected:Z.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return J(n,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(J(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Rt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>rt.mergeArray(r,a)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Gt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gt({items:e,typeName:ce.ZodTuple,rest:null,...me(t)})};var Ts=class e extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.object)return J(n,{code:W.invalid_type,expected:Z.object,received:n.parsedType}),se;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Rt(n,s,n.path,s)),value:a._parse(new Rt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?rt.mergeObjectAsync(r,o):rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ye?new e({keyType:t,valueType:r,typeName:ce.ZodRecord,...me(n)}):new e({keyType:Tr.create(),valueType:t,typeName:ce.ZodRecord,...me(r)})}},Co=class extends ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return J(n,{code:W.invalid_type,expected:Z.map,received:n.parsedType}),se;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new Rt(n,s,n.path,[u,"key"])),value:i._parse(new Rt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let c of a){let u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return se;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}))}else{let s=new Map;for(let c of a){let u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return se;(u.status==="dirty"||h.status==="dirty")&&r.dirty(),s.set(u.value,h.value)}return{status:r.value,value:s}}}};Co.create=(e,t,r)=>new Co({valueType:t,keyType:e,typeName:ce.ZodMap,...me(r)});var Eo=class e extends ye{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return J(n,{code:W.invalid_type,expected:Z.set,received:n.parsedType}),se;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(J(n,{code:W.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(J(n,{code:W.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let h of c){if(h.status==="aborted")return se;h.status==="dirty"&&r.dirty(),u.add(h.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new Rt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Eo.create=(e,t)=>new Eo({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...me(t)});var _s=class e extends ye{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return J(r,{code:W.invalid_type,expected:Z.function,received:r.parsedType}),se;function n(s,c){return Mi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,So(),or].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:c}})}function o(s,c){return Mi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,So(),or].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof kr){let s=this;return it(/*#__PURE__*/_asyncToGenerator(function*(...c){let u=new gt([]),h=yield s._def.args.parseAsync(c,i).catch(g=>{throw u.addIssue(n(c,g)),u}),v=yield Reflect.apply(a,this,h);return yield s._def.returns._def.type.parseAsync(v,i).catch(g=>{throw u.addIssue(o(v,g)),u})}))}else{let s=this;return it(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new gt([n(c,u.error)]);let h=Reflect.apply(a,this,u.data),v=s._def.returns.safeParse(h,i);if(!v.success)throw new gt([o(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Gt.create(t).rest(ar.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Gt.create([]).rest(ar.create()),returns:r||ar.create(),typeName:ce.ZodFunction,...me(n)})}},dn=class extends ye{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};dn.create=(e,t)=>new dn({getter:e,typeName:ce.ZodLazy,...me(t)});var pn=class extends ye{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return J(r,{received:r.data,code:W.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:t.data}}get value(){return this._def.value}};pn.create=(e,t)=>new pn({value:e,typeName:ce.ZodLiteral,...me(t)});function Zh(e,t){return new fn({values:e,typeName:ce.ZodEnum,...me(t)})}var fn=class e extends ye{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{expected:Ae.joinValues(n),received:r.parsedType,code:W.invalid_type}),se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{received:r.data,code:W.invalid_enum_value,options:n}),se}return it(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};fn.create=Zh;var mn=class extends ye{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let o=Ae.objectValues(r);return J(n,{expected:Ae.joinValues(o),received:n.parsedType,code:W.invalid_type}),se}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Ae.objectValues(r);return J(n,{received:n.data,code:W.invalid_enum_value,options:o}),se}return it(t.data)}get enum(){return this._def.values}};mn.create=(e,t)=>new mn({values:e,typeName:ce.ZodNativeEnum,...me(t)});var kr=class extends ye{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return J(r,{code:W.invalid_type,expected:Z.promise,received:r.parsedType}),se;let n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return it(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};kr.create=(e,t)=>new kr({type:e,typeName:ce.ZodPromise,...me(t)});var It=class extends ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this12=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{J(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(s){if(r.value==="aborted")return se;let c=yield _this12._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?se:c.status==="dirty"?tn(c.value):r.value==="dirty"?tn(c.value):c});return function(_x83){return _ref41.apply(this,arguments)}}());{if(r.value==="aborted")return se;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?tn(s.value):r.value==="dirty"?tn(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?se:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ir(a))return se;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Ir(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):se);Ae.assertNever(o)}};It.create=(e,t,r)=>new It({schema:e,typeName:ce.ZodEffects,effect:t,...me(r)});It.createWithPreprocess=(e,t,r)=>new It({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...me(r)});var Et=class extends ye{_parse(t){return this._getType(t)===Z.undefined?it(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:ce.ZodOptional,...me(t)});var $t=class extends ye{_parse(t){return this._getType(t)===Z.null?it(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};$t.create=(e,t)=>new $t({innerType:e,typeName:ce.ZodNullable,...me(t)});var gn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};gn.create=(e,t)=>new gn({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...me(t)});var hn=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...me(t)});var Ro=class extends ye{_parse(t){if(this._getType(t)!==Z.nan){let n=this._getOrReturnCtx(t);return J(n,{code:W.invalid_type,expected:Z.nan,received:n.parsedType}),se}return{status:"valid",value:t.data}}};Ro.create=e=>new Ro({typeName:ce.ZodNaN,...me(e)});var nI=Symbol("zod_brand"),ji=class extends ye{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},qi=class e extends ye{_parse(t){var _this13=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let i=yield _this13._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?se:i.status==="dirty"?(r.dirty(),tn(i.value)):_this13._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?se:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ce.ZodPipeline})}},yn=class extends ye{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Ir(o)&&(o.value=Object.freeze(o.value)),o);return bo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};yn.create=(e,t)=>new yn({innerType:e,typeName:ce.ZodReadonly,...me(t)});function Kh(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function ey(e,t={},r){return e?_r.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Kh(t,n),c=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:c})}});if(!i){let a=Kh(t,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):_r.create()}var oI={object:ht.lazycreate},ce;(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"})(ce||(ce={}));var iI=(e,t={message:`Input not instance of ${e.name}`})=>ey(r=>r instanceof e,t),ty=Tr.create,ry=rn.create,aI=Ro.create,sI=nn.create,ny=on.create,cI=an.create,uI=wo.create,lI=sn.create,dI=cn.create,pI=_r.create,fI=ar.create,mI=Pt.create,gI=xo.create,hI=sr.create,yI=ht.create,vI=ht.strictCreate,SI=un.create,bI=Is.create,AI=ln.create,wI=Gt.create,xI=Ts.create,CI=Co.create,EI=Eo.create,RI=_s.create,II=dn.create,TI=pn.create,_I=fn.create,kI=mn.create,OI=kr.create,PI=It.create,NI=Et.create,FI=$t.create,DI=It.createWithPreprocess,MI=qi.create,jI=()=>ty().optional(),qI=()=>ry().optional(),LI=()=>ny().optional(),VI={string:e=>Tr.create({...e,coerce:!0}),number:e=>rn.create({...e,coerce:!0}),boolean:e=>on.create({...e,coerce:!0}),bigint:e=>nn.create({...e,coerce:!0}),date:e=>an.create({...e,coerce:!0})};var UI=se;var BI=R.object({name:R.string(),arguments:R.string()}),GI=R.object({id:R.string(),type:R.literal("function"),function:BI,encryptedValue:R.string().optional()}),ks=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),$I=R.object({type:R.literal("text"),text:R.string()}),oy=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),iy=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},w4=oy.superRefine((e,t)=>{iy(e,t)}),QI=R.discriminatedUnion("type",[$I,oy]),HI=QI.superRefine((e,t)=>{e.type==="binary"&&iy(e,t)}),zI=ks.extend({role:R.literal("developer"),content:R.string()}),WI=ks.extend({role:R.literal("system"),content:R.string()}),KI=ks.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(GI).optional()}),YI=ks.extend({role:R.literal("user"),content:R.union([R.string(),R.array(HI)])}),XI=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),JI=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),ZI=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),ay=R.discriminatedUnion("role",[zI,WI,KI,YI,XI,JI,ZI]),x4=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),eT=R.object({description:R.string(),value:R.string()}),tT=R.object({name:R.string(),description:R.string(),parameters:R.any()}),rT=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(ay),tools:R.array(tT),context:R.array(eT),forwardedProps:R.any()}),nT=R.any(),je=class extends Error{constructor(e){super(e)}},Id=class extends je{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},sy=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.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}({}),Re=R.object({type:R.nativeEnum(F),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),oT=Re.extend({type:R.literal(F.TEXT_MESSAGE_START),messageId:R.string(),role:sy.default("assistant")}),cy=Re.extend({type:R.literal(F.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),iT=Re.extend({type:R.literal(F.TEXT_MESSAGE_END),messageId:R.string()}),aT=Re.extend({type:R.literal(F.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:sy.optional(),delta:R.string().optional()}),sT=Re.extend({type:R.literal(F.THINKING_TEXT_MESSAGE_START)}),cT=cy.omit({messageId:!0,type:!0}).extend({type:R.literal(F.THINKING_TEXT_MESSAGE_CONTENT)}),uT=Re.extend({type:R.literal(F.THINKING_TEXT_MESSAGE_END)}),lT=Re.extend({type:R.literal(F.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),dT=Re.extend({type:R.literal(F.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),pT=Re.extend({type:R.literal(F.TOOL_CALL_END),toolCallId:R.string()}),fT=Re.extend({messageId:R.string(),type:R.literal(F.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),mT=Re.extend({type:R.literal(F.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),gT=Re.extend({type:R.literal(F.THINKING_START),title:R.string().optional()}),hT=Re.extend({type:R.literal(F.THINKING_END)}),yT=Re.extend({type:R.literal(F.STATE_SNAPSHOT),snapshot:nT}),vT=Re.extend({type:R.literal(F.STATE_DELTA),delta:R.array(R.any())}),ST=Re.extend({type:R.literal(F.MESSAGES_SNAPSHOT),messages:R.array(ay)}),bT=Re.extend({type:R.literal(F.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),AT=Re.extend({type:R.literal(F.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),wT=Re.extend({type:R.literal(F.RAW),event:R.any(),source:R.string().optional()}),xT=Re.extend({type:R.literal(F.CUSTOM),name:R.string(),value:R.any()}),CT=Re.extend({type:R.literal(F.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:rT.optional()}),ET=Re.extend({type:R.literal(F.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),RT=Re.extend({type:R.literal(F.RUN_ERROR),message:R.string(),code:R.string().optional()}),IT=Re.extend({type:R.literal(F.STEP_STARTED),stepName:R.string()}),TT=Re.extend({type:R.literal(F.STEP_FINISHED),stepName:R.string()}),_T=R.union([R.literal("tool-call"),R.literal("message")]),kT=Re.extend({type:R.literal(F.REASONING_START),messageId:R.string()}),OT=Re.extend({type:R.literal(F.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),PT=Re.extend({type:R.literal(F.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string().refine(e=>e.length>0,"Delta must not be an empty string")}),NT=Re.extend({type:R.literal(F.REASONING_MESSAGE_END),messageId:R.string()}),FT=Re.extend({type:R.literal(F.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),DT=Re.extend({type:R.literal(F.REASONING_END),messageId:R.string()}),MT=Re.extend({type:R.literal(F.REASONING_ENCRYPTED_VALUE),subtype:_T,entityId:R.string(),encryptedValue:R.string()}),Os=R.discriminatedUnion("type",[oT,cy,iT,aT,gT,hT,sT,cT,uT,lT,dT,pT,mT,fT,yT,vT,ST,bT,AT,wT,xT,CT,ET,RT,IT,TT,kT,OT,PT,NT,FT,DT,MT]);m();d();f();p();var Td={};zo(Td,{JsonPatchError:()=>Ue,_areEquals:()=>Ui,applyOperation:()=>vn,applyPatch:()=>Or,applyReducer:()=>UT,deepClone:()=>LT,getValueByPointer:()=>Ms,validate:()=>ly,validator:()=>js});m();d();f();p();m();d();f();p();var jT=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),qT=Object.prototype.hasOwnProperty;function Ns(e,t){return qT.call(e,t)}function Fs(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Ns(e,o)&&n.push(o);return n}function nt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ds(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function Qt(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Li(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ps(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Ps(e[t]))return!0}else if(typeof e=="object"){for(var n=Fs(e),o=n.length,i=0;i<o;i++)if(Ps(e[n[i]]))return!0}}return!1}function uy(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
32
+ `)}var Vi=function(e){jT(t,e);function t(r,n,o,i,a){var s=this.constructor,c=e.call(this,uy(r,{name:n,index:o,operation:i,tree:a}))||this;return c.name=n,c.index=o,c.operation=i,c.tree=a,Object.setPrototypeOf(c,s.prototype),c.message=uy(r,{name:n,index:o,operation:i,tree:a}),c}return t}(Error);var Ue=Vi,LT=nt,Io={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ms(r,this.path);n&&(n=nt(n));var o=vn(r,{op:"remove",path:this.from}).removed;return vn(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ms(r,this.from);return vn(r,{op:"add",path:this.path,value:nt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Ui(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},VT={add:function(e,t,r){return Ds(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Io.move,copy:Io.copy,test:Io.test,_get:Io._get};function Ms(e,t){if(t=="")return e;var r={op:"_get",path:t};return vn(e,r),r.value}function vn(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):js(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=Ms(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=Ui(e,t.value),a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(r)throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{n||(e=nt(e));var s=t.path||"",c=s.split("/"),u=e,h=1,v=c.length,S=void 0,g=void 0,y=void 0;for(typeof r=="function"?y=r:y=js;;){if(g=c[h],g&&g.indexOf("~")!=-1&&(g=Li(g)),o&&(g=="__proto__"||g=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&S===void 0&&(u[g]===void 0?S=c.slice(0,h).join("/"):h==v-1&&(S=t.path),S!==void 0&&y(t,0,e,S)),h++,Array.isArray(u)){if(g==="-")g=u.length;else{if(r&&!Ds(g))throw new Ue("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);Ds(g)&&(g=~~g)}if(h>=v){if(r&&t.op==="add"&&g>u.length)throw new Ue("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=VT[t.op].call(t,u,g,e);if(a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(h>=v){var a=Io[t.op].call(t,u,g,e);if(a.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(u=u[g],r&&h<v&&(!u||typeof u!="object"))throw new Ue("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function Or(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=nt(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=vn(e,t[a],r,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function UT(e,t,r){var n=vn(e,t);if(n.test===!1)throw new Ue("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function js(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ue("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Io[e.op]){if(typeof e.path!="string")throw new Ue("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ue("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ue("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ue("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ps(e.value))throw new Ue("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Ue("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Ue("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=ly([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ue("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ue("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function ly(e,t,r){try{if(!Array.isArray(e))throw new Ue("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Or(nt(t),nt(e),r||!0);else{r=r||js;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Ue)return o;throw o}}function Ui(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,a;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!Ui(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!Ui(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var Pd={};zo(Pd,{compare:()=>KT,generate:()=>_d,observe:()=>WT,unobserve:()=>zT});m();d();f();p();var kd=new WeakMap,BT=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),GT=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function $T(e){return kd.get(e)}function QT(e,t){return e.observers.get(t)}function HT(e,t){e.observers.delete(t.callback)}function zT(e,t){t.unobserve()}function WT(e,t){var r=[],n,o=$T(e);if(!o)o=new BT(e),kd.set(e,o);else{var i=QT(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=nt(e),t){n.callback=t,n.next=null;var a=function(){_d(n)},s=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return n.patches=r,n.object=e,n.unobserve=function(){_d(n),clearTimeout(n.next),HT(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new GT(t,n)),n}function _d(e,t){t===void 0&&(t=!1);var r=kd.get(e.object);Od(r.value,e.object,e.patches,"",t),e.patches.length&&Or(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Od(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=Fs(t),a=Fs(e),s=!1,c=!1,u=a.length-1;u>=0;u--){var h=a[u],v=e[h];if(Ns(t,h)&&!(t[h]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var S=t[h];typeof v=="object"&&v!=null&&typeof S=="object"&&S!=null&&Array.isArray(v)===Array.isArray(S)?Od(v,S,r,n+"/"+Qt(h),o):v!==S&&(s=!0,o&&r.push({op:"test",path:n+"/"+Qt(h),value:nt(v)}),r.push({op:"replace",path:n+"/"+Qt(h),value:nt(S)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Qt(h),value:nt(v)}),r.push({op:"remove",path:n+"/"+Qt(h)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),s=!0)}if(!(!c&&i.length==a.length))for(var u=0;u<i.length;u++){var h=i[u];!Ns(e,h)&&t[h]!==void 0&&r.push({op:"add",path:n+"/"+Qt(h),value:nt(t[h])})}}}function KT(e,t,r){r===void 0&&(r=!1);var n=[];return Od(e,t,n,"",r),n}var W4=Object.assign({},Td,Pd,{JsonPatchError:Vi,deepClone:nt,escapePathComponent:Qt,unescapePathComponent:Li});m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Nd=function(e,t){return Nd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Nd(e,t)};function Ht(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Nd(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function dy(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(v){a(v)}}function c(h){try{u(n.throw(h))}catch(v){a(v)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}function qs(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(r=0)),r;)try{if(n=1,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(h){u=[6,h],o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function cr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function To(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function _o(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Sn(e){return this instanceof Sn?(this.v=e,this):new Sn(e)}function py(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(g){return function(y){return Promise.resolve(y).then(g,v)}}function s(g,y){n[g]&&(o[g]=function(x){return new Promise(function(E,C){i.push([g,x,E,C])>1||c(g,x)})},y&&(o[g]=y(o[g])))}function c(g,y){try{u(n[g](y))}catch(x){S(i[0][3],x)}}function u(g){g.value instanceof Sn?Promise.resolve(g.value.v).then(h,v):S(i[0][2],g)}function h(g){c("next",g)}function v(g){c("throw",g)}function S(g,y){g(y),i.shift(),i.length&&c(i[0][0],i[0][1])}}function fy(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof cr=="function"?cr(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(s,c){a=e[i](a),o(s,c,a.done,a.value)})}}function o(i,a,s,c){Promise.resolve(c).then(function(u){i({value:u,done:s})},a)}}m();d();f();p();function Se(e){return typeof e=="function"}m();d();f();p();m();d();f();p();m();d();f();p();function ko(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Ls=ko(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
33
33
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
34
- `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();p();f();function $i(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Po=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=cr(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(x){t={error:x}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(Se(h))try{h()}catch(x){i=x instanceof js?x.errors:[x]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=cr(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{dy(y)}catch(x){i=i??[],x instanceof js?i=ko(ko([],_o(i)),_o(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{g&&!g.done&&(o=S.return)&&o.call(S)}finally{if(n)throw n.error}}}if(i)throw new js(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)dy(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&$i(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&$i(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Nd=Po.EMPTY;function Ls(e){return e instanceof Po||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function dy(e){Se(e)?e():e.unsubscribe()}m();d();p();f();var Nt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();p();f();m();d();p();f();var No={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=No.delegate;return o?.setTimeout?o.setTimeout.apply(o,ko([e,t],_o(r))):setTimeout.apply(void 0,ko([e,t],_o(r)))},clearTimeout:function(e){var t=No.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Vs(e){No.setTimeout(function(){var t=Nt.onUnhandledError;if(t)t(e);else throw e})}m();d();p();f();function Gi(){}m();d();p();f();var fy=function(){return Fd("C",void 0,void 0)}();function py(e){return Fd("E",void 0,e)}function my(e){return Fd("N",e,void 0)}function Fd(e,t,r){return{kind:e,value:t,error:r}}m();d();p();f();var bn=null;function Fo(e){if(Nt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,o=r.error;if(bn=null,n)throw o}}else e()}function gy(e){Nt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Qi=function(e){Ht(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Ls(r)&&r.add(n)):n.destination=XT,n}return t.create=function(r,n,o){return new Bs(r,n,o)},t.prototype.next=function(r){this.isStopped?Md(my(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Md(py(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Md(fy,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Po);var WT=Function.prototype.bind;function Dd(e,t){return WT.call(e,t)}var KT=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Us(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Us(n)}else Us(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Us(r)}},e}(),Bs=function(e){Ht(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Se(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Nt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Dd(r.next,s),error:r.error&&Dd(r.error,s),complete:r.complete&&Dd(r.complete,s)}):a=r}return i.destination=new KT(a),i}return t}(Qi);function Us(e){Nt.useDeprecatedSynchronousErrorHandling?gy(e):Vs(e)}function YT(e){throw e}function Md(e,t){var r=Nt.onStoppedNotification;r&&No.setTimeout(function(){return r(e,t)})}var XT={closed:!0,next:Gi,error:YT,complete:Gi};m();d();p();f();var Do=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();p();f();m();d();p();f();function Mo(e){return e}function $s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qd(e)}function qd(e){return e.length===0?Mo:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ne=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=ZT(t)?t:new Bs(t,r,n);return Fo(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=hy(r),new r(function(o,i){var a=new Bs({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Do]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=hy(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function hy(e){var t;return(t=e??Nt.Promise)!==null&&t!==void 0?t:Promise}function JT(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function ZT(e){return e&&e instanceof Qi||JT(e)&&Ls(e)}m();d();p();f();function e_(e){return Se(e?.lift)}function $e(e){return function(t){if(e_(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();p();f();function Ge(e,t,r,n,o){return new t_(e,t,r,n,o)}var t_=function(e){Ht(t,e);function t(r,n,o,i,a,s){var c=e.call(this,r)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=n?function(u){try{n(u)}catch(h){r.error(h)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Qi);m();d();p();f();m();d();p();f();var yy=Oo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var zt=function(e){Ht(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new vy(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new yy},t.prototype.next=function(r){var n=this;Fo(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=cr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(u){o={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Fo(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Fo(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Nd:(this.currentObservers=null,s.push(r),new Po(function(){n.currentObservers=null,$i(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ne;return r.source=this,r},t.create=function(r,n){return new vy(r,n)},t}(Ne);var vy=function(e){Ht(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Nd},t}(zt);m();d();p();f();m();d();p();f();var jd={now:function(){return(jd.delegate||Date).now()},delegate:void 0};var Gs=function(e){Ht(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=jd);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,c=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),c=0;c<s.length&&!r.closed;c+=i?1:2)r.next(s[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var c=o.now(),u=0,h=1;h<i.length&&i[h]<=c;h+=2)u=h;u&&i.splice(0,u+1)}},t}(zt);m();d();p();f();var Qs=new Ne(function(e){return e.complete()});m();d();p();f();m();d();p();f();m();d();p();f();function Sy(e){return e&&Se(e.schedule)}function r_(e){return e[e.length-1]}function by(e){return Sy(r_(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 Hs=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();p();f();function zs(e){return Se(e?.then)}m();d();p();f();function Ws(e){return Se(e[Do])}m();d();p();f();function Ks(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();p();f();function Ys(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 n_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xs=n_();function Js(e){return Se(e?.[Xs])}m();d();p();f();function Zs(e){return uy(this,arguments,function(){var r,n,o,i;return qs(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Sn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Sn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Sn(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ec(e){return Se(e?.getReader)}function Qe(e){if(e instanceof Ne)return e;if(e!=null){if(Ws(e))return o_(e);if(Hs(e))return i_(e);if(zs(e))return a_(e);if(Ks(e))return Ay(e);if(Js(e))return s_(e);if(ec(e))return c_(e)}throw Ys(e)}function o_(e){return new Ne(function(t){var r=e[Do]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function i_(e){return new Ne(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function a_(e){return new Ne(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Vs)})}function s_(e){return new Ne(function(t){var r,n;try{for(var o=cr(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function Ay(e){return new Ne(function(t){u_(e,t).catch(function(r){return t.error(r)})})}function c_(e){return Ay(Zs(e))}function u_(e,t){var r,n,o,i;return cy(this,void 0,void 0,function(){var a,s;return qs(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=ly(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),o={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();p();f();m();d();p();f();function Tt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function tc(e,t){return t===void 0&&(t=0),$e(function(r,n){r.subscribe(Ge(n,function(o){return Tt(n,e,function(){return n.next(o)},t)},function(){return Tt(n,e,function(){return n.complete()},t)},function(o){return Tt(n,e,function(){return n.error(o)},t)}))})}m();d();p();f();function rc(e,t){return t===void 0&&(t=0),$e(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function wy(e,t){return Qe(e).pipe(rc(t),tc(t))}m();d();p();f();function xy(e,t){return Qe(e).pipe(rc(t),tc(t))}m();d();p();f();function Cy(e,t){return new Ne(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();p();f();function Ey(e,t){return new Ne(function(r){var n;return Tt(r,t,function(){n=e[Xs](),Tt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();p();f();function nc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ne(function(r){Tt(r,t,function(){var n=e[Symbol.asyncIterator]();Tt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();p();f();function Ry(e,t){return nc(Zs(e),t)}function Iy(e,t){if(e!=null){if(Ws(e))return wy(e,t);if(Hs(e))return Cy(e,t);if(zs(e))return xy(e,t);if(Ks(e))return nc(e,t);if(Js(e))return Ey(e,t);if(ec(e))return Ry(e,t)}throw Ys(e)}function An(e,t){return t?Iy(e,t):Qe(e)}function je(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=by(e);return An(e,r)}m();d();p();f();function Fe(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ne(t?function(o){return t.schedule(n,0,o)}:n)}m();d();p();f();m();d();p();f();var Ty=Oo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function oc(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new Ty)}})})}m();d();p();f();function wn(e,t){return $e(function(r,n){var o=0;r.subscribe(Ge(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();p();f();m();d();p();f();m();d();p();f();function _y(e,t,r,n,o,i,a,s){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(x){return u<n?y(x):c.push(x)},y=function(x){i&&t.next(x),u++;var E=!1;Qe(r(x,h++)).subscribe(Ge(t,function(C){o?.(C),i?g(C):t.next(C)},function(){E=!0},void 0,function(){if(E)try{u--;for(var C=function(){var I=c.shift();a?Tt(t,a,function(){return y(I)}):y(I)};c.length&&u<n;)C();S()}catch(I){t.error(I)}}))};return e.subscribe(Ge(t,g,function(){v=!0,S()})),function(){s?.()}}function yt(e,t,r){return r===void 0&&(r=1/0),Se(t)?yt(function(n,o){return wn(function(i,a){return t(n,i,o,a)})(Qe(e(n,o)))},r):(typeof t=="number"&&(r=t),$e(function(n,o){return _y(n,o,e,r)}))}function Ld(e){return e===void 0&&(e=1/0),yt(Mo,e)}m();d();p();f();function Vd(e){return new Ne(function(t){Qe(e()).subscribe(t)})}m();d();p();f();function Hi(e){return $e(function(t,r){var n=null,o=!1,i;n=t.subscribe(Ge(r,void 0,void 0,function(a){i=Qe(e(a,Hi(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();p();f();function ic(e,t){return Se(t)?yt(e,t,1):yt(e,1)}m();d();p();f();function Ud(e){return $e(function(t,r){var n=!1;t.subscribe(Ge(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();p();f();function xn(e){return $e(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();p();f();function Bd(e,t){return $e(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe(Ge(n,function(c){o?.unsubscribe();var u=0,h=i++;Qe(e(c,h)).subscribe(o=Ge(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();p();f();function ac(e){return $e(function(t,r){Qe(e).subscribe(Ge(r,function(){return r.complete()},Gi)),!r.closed&&t.subscribe(r)})}m();d();p();f();function $d(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?$e(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe(Ge(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;s=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;s=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;s&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Mo}m();d();p();f();m();d();p();f();function ky(e){return` \r
35
- `.indexOf(e)>=0}function sc(e){for(var t=["topLevel"],r=0,n,o,i,a=function(I){return t.push(I)},s=function(I){return t[t.length-1]=I},c=function(I){n==null&&(n=r,o=t.length,i=I)},u=function(I){I===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(I){if("0"<=I&&I<="9"){a("number");return}switch(I){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():ky(y)||(u("collectionItem"),s("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":ky(y)||(u("collectionItem"),s("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],E=function(I){return x.push(I.slice(e.length-e.lastIndexOf(I[0])))},C=t.length-1;C>=0;C--)switch(t[C]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}m();d();p();f();m();d();p();f();m();d();p();f();function Py(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function uc(e,t,r){for(let i=0;i<28;i=i+7){let a=e>>>i,s=!(!(a>>>7)&&t==0),c=(s?a|128:a)&255;if(r.push(c),!s)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let a=t>>>i,s=!!(a>>>7),c=(s?a|128:a)&255;if(r.push(c),!s)return}r.push(t>>>31&1)}}var cc=4294967296;function Gd(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let c=Number(e.slice(a,s));o*=r,n=n*r+c,n>=cc&&(o=o+(n/cc|0),n=n%cc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Fy(n,o):Hd(n,o)}function Ny(e,t){let r=Hd(e,t),n=r.hi&2147483648;n&&(r=Fy(r.lo,r.hi));let o=Qd(r.lo,r.hi);return n?"-"+o:o}function Qd(e,t){if({lo:e,hi:t}=l_(e,t),t<=2097151)return String(cc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,c=1e7;return i>=c&&(a+=Math.floor(i/c),i%=c),a>=c&&(s+=Math.floor(a/c),a%=c),s.toString()+Oy(a)+Oy(i)}function l_(e,t){return{lo:e>>>0,hi:t>>>0}}function Hd(e,t){return{lo:e|0,hi:t|0}}function Fy(e,t){return t=~t,e?e=~e+1:t+=1,Hd(e,t)}var Oy=e=>{let t=String(e);return"0000000".slice(t.length)+t};function zd(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function Dy(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();p();f();var Ft=d_();function d_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),My(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),qy(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),My(r),Gd(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),qy(r),Gd(r)},dec(r,n){return Ny(r,n)},uDec(r,n){return Qd(r,n)}}}function My(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function qy(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();p();f();var Wd=Symbol.for("@bufbuild/protobuf/text-encoding");function Kd(){if(b[Wd]==null){let e=new b.TextEncoder,t=new b.TextDecoder;b[Wd]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return b[Wd]}var Pr;(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"})(Pr||(Pr={}));var f_=34028234663852886e22,p_=-34028234663852886e22,m_=4294967295,g_=2147483647,h_=-2147483648,Te=class{constructor(t=Kd().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(jy(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Yd(t),zd(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){y_(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){jy(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Yd(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Yd(t),t=(t<<1^t>>31)>>>0,zd(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Ft.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Ft.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Ft.enc(t);return uc(r.lo,r.hi,this.buf),this}sint64(t){let r=Ft.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return uc(o,i,this.buf),this}uint64(t){let r=Ft.uEnc(t);return uc(r.lo,r.hi,this.buf),this}},oe=class{constructor(t,r=Kd().decodeUtf8){this.decodeUtf8=r,this.varint64=Py,this.uint32=Dy,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case Pr.Varint:for(;this.buf[this.pos++]&128;);break;case Pr.Bit64:this.pos+=4;case Pr.Bit32:this.pos+=4;break;case Pr.LengthDelimited:let o=this.uint32();this.pos+=o;break;case Pr.StartGroup:for(;;){let[i,a]=this.tag();if(a===Pr.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(a,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Ft.dec(...this.varint64())}uint64(){return Ft.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Ft.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ft.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ft.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function Yd(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>g_||e<h_)throw new Error("invalid int32: "+e)}function jy(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>m_||e<0)throw new Error("invalid uint32: "+e)}function y_(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>f_||e<p_))throw new Error("invalid float32: "+e)}var v_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Xd(){return{fields:{}}}var zi={encode(e,t=new Te){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&ef.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Xd();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=ef.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zi.fromPartial(e??{})},fromPartial(e){let t=Xd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Xd();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function Ly(){return{key:"",value:void 0}}var ef={encode(e,t=new Te){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Ly();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ef.fromPartial(e??{})},fromPartial(e){let t=Ly();return t.key=e.key??"",t.value=e.value??void 0,t}};function Jd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var xe={encode(e,t=new Te){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&zi.encode(zi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Wi.encode(Wi.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Jd();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=zi.unwrap(zi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=Wi.unwrap(Wi.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=Jd();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=Jd();if(e===null)t.nullValue=v_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function Zd(){return{values:[]}}var Wi={encode(e,t=new Te){for(let r of e.values)xe.encode(xe.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Zd();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(xe.unwrap(xe.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Wi.fromPartial(e??{})},fromPartial(e){let t=Zd();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Zd();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},S_=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 Vy(){return{op:0,path:"",from:void 0,value:void 0}}var lc={encode(e,t=new Te){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Vy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lc.fromPartial(e??{})},fromPartial(e){let t=Vy();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function Uy(){return{id:"",type:"",function:void 0}}var dc={encode(e,t=new Te){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&fc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Uy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=fc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=Uy();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}};function By(){return{name:"",arguments:""}}var fc={encode(e,t=new Te){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=By();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=By();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function $y(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var pc={encode(e,t=new Te){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)dc.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=$y();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(dc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=$y();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>dc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t}},b_=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Gy(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ae={encode(e,t=new Te){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&xe.encode(xe.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Gy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=A_(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Gy();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Qy(){return{baseEvent:void 0,messageId:"",role:void 0}}var mc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Qy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=Qy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function Hy(){return{baseEvent:void 0,messageId:"",delta:""}}var gc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Hy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=Hy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function zy(){return{baseEvent:void 0,messageId:""}}var hc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=zy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=zy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Wy(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var yc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Wy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yc.fromPartial(e??{})},fromPartial(e){let t=Wy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Ky(){return{baseEvent:void 0,toolCallId:"",delta:""}}var vc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Ky();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vc.fromPartial(e??{})},fromPartial(e){let t=Ky();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function Yy(){return{baseEvent:void 0,toolCallId:""}}var Sc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Yy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sc.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function Xy(){return{baseEvent:void 0,snapshot:void 0}}var bc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&xe.encode(xe.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Xy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bc.fromPartial(e??{})},fromPartial(e){let t=Xy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function Jy(){return{baseEvent:void 0,delta:[]}}var Ac={encode(e,t=new Te){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)lc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Jy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(lc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ac.fromPartial(e??{})},fromPartial(e){let t=Jy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>lc.fromPartial(r))||[],t}};function Zy(){return{baseEvent:void 0,messages:[]}}var wc={encode(e,t=new Te){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)pc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Zy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(pc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>pc.fromPartial(r))||[],t}};function ev(){return{baseEvent:void 0,event:void 0,source:void 0}}var xc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&xe.encode(xe.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=xe.unwrap(xe.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=ev();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function tv(){return{baseEvent:void 0,name:"",value:void 0}}var Cc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=tv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=tv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function rv(){return{baseEvent:void 0,threadId:"",runId:""}}var Ec={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=rv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=rv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function nv(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Rc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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&&xe.encode(xe.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=nv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function ov(){return{baseEvent:void 0,code:void 0,message:""}}var Ic={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=ov();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=ov();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function iv(){return{baseEvent:void 0,stepName:""}}var Tc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=iv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=iv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function av(){return{baseEvent:void 0,stepName:""}}var _c={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=av();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=av();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function sv(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var kc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=sv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function cv(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Oc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=cv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=cv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function uv(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var lv={encode(e,t=new Te){return e.textMessageStart!==void 0&&mc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&gc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&hc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&yc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&vc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Sc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&bc.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Ac.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&wc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&xc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Cc.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Ec.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Rc.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ic.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Tc.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&_c.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&kc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Oc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=uv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=mc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=gc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=hc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=yc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=vc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=Sc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=bc.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=Ac.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=wc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=xc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Cc.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Ec.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Rc.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Ic.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=Tc.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=_c.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=kc.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Oc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return lv.fromPartial(e??{})},fromPartial(e){let t=uv();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?mc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?gc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?hc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?yc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?vc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Sc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?bc.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Ac.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?wc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?xc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Cc.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Ec.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Rc.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ic.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Tc.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?_c.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?kc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Oc.fromPartial(e.toolCallChunk):void 0,t}};function A_(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function dv(e){let t=lv.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=b_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===F.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===F.STATE_DELTA)for(let n of r.delta)n.op=S_[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),ks.parse(r)}var fv="application/vnd.ag-ui.event+proto";m();d();p();f();m();d();p();f();m();d();p();f();var x_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,tf=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(x_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},pv=e=>e==="*"||e==="x"||e==="X",mv=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},C_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],E_=(e,t)=>{if(pv(e)||pv(t))return 0;let[r,n]=C_(mv(e),mv(t));return r>n?1:r<n?-1:0},rf=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=E_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Pc=(e,t)=>{let r=tf(e),n=tf(t),o=r.pop(),i=n.pop(),a=rf(r,n);return a!==0?a:o&&i?rf(o.split("."),i.split(".")):o||i?o?-1:1:0};var ke=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Ki(){return Rr()}function _e(_x78,_x79,_x80,_x81){return _e2.apply(this,arguments)}function _e2(){_e2=_asyncToGenerator(function*(e,t,r,n){let o=t,i=r,a;for(let s of e)try{let c=yield n(s,ke(o),ke(i));if(c===void 0)continue;if(c.messages!==void 0&&(o=c.messages),c.state!==void 0&&(i=c.state),a=c.stopPropagation,a===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(o)===JSON.stringify(t)?{}:{messages:o}),...(JSON.stringify(i)===JSON.stringify(r)?{}:{state:i}),...(a===void 0?{}:{stopPropagation:a})}});return _e2.apply(this,arguments)}var bv=(e,t,r,n)=>{let o=ke(r.messages),i=ke(e.state),a={},s=u=>{u.messages!==void 0&&(o=u.messages,a.messages=u.messages),u.state!==void 0&&(i=u.state,a.state=u.state)},c=()=>{let u=ke(a);return a={},u.messages!==void 0||u.state!==void 0?je(u):Qs};return t.pipe(ic(/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(u){let h=yield _e(n,o,i,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(s(h),h.stopPropagation===!0)return c();switch(u.type){case F.TEXT_MESSAGE_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!o.find(y=>y.id===S)){let y={id:S,role:g,content:""};o.push(y),s({messages:o})}}return c()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=o.find(x=>x.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield _e(n,o,i,(x,E,C)=>x.onTextMessageContentEvent?.({event:u,messages:E,state:C,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return s(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,s({messages:o})),c()}case F.TEXT_MESSAGE_END:{let{messageId:v}=u,S=o.find(g=>g.id===v);return S?(s(yield _e(n,o,i,(g,y,x)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:x,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case F.TOOL_CALL_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,x;y&&o.length>0&&o[o.length-1].id===y?x=o[o.length-1]:(x={id:y||S,role:"assistant",toolCalls:[]},o.push(x)),x.toolCalls??(x.toolCalls=[]),x.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),s({messages:o})}return c()}case F.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=o.find(E=>E.toolCalls?.some(C=>C.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(E=>E.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let x=yield _e(n,o,i,(E,C,I)=>{let T=y.function.arguments,_=y.function.name,j={};try{j=sc(T)}catch{}return E.onToolCallArgsEvent?.({event:u,messages:C,state:I,agent:r,input:e,toolCallBuffer:T,toolCallName:_,partialToolCallArgs:j})});return s(x),x.stopPropagation!==!0&&(y.function.arguments+=S,s({messages:o})),c()}case F.TOOL_CALL_END:{let{toolCallId:v}=u,S=o.find(y=>y.toolCalls?.some(x=>x.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(s(yield _e(n,o,i,(y,x,E)=>{let C=g.function.arguments,I=g.function.name,T={};try{T=JSON.parse(C)}catch{}return y.onToolCallEndEvent?.({event:u,messages:x,state:E,agent:r,input:e,toolCallName:I,toolCallArgs:T})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case F.TOOL_CALL_RESULT:{let v=yield _e(n,o,i,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:x}=u,E={id:S,toolCallId:g,role:x||"tool",content:y};o.push(E),yield Promise.all(n.map(C=>{C.onNewMessage?.({message:E,messages:o,state:i,agent:r,input:e})})),s({messages:o})}return c()}case F.STATE_SNAPSHOT:{let v=yield _e(n,o,i,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{snapshot:S}=u;i=S,s({state:i})}return c()}case F.STATE_DELTA:{let v=yield _e(n,o,i,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{delta:S}=u;try{i=Or(i,S,!0,!1).newDocument,s({state:i})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
34
+ `):"",this.name="UnsubscriptionError",this.errors=r}});m();d();f();p();function Bi(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Oo=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=cr(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(x){t={error:x}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(Se(h))try{h()}catch(x){i=x instanceof Ls?x.errors:[x]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var S=cr(v),g=S.next();!g.done;g=S.next()){var y=g.value;try{my(y)}catch(x){i=i??[],x instanceof Ls?i=_o(_o([],To(i)),To(x.errors)):i.push(x)}}}catch(x){n={error:x}}finally{try{g&&!g.done&&(o=S.return)&&o.call(S)}finally{if(n)throw n.error}}}if(i)throw new Ls(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)my(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Bi(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Bi(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Fd=Oo.EMPTY;function Vs(e){return e instanceof Oo||e&&"closed"in e&&Se(e.remove)&&Se(e.add)&&Se(e.unsubscribe)}function my(e){Se(e)?e():e.unsubscribe()}m();d();f();p();var Nt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};m();d();f();p();m();d();f();p();var Po={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Po.delegate;return o?.setTimeout?o.setTimeout.apply(o,_o([e,t],To(r))):setTimeout.apply(void 0,_o([e,t],To(r)))},clearTimeout:function(e){var t=Po.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Us(e){Po.setTimeout(function(){var t=Nt.onUnhandledError;if(t)t(e);else throw e})}m();d();f();p();function Gi(){}m();d();f();p();var gy=function(){return Dd("C",void 0,void 0)}();function hy(e){return Dd("E",void 0,e)}function yy(e){return Dd("N",e,void 0)}function Dd(e,t,r){return{kind:e,value:t,error:r}}m();d();f();p();var bn=null;function No(e){if(Nt.useDeprecatedSynchronousErrorHandling){var t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){var r=bn,n=r.errorThrown,o=r.error;if(bn=null,n)throw o}}else e()}function vy(e){Nt.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var $i=function(e){Ht(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Vs(r)&&r.add(n)):n.destination=e_,n}return t.create=function(r,n,o){return new Gs(r,n,o)},t.prototype.next=function(r){this.isStopped?jd(yy(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?jd(hy(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?jd(gy,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Oo);var XT=Function.prototype.bind;function Md(e,t){return XT.call(e,t)}var JT=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Bs(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Bs(n)}else Bs(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Bs(r)}},e}(),Gs=function(e){Ht(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(Se(r)||!r)a={next:r??void 0,error:n??void 0,complete:o??void 0};else{var s;i&&Nt.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Md(r.next,s),error:r.error&&Md(r.error,s),complete:r.complete&&Md(r.complete,s)}):a=r}return i.destination=new JT(a),i}return t}($i);function Bs(e){Nt.useDeprecatedSynchronousErrorHandling?vy(e):Us(e)}function ZT(e){throw e}function jd(e,t){var r=Nt.onStoppedNotification;r&&Po.setTimeout(function(){return r(e,t)})}var e_={closed:!0,next:Gi,error:ZT,complete:Gi};m();d();f();p();var Fo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();m();d();f();p();m();d();f();p();function Do(e){return e}function $s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qd(e)}function qd(e){return e.length===0?Do:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ne=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=r_(t)?t:new Gs(t,r,n);return No(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Sy(r),new r(function(o,i){var a=new Gs({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Fo]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Sy(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function Sy(e){var t;return(t=e??Nt.Promise)!==null&&t!==void 0?t:Promise}function t_(e){return e&&Se(e.next)&&Se(e.error)&&Se(e.complete)}function r_(e){return e&&e instanceof $i||t_(e)&&Vs(e)}m();d();f();p();function n_(e){return Se(e?.lift)}function Ge(e){return function(t){if(n_(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}m();d();f();p();function $e(e,t,r,n,o){return new o_(e,t,r,n,o)}var o_=function(e){Ht(t,e);function t(r,n,o,i,a,s){var c=e.call(this,r)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=n?function(u){try{n(u)}catch(h){r.error(h)}}:e.prototype._next,c._error=i?function(u){try{i(u)}catch(h){r.error(h)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(u){r.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}($i);m();d();f();p();m();d();f();p();var by=ko(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var zt=function(e){Ht(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Ay(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new by},t.prototype.next=function(r){var n=this;No(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=cr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(u){o={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;No(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;No(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Fd:(this.currentObservers=null,s.push(r),new Oo(function(){n.currentObservers=null,Bi(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new Ne;return r.source=this,r},t.create=function(r,n){return new Ay(r,n)},t}(Ne);var Ay=function(e){Ht(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Fd},t}(zt);m();d();f();p();m();d();f();p();var Ld={now:function(){return(Ld.delegate||Date).now()},delegate:void 0};var Qs=function(e){Ht(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Ld);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,c=n._windowTime;o||(i.push(r),!a&&i.push(s.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),c=0;c<s.length&&!r.closed;c+=i?1:2)r.next(s[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,i=r._buffer,a=r._infiniteTimeWindow,s=(a?1:2)*n;if(n<1/0&&s<i.length&&i.splice(0,i.length-s),!a){for(var c=o.now(),u=0,h=1;h<i.length&&i[h]<=c;h+=2)u=h;u&&i.splice(0,u+1)}},t}(zt);m();d();f();p();var Hs=new Ne(function(e){return e.complete()});m();d();f();p();m();d();f();p();m();d();f();p();function wy(e){return e&&Se(e.schedule)}function i_(e){return e[e.length-1]}function xy(e){return wy(i_(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 zs=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};m();d();f();p();function Ws(e){return Se(e?.then)}m();d();f();p();function Ks(e){return Se(e[Fo])}m();d();f();p();function Ys(e){return Symbol.asyncIterator&&Se(e?.[Symbol.asyncIterator])}m();d();f();p();function Xs(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 a_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Js=a_();function Zs(e){return Se(e?.[Js])}m();d();f();p();function ec(e){return py(this,arguments,function(){var r,n,o,i;return qs(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Sn(r.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,Sn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Sn(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function tc(e){return Se(e?.getReader)}function Qe(e){if(e instanceof Ne)return e;if(e!=null){if(Ks(e))return s_(e);if(zs(e))return c_(e);if(Ws(e))return u_(e);if(Ys(e))return Cy(e);if(Zs(e))return l_(e);if(tc(e))return d_(e)}throw Xs(e)}function s_(e){return new Ne(function(t){var r=e[Fo]();if(Se(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function c_(e){return new Ne(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function u_(e){return new Ne(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Us)})}function l_(e){return new Ne(function(t){var r,n;try{for(var o=cr(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function Cy(e){return new Ne(function(t){p_(e,t).catch(function(r){return t.error(r)})})}function d_(e){return Cy(ec(e))}function p_(e,t){var r,n,o,i;return dy(this,void 0,void 0,function(){var a,s;return qs(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=fy(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),o={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}m();d();f();p();m();d();f();p();function Tt(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function rc(e,t){return t===void 0&&(t=0),Ge(function(r,n){r.subscribe($e(n,function(o){return Tt(n,e,function(){return n.next(o)},t)},function(){return Tt(n,e,function(){return n.complete()},t)},function(o){return Tt(n,e,function(){return n.error(o)},t)}))})}m();d();f();p();function nc(e,t){return t===void 0&&(t=0),Ge(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Ey(e,t){return Qe(e).pipe(nc(t),rc(t))}m();d();f();p();function Ry(e,t){return Qe(e).pipe(nc(t),rc(t))}m();d();f();p();function Iy(e,t){return new Ne(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}m();d();f();p();function Ty(e,t){return new Ne(function(r){var n;return Tt(r,t,function(){n=e[Js](),Tt(r,t,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return Se(n?.return)&&n.return()}})}m();d();f();p();function oc(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ne(function(r){Tt(r,t,function(){var n=e[Symbol.asyncIterator]();Tt(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}m();d();f();p();function _y(e,t){return oc(ec(e),t)}function ky(e,t){if(e!=null){if(Ks(e))return Ey(e,t);if(zs(e))return Iy(e,t);if(Ws(e))return Ry(e,t);if(Ys(e))return oc(e,t);if(Zs(e))return Ty(e,t);if(tc(e))return _y(e,t)}throw Xs(e)}function An(e,t){return t?ky(e,t):Qe(e)}function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=xy(e);return An(e,r)}m();d();f();p();function Fe(e,t){var r=Se(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ne(t?function(o){return t.schedule(n,0,o)}:n)}m();d();f();p();m();d();f();p();var Oy=ko(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ic(e,t){var r=typeof t=="object";return new Promise(function(n,o){var i=!1,a;e.subscribe({next:function(s){a=s,i=!0},error:o,complete:function(){i?n(a):r?n(t.defaultValue):o(new Oy)}})})}m();d();f();p();function wn(e,t){return Ge(function(r,n){var o=0;r.subscribe($e(n,function(i){n.next(e.call(t,i,o++))}))})}m();d();f();p();m();d();f();p();m();d();f();p();function Py(e,t,r,n,o,i,a,s){var c=[],u=0,h=0,v=!1,S=function(){v&&!c.length&&!u&&t.complete()},g=function(x){return u<n?y(x):c.push(x)},y=function(x){i&&t.next(x),u++;var E=!1;Qe(r(x,h++)).subscribe($e(t,function(C){o?.(C),i?g(C):t.next(C)},function(){E=!0},void 0,function(){if(E)try{u--;for(var C=function(){var I=c.shift();a?Tt(t,a,function(){return y(I)}):y(I)};c.length&&u<n;)C();S()}catch(I){t.error(I)}}))};return e.subscribe($e(t,g,function(){v=!0,S()})),function(){s?.()}}function yt(e,t,r){return r===void 0&&(r=1/0),Se(t)?yt(function(n,o){return wn(function(i,a){return t(n,i,o,a)})(Qe(e(n,o)))},r):(typeof t=="number"&&(r=t),Ge(function(n,o){return Py(n,o,e,r)}))}function Vd(e){return e===void 0&&(e=1/0),yt(Do,e)}m();d();f();p();function Ud(e){return new Ne(function(t){Qe(e()).subscribe(t)})}m();d();f();p();function Qi(e){return Ge(function(t,r){var n=null,o=!1,i;n=t.subscribe($e(r,void 0,void 0,function(a){i=Qe(e(a,Qi(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(r))})}m();d();f();p();function ac(e,t){return Se(t)?yt(e,t,1):yt(e,1)}m();d();f();p();function Bd(e){return Ge(function(t,r){var n=!1;t.subscribe($e(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}m();d();f();p();function xn(e){return Ge(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}m();d();f();p();function Gd(e,t){return Ge(function(r,n){var o=null,i=0,a=!1,s=function(){return a&&!o&&n.complete()};r.subscribe($e(n,function(c){o?.unsubscribe();var u=0,h=i++;Qe(e(c,h)).subscribe(o=$e(n,function(v){return n.next(t?t(c,v,h,u++):v)},function(){o=null,s()}))},function(){a=!0,s()}))})}m();d();f();p();function sc(e){return Ge(function(t,r){Qe(e).subscribe($e(r,function(){return r.complete()},Gi)),!r.closed&&t.subscribe(r)})}m();d();f();p();function $d(e,t,r){var n=Se(e)||t||r?{next:e,error:t,complete:r}:e;return n?Ge(function(o,i){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var s=!0;o.subscribe($e(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;s=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;s=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;s&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):Do}m();d();f();p();m();d();f();p();function Ny(e){return` \r
35
+ `.indexOf(e)>=0}function cc(e){for(var t=["topLevel"],r=0,n,o,i,a=function(I){return t.push(I)},s=function(I){return t[t.length-1]=I},c=function(I){n==null&&(n=r,o=t.length,i=I)},u=function(I){I===i&&(n=void 0,o=void 0,i=void 0)},h=function(){return t.pop()},v=function(){return r--},S=function(I){if("0"<=I&&I<="9"){a("number");return}switch(I){case"\"":a("string");return;case"-":a("numberNeedsDigit");return;case"t":a("true");return;case"f":a("false");return;case"n":a("null");return;case"[":a("arrayNeedsValue");return;case"{":a("objectNeedsKey");return}},g=e.length;r<g;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":S(y);break;case"string":switch(y){case"\"":h();break;case"\\":c("stringEscape"),a("stringEscaped");break}break;case"stringEscaped":y==="u"?a("stringUnicode"):(u("stringEscape"),h());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(u("stringEscape"),h());break;case"number":y==="."?s("numberNeedsDigit"):y==="e"||y==="E"?s("numberNeedsExponent"):(y<"0"||y>"9")&&(v(),h());break;case"numberNeedsDigit":s("number");break;case"numberNeedsExponent":s(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(v(),h());break;case"arrayNeedsValue":y==="]"?h():Ny(y)||(u("collectionItem"),s("arrayNeedsComma"),S(y));break;case"arrayNeedsComma":y==="]"?h():y===","&&(c("collectionItem"),s("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?h():y==="\""&&(c("collectionItem"),s("objectNeedsColon"),a("string"));break;case"objectNeedsColon":y===":"&&s("objectNeedsValue");break;case"objectNeedsValue":Ny(y)||(u("collectionItem"),s("objectNeedsComma"),S(y));break;case"objectNeedsComma":y==="}"?h():y===","&&(c("collectionItem"),s("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var x=[n!=null?e.slice(0,n):e],E=function(I){return x.push(I.slice(e.length-e.lastIndexOf(I[0])))},C=t.length-1;C>=0;C--)switch(t[C]){case"string":x.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":x.push("0");break;case"true":E("true");break;case"false":E("false");break;case"null":E("null");break;case"arrayNeedsValue":case"arrayNeedsComma":x.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":x.push("}");break}return x.join("")}m();d();f();p();m();d();f();p();m();d();f();p();function Dy(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function lc(e,t,r){for(let i=0;i<28;i=i+7){let a=e>>>i,s=!(!(a>>>7)&&t==0),c=(s?a|128:a)&255;if(r.push(c),!s)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let i=3;i<31;i=i+7){let a=t>>>i,s=!!(a>>>7),c=(s?a|128:a)&255;if(r.push(c),!s)return}r.push(t>>>31&1)}}var uc=4294967296;function Qd(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(a,s){let c=Number(e.slice(a,s));o*=r,n=n*r+c,n>=uc&&(o=o+(n/uc|0),n=n%uc)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?jy(n,o):zd(n,o)}function My(e,t){let r=zd(e,t),n=r.hi&2147483648;n&&(r=jy(r.lo,r.hi));let o=Hd(r.lo,r.hi);return n?"-"+o:o}function Hd(e,t){if({lo:e,hi:t}=f_(e,t),t<=2097151)return String(uc*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,a=n+o*8147497,s=o*2,c=1e7;return i>=c&&(a+=Math.floor(i/c),i%=c),a>=c&&(s+=Math.floor(a/c),a%=c),s.toString()+Fy(a)+Fy(i)}function f_(e,t){return{lo:e>>>0,hi:t>>>0}}function zd(e,t){return{lo:e|0,hi:t|0}}function jy(e,t){return t=~t,e?e=~e+1:t+=1,zd(e,t)}var Fy=e=>{let t=String(e);return"0000000".slice(t.length)+t};function Wd(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function qy(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}m();d();f();p();var Ft=m_();function m_(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!b.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>n||s<r)throw new Error(`invalid int64: ${a}`);return s},uParse(a){let s=typeof a=="bigint"?a:BigInt(a);if(s>i||s<o)throw new Error(`invalid uint64: ${a}`);return s},enc(a){return e.setBigInt64(0,this.parse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(a){return e.setBigInt64(0,this.uParse(a),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigInt64(0,!0)},uDec(a,s){return e.setInt32(0,a,!0),e.setInt32(4,s,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),Ly(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),Vy(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),Ly(r),Qd(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),Vy(r),Qd(r)},dec(r,n){return My(r,n)},uDec(r,n){return Hd(r,n)}}}function Ly(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Vy(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}m();d();f();p();var Kd=Symbol.for("@bufbuild/protobuf/text-encoding");function Yd(){if(b[Kd]==null){let e=new b.TextEncoder,t=new b.TextDecoder;b[Kd]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return b[Kd]}var Pr;(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"})(Pr||(Pr={}));var g_=34028234663852886e22,h_=-34028234663852886e22,y_=4294967295,v_=2147483647,S_=-2147483648,Te=class{constructor(t=Yd().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(Uy(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Xd(t),Wd(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){b_(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){Uy(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){Xd(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return Xd(t),t=(t<<1^t>>31)>>>0,Wd(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Ft.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Ft.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Ft.enc(t);return lc(r.lo,r.hi,this.buf),this}sint64(t){let r=Ft.enc(t),n=r.hi>>31,o=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return lc(o,i,this.buf),this}uint64(t){let r=Ft.uEnc(t);return lc(r.lo,r.hi,this.buf),this}},oe=class{constructor(t,r=Yd().decodeUtf8){this.decodeUtf8=r,this.varint64=Dy,this.uint32=qy,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case Pr.Varint:for(;this.buf[this.pos++]&128;);break;case Pr.Bit64:this.pos+=4;case Pr.Bit32:this.pos+=4;break;case Pr.LengthDelimited:let o=this.uint32();this.pos+=o;break;case Pr.StartGroup:for(;;){let[i,a]=this.tag();if(a===Pr.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(a,i)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Ft.dec(...this.varint64())}uint64(){return Ft.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Ft.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ft.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ft.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};function Xd(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>v_||e<S_)throw new Error("invalid int32: "+e)}function Uy(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>y_||e<0)throw new Error("invalid uint32: "+e)}function b_(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>g_||e<h_))throw new Error("invalid float32: "+e)}var A_=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Jd(){return{fields:{}}}var Hi={encode(e,t=new Te){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&tp.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Jd();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:{if(i!==10)break;let a=tp.decode(r,r.uint32());a.value!==void 0&&(o.fields[a.key]=a.value);continue}}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Hi.fromPartial(e??{})},fromPartial(e){let t=Jd();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Jd();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function By(){return{key:"",value:void 0}}var tp={encode(e,t=new Te){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=By();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.key=r.string();continue;case 2:if(i!==18)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return tp.fromPartial(e??{})},fromPartial(e){let t=By();return t.key=e.key??"",t.value=e.value??void 0,t}};function Zd(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var xe={encode(e,t=new Te){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&Hi.encode(Hi.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&zi.encode(zi.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Zd();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.nullValue=r.int32();continue;case 2:if(i!==17)break;o.numberValue=r.double();continue;case 3:if(i!==26)break;o.stringValue=r.string();continue;case 4:if(i!==32)break;o.boolValue=r.bool();continue;case 5:if(i!==42)break;o.structValue=Hi.unwrap(Hi.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.listValue=zi.unwrap(zi.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=Zd();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=Zd();if(e===null)t.nullValue=A_.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(b.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new b.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function ep(){return{values:[]}}var zi={encode(e,t=new Te){for(let r of e.values)xe.encode(xe.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=ep();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.values.push(xe.unwrap(xe.decode(r,r.uint32())));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return zi.fromPartial(e??{})},fromPartial(e){let t=ep();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=ep();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&b.Array.isArray(e.values)?e.values:e}},w_=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 Gy(){return{op:0,path:"",from:void 0,value:void 0}}var dc={encode(e,t=new Te){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Gy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.op=r.int32();continue;case 2:if(i!==18)break;o.path=r.string();continue;case 3:if(i!==26)break;o.from=r.string();continue;case 4:if(i!==34)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=Gy();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function $y(){return{id:"",type:"",function:void 0}}var pc={encode(e,t=new Te){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&fc.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=$y();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.type=r.string();continue;case 3:if(i!==26)break;o.function=fc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=$y();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}};function Qy(){return{name:"",arguments:""}}var fc={encode(e,t=new Te){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Qy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.name=r.string();continue;case 2:if(i!==18)break;o.arguments=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=Qy();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function Hy(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0}}var mc={encode(e,t=new Te){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)pc.encode(r,t.uint32(42).fork()).join();return e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Hy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.id=r.string();continue;case 2:if(i!==18)break;o.role=r.string();continue;case 3:if(i!==26)break;o.content=r.string();continue;case 4:if(i!==34)break;o.name=r.string();continue;case 5:if(i!==42)break;o.toolCalls.push(pc.decode(r,r.uint32()));continue;case 6:if(i!==50)break;o.toolCallId=r.string();continue;case 7:if(i!==58)break;o.error=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=Hy();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>pc.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??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.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function zy(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ae={encode(e,t=new Te){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&xe.encode(xe.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=zy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==8)break;o.type=r.int32();continue;case 2:if(i!==16)break;o.timestamp=C_(r.int64());continue;case 3:if(i!==26)break;o.rawEvent=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=zy();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function Wy(){return{baseEvent:void 0,messageId:"",role:void 0}}var gc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Wy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=Wy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t}};function Ky(){return{baseEvent:void 0,messageId:"",delta:""}}var hc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Ky();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=Ky();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function Yy(){return{baseEvent:void 0,messageId:""}}var yc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Yy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return yc.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function Xy(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var vc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Xy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return vc.fromPartial(e??{})},fromPartial(e){let t=Xy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function Jy(){return{baseEvent:void 0,toolCallId:"",delta:""}}var Sc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Jy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Sc.fromPartial(e??{})},fromPartial(e){let t=Jy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function Zy(){return{baseEvent:void 0,toolCallId:""}}var bc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Zy();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return bc.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function ev(){return{baseEvent:void 0,snapshot:void 0}}var Ac={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&xe.encode(xe.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=ev();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.snapshot=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ac.fromPartial(e??{})},fromPartial(e){let t=ev();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function tv(){return{baseEvent:void 0,delta:[]}}var wc={encode(e,t=new Te){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)dc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=tv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.delta.push(dc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return wc.fromPartial(e??{})},fromPartial(e){let t=tv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>dc.fromPartial(r))||[],t}};function rv(){return{baseEvent:void 0,messages:[]}}var xc={encode(e,t=new Te){e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)mc.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=rv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messages.push(mc.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return xc.fromPartial(e??{})},fromPartial(e){let t=rv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>mc.fromPartial(r))||[],t}};function nv(){return{baseEvent:void 0,event:void 0,source:void 0}}var Cc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&xe.encode(xe.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=nv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.event=xe.unwrap(xe.decode(r,r.uint32()));continue;case 3:if(i!==26)break;o.source=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Cc.fromPartial(e??{})},fromPartial(e){let t=nv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function ov(){return{baseEvent:void 0,name:"",value:void 0}}var Ec={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&xe.encode(xe.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=ov();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.name=r.string();continue;case 3:if(i!==26)break;o.value=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ec.fromPartial(e??{})},fromPartial(e){let t=ov();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function iv(){return{baseEvent:void 0,threadId:"",runId:""}}var Rc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=iv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Rc.fromPartial(e??{})},fromPartial(e){let t=iv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function av(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var Ic={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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&&xe.encode(xe.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=av();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.threadId=r.string();continue;case 3:if(i!==26)break;o.runId=r.string();continue;case 4:if(i!==34)break;o.result=xe.unwrap(xe.decode(r,r.uint32()));continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Ic.fromPartial(e??{})},fromPartial(e){let t=av();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function sv(){return{baseEvent:void 0,code:void 0,message:""}}var Tc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=sv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.code=r.string();continue;case 3:if(i!==26)break;o.message=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Tc.fromPartial(e??{})},fromPartial(e){let t=sv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function cv(){return{baseEvent:void 0,stepName:""}}var _c={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=cv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=cv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function uv(){return{baseEvent:void 0,stepName:""}}var kc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=uv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.stepName=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return kc.fromPartial(e??{})},fromPartial(e){let t=uv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function lv(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0}}var Oc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.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),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=lv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.messageId=r.string();continue;case 3:if(i!==26)break;o.role=r.string();continue;case 4:if(i!==34)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Oc.fromPartial(e??{})},fromPartial(e){let t=lv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t}};function dv(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Pc={encode(e,t=new Te){return e.baseEvent!==void 0&&ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=dv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.baseEvent=ae.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.toolCallId=r.string();continue;case 3:if(i!==26)break;o.toolCallName=r.string();continue;case 4:if(i!==34)break;o.parentMessageId=r.string();continue;case 5:if(i!==42)break;o.delta=r.string();continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return Pc.fromPartial(e??{})},fromPartial(e){let t=dv();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function pv(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var fv={encode(e,t=new Te){return e.textMessageStart!==void 0&&gc.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&hc.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&yc.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&vc.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Sc.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&bc.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Ac.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&wc.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&xc.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Cc.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Ec.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Rc.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ic.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Tc.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&_c.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&kc.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Oc.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Pc.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=pv();for(;r.pos<n;){let i=r.uint32();switch(i>>>3){case 1:if(i!==10)break;o.textMessageStart=gc.decode(r,r.uint32());continue;case 2:if(i!==18)break;o.textMessageContent=hc.decode(r,r.uint32());continue;case 3:if(i!==26)break;o.textMessageEnd=yc.decode(r,r.uint32());continue;case 4:if(i!==34)break;o.toolCallStart=vc.decode(r,r.uint32());continue;case 5:if(i!==42)break;o.toolCallArgs=Sc.decode(r,r.uint32());continue;case 6:if(i!==50)break;o.toolCallEnd=bc.decode(r,r.uint32());continue;case 7:if(i!==58)break;o.stateSnapshot=Ac.decode(r,r.uint32());continue;case 8:if(i!==66)break;o.stateDelta=wc.decode(r,r.uint32());continue;case 9:if(i!==74)break;o.messagesSnapshot=xc.decode(r,r.uint32());continue;case 10:if(i!==82)break;o.raw=Cc.decode(r,r.uint32());continue;case 11:if(i!==90)break;o.custom=Ec.decode(r,r.uint32());continue;case 12:if(i!==98)break;o.runStarted=Rc.decode(r,r.uint32());continue;case 13:if(i!==106)break;o.runFinished=Ic.decode(r,r.uint32());continue;case 14:if(i!==114)break;o.runError=Tc.decode(r,r.uint32());continue;case 15:if(i!==122)break;o.stepStarted=_c.decode(r,r.uint32());continue;case 16:if(i!==130)break;o.stepFinished=kc.decode(r,r.uint32());continue;case 17:if(i!==138)break;o.textMessageChunk=Oc.decode(r,r.uint32());continue;case 18:if(i!==146)break;o.toolCallChunk=Pc.decode(r,r.uint32());continue}if((i&7)===4||i===0)break;r.skip(i&7)}return o},create(e){return fv.fromPartial(e??{})},fromPartial(e){let t=pv();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?gc.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?hc.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?yc.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?vc.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Sc.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?bc.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Ac.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?wc.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?xc.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Cc.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Ec.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Rc.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ic.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Tc.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?_c.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?kc.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Oc.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Pc.fromPartial(e.toolCallChunk):void 0,t}};function C_(e){let t=b.Number(e.toString());if(t>b.Number.MAX_SAFE_INTEGER)throw new b.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<b.Number.MIN_SAFE_INTEGER)throw new b.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}function mv(e){let t=fv.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=x_[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===F.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===F.STATE_DELTA)for(let n of r.delta)n.op=w_[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),Os.parse(r)}var gv="application/vnd.ag-ui.event+proto";m();d();f();p();m();d();f();p();m();d();f();p();var R_=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,rp=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(R_);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},hv=e=>e==="*"||e==="x"||e==="X",yv=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},I_=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],T_=(e,t)=>{if(hv(e)||hv(t))return 0;let[r,n]=I_(yv(e),yv(t));return r>n?1:r<n?-1:0},np=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=T_(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Nc=(e,t)=>{let r=rp(e),n=rp(t),o=r.pop(),i=n.pop(),a=np(r,n);return a!==0?a:o&&i?np(o.split("."),i.split(".")):o||i?o?-1:1:0};var ke=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}};function Wi(){return Rr()}function _e(_x84,_x85,_x86,_x87){return _e2.apply(this,arguments)}function _e2(){_e2=_asyncToGenerator(function*(e,t,r,n){let o=t,i=r,a;for(let s of e)try{let c=yield n(s,ke(o),ke(i));if(c===void 0)continue;if(c.messages!==void 0&&(o=c.messages),c.state!==void 0&&(i=c.state),a=c.stopPropagation,a===!0)break}catch(c){process.env.VITEST_WORKER_ID!==void 0||console.error("Subscriber error:",c);continue}return{...(JSON.stringify(o)===JSON.stringify(t)?{}:{messages:o}),...(JSON.stringify(i)===JSON.stringify(r)?{}:{state:i}),...(a===void 0?{}:{stopPropagation:a})}});return _e2.apply(this,arguments)}var xv=(e,t,r,n)=>{let o=ke(r.messages),i=ke(e.state),a={},s=u=>{u.messages!==void 0&&(o=u.messages,a.messages=u.messages),u.state!==void 0&&(i=u.state,a.state=u.state)},c=()=>{let u=ke(a);return a={},u.messages!==void 0||u.state!==void 0?qe(u):Hs};return t.pipe(ac(/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(u){let h=yield _e(n,o,i,(v,S,g)=>v.onEvent?.({event:u,agent:r,input:e,messages:S,state:g}));if(s(h),h.stopPropagation===!0)return c();switch(u.type){case F.TEXT_MESSAGE_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onTextMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S,role:g="assistant"}=u;if(!o.find(y=>y.id===S)){let y={id:S,role:g,content:""};o.push(y),s({messages:o})}}return c()}case F.TEXT_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=o.find(x=>x.id===v);if(!g)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield _e(n,o,i,(x,E,C)=>x.onTextMessageContentEvent?.({event:u,messages:E,state:C,agent:r,input:e,textMessageBuffer:typeof g.content=="string"?g.content:""}));return s(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,s({messages:o})),c()}case F.TEXT_MESSAGE_END:{let{messageId:v}=u,S=o.find(g=>g.id===v);return S?(s(yield _e(n,o,i,(g,y,x)=>g.onTextMessageEndEvent?.({event:u,messages:y,state:x,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${v}'`),c())}case F.TOOL_CALL_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onToolCallStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{toolCallId:S,toolCallName:g,parentMessageId:y}=u,x;y&&o.length>0&&o[o.length-1].id===y?x=o[o.length-1]:(x={id:y||S,role:"assistant",toolCalls:[]},o.push(x)),x.toolCalls??(x.toolCalls=[]),x.toolCalls.push({id:S,type:"function",function:{name:g,arguments:""}}),s({messages:o})}return c()}case F.TOOL_CALL_ARGS:{let{toolCallId:v,delta:S}=u,g=o.find(E=>E.toolCalls?.some(C=>C.id===v));if(!g)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${v}'`),c();let y=g.toolCalls?.find(E=>E.id===v);if(!y)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${v}'`),c();let x=yield _e(n,o,i,(E,C,I)=>{let T=y.function.arguments,_=y.function.name,q={};try{q=cc(T)}catch{}return E.onToolCallArgsEvent?.({event:u,messages:C,state:I,agent:r,input:e,toolCallBuffer:T,toolCallName:_,partialToolCallArgs:q})});return s(x),x.stopPropagation!==!0&&(y.function.arguments+=S,s({messages:o})),c()}case F.TOOL_CALL_END:{let{toolCallId:v}=u,S=o.find(y=>y.toolCalls?.some(x=>x.id===v));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${v}'`),c();let g=S.toolCalls?.find(y=>y.id===v);return g?(s(yield _e(n,o,i,(y,x,E)=>{let C=g.function.arguments,I=g.function.name,T={};try{T=JSON.parse(C)}catch{}return y.onToolCallEndEvent?.({event:u,messages:x,state:E,agent:r,input:e,toolCallName:I,toolCallArgs:T})})),yield Promise.all(n.map(y=>{y.onNewToolCall?.({toolCall:g,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${v}'`),c())}case F.TOOL_CALL_RESULT:{let v=yield _e(n,o,i,(S,g,y)=>S.onToolCallResultEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S,toolCallId:g,content:y,role:x}=u,E={id:S,toolCallId:g,role:x||"tool",content:y};o.push(E),yield Promise.all(n.map(C=>{C.onNewMessage?.({message:E,messages:o,state:i,agent:r,input:e})})),s({messages:o})}return c()}case F.STATE_SNAPSHOT:{let v=yield _e(n,o,i,(S,g,y)=>S.onStateSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{snapshot:S}=u;i=S,s({state:i})}return c()}case F.STATE_DELTA:{let v=yield _e(n,o,i,(S,g,y)=>S.onStateDeltaEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{delta:S}=u;try{i=Or(i,S,!0,!1).newDocument,s({state:i})}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`Failed to apply state patch:
36
36
  Current state: ${JSON.stringify(i,null,2)}
37
37
  Patch operations: ${JSON.stringify(S,null,2)}
38
- Error: ${y}`)}}return c()}case F.MESSAGES_SNAPSHOT:{let v=yield _e(n,o,i,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messages:S}=u;o=S,s({messages:o})}return c()}case F.ACTIVITY_SNAPSHOT:{let v=u,S=o.findIndex(C=>C.id===v.messageId),g=S>=0?o[S]:void 0,y=g?.role==="activity"?g:void 0,x=v.replace??!0,E=yield _e(n,o,i,(C,I,T)=>C.onActivitySnapshotEvent?.({event:v,messages:I,state:T,agent:r,input:e,activityMessage:y,existingMessage:g}));if(s(E),E.stopPropagation!==!0){let C={id:v.messageId,role:"activity",activityType:v.activityType,content:ke(v.content)},I;S===-1?(o.push(C),I=C):y?x&&(o[S]={...y,activityType:v.activityType,content:ke(v.content)}):x&&(o[S]=C,I=C),s({messages:o}),I&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:I,messages:o,state:i,agent:r,input:e}))))}return c()}case F.ACTIVITY_DELTA:{let v=u,S=o.findIndex(E=>E.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=o[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,x=yield _e(n,o,i,(E,C,I)=>E.onActivityDeltaEvent?.({event:v,messages:C,state:I,agent:r,input:e,activityMessage:y}));if(s(x),x.stopPropagation!==!0)try{let E=ke(y.content??{}),C=Or(E,v.patch??[],!0,!1).newDocument;o[S]={...y,content:ke(C),activityType:v.activityType},s({messages:o})}catch(E){let C=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${v.messageId}': ${C}`)}return c()}case F.RAW:return s(yield _e(n,o,i,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.CUSTOM:return s(yield _e(n,o,i,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.RUN_STARTED:{let v=yield _e(n,o,i,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)o.find(y=>y.id===g.id)||o.push(g);s({messages:o})}}return c()}case F.RUN_FINISHED:return s(yield _e(n,o,i,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case F.RUN_ERROR:return s(yield _e(n,o,i,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.STEP_STARTED:return s(yield _e(n,o,i,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.STEP_FINISHED:return s(yield _e(n,o,i,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case F.THINKING_START:return c();case F.THINKING_END:return c();case F.THINKING_TEXT_MESSAGE_START:return c();case F.THINKING_TEXT_MESSAGE_CONTENT:return c();case F.THINKING_TEXT_MESSAGE_END:return c();case F.REASONING_START:return s(yield _e(n,o,i,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.REASONING_MESSAGE_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!o.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};o.push(g),s({messages:o})}}return c()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=o.find(x=>x.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield _e(n,o,i,(x,E,C)=>x.onReasoningMessageContentEvent?.({event:u,messages:E,state:C,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return s(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,s({messages:o})),c()}case F.REASONING_MESSAGE_END:{let{messageId:v}=u,S=o.find(g=>g.id===v);return S?(s(yield _e(n,o,i,(g,y,x)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:x,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return s(yield _e(n,o,i,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield _e(n,o,i,(x,E,C)=>x.onReasoningEncryptedValueEvent?.({event:u,messages:E,state:C,agent:r,input:e}));if(s(y),y.stopPropagation!==!0){let x=!1;if(v==="tool-call"){for(let E of o)if(E.role==="assistant"&&E.toolCalls){let C=E.toolCalls.find(I=>I.id===S);if(C){C.encryptedValue=g,x=!0;break}}}else{let E=o.find(C=>C.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=g,x=!0)}x&&(a.messages=o)}return c()}}return u.type,c()});return function(_x82){return _ref40.apply(this,arguments)}}()),Ld(),n.length>0?Ud({}):u=>u)},nf=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,s=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),s.clear(),c=!1,u=!1,o=!1,i=!1,h=!0};return t.pipe(yt(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),i)return Fe(()=>new qe(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==F.RUN_ERROR&&g!==F.RUN_STARTED)return Fe(()=>new qe(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===F.RUN_STARTED){if(h&&!o)return Fe(()=>new qe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));o&&v()}}else if(a=!0,g!==F.RUN_STARTED&&g!==F.RUN_ERROR)return Fe(()=>new qe("First event must be 'RUN_STARTED'"));switch(g){case F.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?Fe(()=>new qe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),je(S))}case F.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?je(S):Fe(()=>new qe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case F.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),je(S)):Fe(()=>new qe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case F.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?Fe(()=>new qe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),je(S))}case F.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?je(S):Fe(()=>new qe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case F.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),je(S)):Fe(()=>new qe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case F.STEP_STARTED:{let y=S.stepName;return s.has(y)?Fe(()=>new qe(`Step "${y}" is already active for 'STEP_STARTED'`)):(s.set(y,!0),je(S))}case F.STEP_FINISHED:{let y=S.stepName;return s.has(y)?(s.delete(y),je(S)):Fe(()=>new qe(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case F.RUN_STARTED:return h=!0,je(S);case F.RUN_FINISHED:if(s.size>0){let y=Array.from(s.keys()).join(", ");return Fe(()=>new qe(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return Fe(()=>new qe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return Fe(()=>new qe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return o=!0,je(S);case F.RUN_ERROR:return i=!0,je(S);case F.CUSTOM:return je(S);case F.THINKING_TEXT_MESSAGE_START:return c?u?Fe(()=>new qe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,je(S)):Fe(()=>new qe("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 u?je(S):Fe(()=>new qe("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 u?(u=!1,je(S)):Fe(()=>new qe("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 c?Fe(()=>new qe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,je(S));case F.THINKING_END:return c?(c=!1,je(S)):Fe(()=>new qe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return je(S)}}))},Cn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),R_=(e,t)=>Vd(()=>An(A(e,t))).pipe(Bd(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return An(r.text()).pipe(yt(a=>{let s=a;if(i.includes("application/json"))try{s=JSON.parse(a)}catch{}let c=Error(`HTTP ${r.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return c.status=r.status,c.payload=s,Fe(()=>c)}))}let n={type:Cn.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new Ne(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:s}=yield o.read();if(a)break;let c={type:Cn.DATA,data:s};i.next(c)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Fe(()=>Error("Failed to getReader() from response"))})),I_=e=>{let t=new zt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==Cn.HEADERS&&i.type===Cn.DATA&&i.data){let a=r.decode(i.data,{stream:!0});n+=a;let s=n.split(/\n\n/);n=s.pop()||"";for(let c of s)o(c)}},error:i=>t.error(i),complete:()=>{n&&(n+=r.decode(),o(n)),t.complete()}});function o(i){let a=i.split(`
38
+ Error: ${y}`)}}return c()}case F.MESSAGES_SNAPSHOT:{let v=yield _e(n,o,i,(S,g,y)=>S.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messages:S}=u;o=S,s({messages:o})}return c()}case F.ACTIVITY_SNAPSHOT:{let v=u,S=o.findIndex(C=>C.id===v.messageId),g=S>=0?o[S]:void 0,y=g?.role==="activity"?g:void 0,x=v.replace??!0,E=yield _e(n,o,i,(C,I,T)=>C.onActivitySnapshotEvent?.({event:v,messages:I,state:T,agent:r,input:e,activityMessage:y,existingMessage:g}));if(s(E),E.stopPropagation!==!0){let C={id:v.messageId,role:"activity",activityType:v.activityType,content:ke(v.content)},I;S===-1?(o.push(C),I=C):y?x&&(o[S]={...y,activityType:v.activityType,content:ke(v.content)}):x&&(o[S]=C,I=C),s({messages:o}),I&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:I,messages:o,state:i,agent:r,input:e}))))}return c()}case F.ACTIVITY_DELTA:{let v=u,S=o.findIndex(E=>E.id===v.messageId);if(S===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${v.messageId}' to apply patch`),c();let g=o[S];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${v.messageId}' is not an activity message`),c();let y=g,x=yield _e(n,o,i,(E,C,I)=>E.onActivityDeltaEvent?.({event:v,messages:C,state:I,agent:r,input:e,activityMessage:y}));if(s(x),x.stopPropagation!==!0)try{let E=ke(y.content??{}),C=Or(E,v.patch??[],!0,!1).newDocument;o[S]={...y,content:ke(C),activityType:v.activityType},s({messages:o})}catch(E){let C=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${v.messageId}': ${C}`)}return c()}case F.RAW:return s(yield _e(n,o,i,(v,S,g)=>v.onRawEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.CUSTOM:return s(yield _e(n,o,i,(v,S,g)=>v.onCustomEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.RUN_STARTED:{let v=yield _e(n,o,i,(S,g,y)=>S.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let S=u;if(S.input?.messages){for(let g of S.input.messages)o.find(y=>y.id===g.id)||o.push(g);s({messages:o})}}return c()}case F.RUN_FINISHED:return s(yield _e(n,o,i,(v,S,g)=>v.onRunFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e,result:u.result}))),c();case F.RUN_ERROR:return s(yield _e(n,o,i,(v,S,g)=>v.onRunErrorEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.STEP_STARTED:return s(yield _e(n,o,i,(v,S,g)=>v.onStepStartedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.STEP_FINISHED:return s(yield _e(n,o,i,(v,S,g)=>v.onStepFinishedEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case F.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case F.THINKING_START:return c();case F.THINKING_END:return c();case F.THINKING_TEXT_MESSAGE_START:return c();case F.THINKING_TEXT_MESSAGE_CONTENT:return c();case F.THINKING_TEXT_MESSAGE_END:return c();case F.REASONING_START:return s(yield _e(n,o,i,(v,S,g)=>v.onReasoningStartEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.REASONING_MESSAGE_START:{let v=yield _e(n,o,i,(S,g,y)=>S.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(v),v.stopPropagation!==!0){let{messageId:S}=u;if(!o.find(g=>g.id===S)){let g={id:S,role:"reasoning",content:""};o.push(g),s({messages:o})}}return c()}case F.REASONING_MESSAGE_CONTENT:{let{messageId:v,delta:S}=u,g=o.find(x=>x.id===v);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${v}'`),c();let y=yield _e(n,o,i,(x,E,C)=>x.onReasoningMessageContentEvent?.({event:u,messages:E,state:C,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return s(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${S}`,s({messages:o})),c()}case F.REASONING_MESSAGE_END:{let{messageId:v}=u,S=o.find(g=>g.id===v);return S?(s(yield _e(n,o,i,(g,y,x)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:x,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:S,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${v}'`),c())}case F.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case F.REASONING_END:return s(yield _e(n,o,i,(v,S,g)=>v.onReasoningEndEvent?.({event:u,messages:S,state:g,agent:r,input:e}))),c();case F.REASONING_ENCRYPTED_VALUE:{let{subtype:v,entityId:S,encryptedValue:g}=u,y=yield _e(n,o,i,(x,E,C)=>x.onReasoningEncryptedValueEvent?.({event:u,messages:E,state:C,agent:r,input:e}));if(s(y),y.stopPropagation!==!0){let x=!1;if(v==="tool-call"){for(let E of o)if(E.role==="assistant"&&E.toolCalls){let C=E.toolCalls.find(I=>I.id===S);if(C){C.encryptedValue=g,x=!0;break}}}else{let E=o.find(C=>C.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=g,x=!0)}x&&(a.messages=o)}return c()}}return u.type,c()});return function(_x88){return _ref43.apply(this,arguments)}}()),Vd(),n.length>0?Bd({}):u=>u)},op=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,s=new Map,c=!1,u=!1,h=!1,v=()=>{r.clear(),n.clear(),s.clear(),c=!1,u=!1,o=!1,i=!1,h=!0};return t.pipe(yt(S=>{let g=S.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(S)),i)return Fe(()=>new je(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==F.RUN_ERROR&&g!==F.RUN_STARTED)return Fe(()=>new je(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===F.RUN_STARTED){if(h&&!o)return Fe(()=>new je("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));o&&v()}}else if(a=!0,g!==F.RUN_STARTED&&g!==F.RUN_ERROR)return Fe(()=>new je("First event must be 'RUN_STARTED'"));switch(g){case F.TEXT_MESSAGE_START:{let y=S.messageId;return r.has(y)?Fe(()=>new je(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),qe(S))}case F.TEXT_MESSAGE_CONTENT:{let y=S.messageId;return r.has(y)?qe(S):Fe(()=>new je(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case F.TEXT_MESSAGE_END:{let y=S.messageId;return r.has(y)?(r.delete(y),qe(S)):Fe(()=>new je(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case F.TOOL_CALL_START:{let y=S.toolCallId;return n.has(y)?Fe(()=>new je(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),qe(S))}case F.TOOL_CALL_ARGS:{let y=S.toolCallId;return n.has(y)?qe(S):Fe(()=>new je(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case F.TOOL_CALL_END:{let y=S.toolCallId;return n.has(y)?(n.delete(y),qe(S)):Fe(()=>new je(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case F.STEP_STARTED:{let y=S.stepName;return s.has(y)?Fe(()=>new je(`Step "${y}" is already active for 'STEP_STARTED'`)):(s.set(y,!0),qe(S))}case F.STEP_FINISHED:{let y=S.stepName;return s.has(y)?(s.delete(y),qe(S)):Fe(()=>new je(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case F.RUN_STARTED:return h=!0,qe(S);case F.RUN_FINISHED:if(s.size>0){let y=Array.from(s.keys()).join(", ");return Fe(()=>new je(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return Fe(()=>new je(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return Fe(()=>new je(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return o=!0,qe(S);case F.RUN_ERROR:return i=!0,qe(S);case F.CUSTOM:return qe(S);case F.THINKING_TEXT_MESSAGE_START:return c?u?Fe(()=>new je("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,qe(S)):Fe(()=>new je("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 u?qe(S):Fe(()=>new je("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 u?(u=!1,qe(S)):Fe(()=>new je("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 c?Fe(()=>new je("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,qe(S));case F.THINKING_END:return c?(c=!1,qe(S)):Fe(()=>new je("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return qe(S)}}))},Cn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),__=(e,t)=>Ud(()=>An(A(e,t))).pipe(Gd(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return An(r.text()).pipe(yt(a=>{let s=a;if(i.includes("application/json"))try{s=JSON.parse(a)}catch{}let c=Error(`HTTP ${r.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return c.status=r.status,c.payload=s,Fe(()=>c)}))}let n={type:Cn.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new Ne(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:s}=yield o.read();if(a)break;let c={type:Cn.DATA,data:s};i.next(c)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Fe(()=>Error("Failed to getReader() from response"))})),k_=e=>{let t=new zt,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==Cn.HEADERS&&i.type===Cn.DATA&&i.data){let a=r.decode(i.data,{stream:!0});n+=a;let s=n.split(/\n\n/);n=s.pop()||"";for(let c of s)o(c)}},error:i=>t.error(i),complete:()=>{n&&(n+=r.decode(),o(n)),t.complete()}});function o(i){let a=i.split(`
39
39
  `),s=[];for(let c of a)c.startsWith("data:")&&s.push(c.slice(5).replace(/^ /,""));if(s.length>0)try{let c=s.join(`
40
- `),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},T_=e=>{let t=new zt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Cn.HEADERS&&o.type===Cn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=dv(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},__=e=>{let t=new zt,r=new Gs,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===Cn.HEADERS&&!n?(n=!0,o.headers.get("content-type")===fv?T_(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):I_(r).subscribe({next:i=>{try{let a=ks.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:F.RUN_ERROR,message:i.message||"Request aborted",code:"abort",rawEvent:i}),t.complete();return}return t.error(i)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:o=>{r.error(o),t.error(o)},complete:()=>{r.complete()}}),t.asObservable()},Pe=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),k_=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),O_=R.object({type:R.literal(Pe.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),P_=R.object({type:R.literal(Pe.enum.TextMessageContent),messageId:R.string(),content:R.string()}),N_=R.object({type:R.literal(Pe.enum.TextMessageEnd),messageId:R.string()}),F_=R.object({type:R.literal(Pe.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),D_=R.object({type:R.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),M_=R.object({type:R.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:R.string()}),q_=R.object({type:R.literal(Pe.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),j_=R.object({type:R.literal(Pe.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),L_=R.object({type:R.literal(Pe.enum.MetaEvent),name:k_,value:R.any()}),V_=R.object({type:R.literal(Pe.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[O_,P_,N_,F_,D_,M_,q_,j_,L_,V_]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var U_=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
- `)},B_=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(yt(g=>{switch(g.type){case F.TEXT_MESSAGE_START:{let y=g;return[{type:Pe.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:Pe.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=g;return[{type:Pe.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=g,x=h.find(C=>C.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let E=!1;if(u){let C=u.find(I=>I.tool==x.function.name);if(C)try{let I=JSON.parse(sc(x.function.arguments));C.tool_argument&&C.tool_argument in I?(S({...o,[C.state_key]:I[C.tool_argument]}),E=!0):C.tool_argument||(S({...o,[C.state_key]:I}),E=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(E?[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=g;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=g;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=g;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:Pe.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return S(g.snapshot),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=g,x=Or(o,y.delta,!0,!1);return x?(S(x.newDocument),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return c=g.messages,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:$_(c)}:{})}),active:!1}];case F.RUN_ERROR:{let y=g;return[{type:Pe.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=g.stepName,h=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return h=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function $_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=U_(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var Nc=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:F.TEXT_MESSAGE_END,messageId:r.messageId};return i=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},s=()=>{if(!n||i!=="tool")throw Error("No tool call to close");let h={type:F.TOOL_CALL_END,toolCallId:n.toolCallId};return i=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!o||i!=="reasoning")throw Error("No reasoning message to close");let h={type:F.REASONING_MESSAGE_END,messageId:o.messageId};return i=void 0,o=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>i==="text"?[a()]:i==="tool"?[s()]:i==="reasoning"?[c()]:[];return t.pipe(yt(h=>{switch(h.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.MESSAGES_SNAPSHOT:case F.CUSTOM:case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR: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[...u(),h];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:return[h];case F.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((i!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),i!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},i="text";let C={type:F.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(C),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(C))}if(v.delta!==void 0){let C={type:F.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(C),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(C))}return S;case F.TOOL_CALL_CHUNK:let g=h,y=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),i!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},i="tool";let C={type:F.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(C),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(C))}if(g.delta!==void 0){let C={type:F.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(C),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(C))}return y;case F.REASONING_MESSAGE_CHUNK:let x=h,E=[];if((i!=="reasoning"||x.messageId&&x.messageId!==o?.messageId)&&E.push(...u()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");o={messageId:x.messageId},i="reasoning";let C={type:F.REASONING_MESSAGE_START,messageId:x.messageId};E.push(C),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(C))}if(x.delta!==void 0){let C={type:F.REASONING_MESSAGE_CONTENT,messageId:o.messageId,delta:x.delta};E.push(C),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(C))}return E}return h.type,[]}),xn(()=>{u()}))},of=class{runNext(e,t){return t.run(e).pipe(Nc(!1))}runNextWithState(e,t){let r=ke(e.messages||[]),n=ke(e.state||{}),o=new Gs;return bv(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ic(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:ke(r),state:ke(n)}});return function(_x83){return _ref42.apply(this,arguments)}}()))}},G_=class extends of{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Q_(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var H_=class extends of{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(Q_)};return this.runNext(o,t)}},gv="THINKING_START",hv="THINKING_END",yv="THINKING_TEXT_MESSAGE_START",vv="THINKING_TEXT_MESSAGE_CONTENT",Sv="THINKING_TEXT_MESSAGE_END",z_=class extends of{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){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(wn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case gv:{this.currentReasoningId=Ki();let{title:t,...r}=e;return this.warnAboutTransformation(gv,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case yv:return this.currentMessageId=Ki(),this.warnAboutTransformation(yv,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case vv:{let{delta:t,...r}=e;return this.warnAboutTransformation(vv,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ki(),delta:t}}case Sv:{let t=this.currentMessageId??Ki();return this.warnAboutTransformation(Sv,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case hv:{let t=this.currentReasoningId??Ki();return this.warnAboutTransformation(hv,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}},W_="0.0.45",K_=class{get maxVersion(){return W_}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Rr(),this.messages=ke(n??[]),this.state=ke(o??{}),this.debug=i??!1,Pc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new H_),Pc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new z_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new G_(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Rr();let r=_this14.prepareRunAgentInput(e),n,o=new Set(_this14.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new zt;let a;_this14.activeRunCompletionPromise=new Promise(c=>{a=c}),yield oc($s(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this14).run(r),Nc(_this14.debug),nf(_this14.debug),c=>c.pipe(ac(_this14.activeRunDetach$)),c=>_this14.apply(r,c,i),c=>_this14.processApplyEvents(r,c,i),Hi(c=>(_this14.isRunning=!1,_this14.onError(r,c,i))),xn(()=>{_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(je(null)));let s=ke(_this14.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Rd}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Rr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new zt;let a;_this15.activeRunCompletionPromise=new Promise(c=>{a=c}),yield oc($s(()=>_this15.connect(r),Nc(_this15.debug),nf(_this15.debug),c=>c.pipe(ac(_this15.activeRunDetach$)),c=>_this15.apply(r,c,i),c=>_this15.processApplyEvents(r,c,i),Hi(c=>(_this15.isRunning=!1,c instanceof Rd?Qs:_this15.onError(r,c,i))),xn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(je(null)));let s=ke(_this15.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return bv(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe($d(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=ke(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Rr(),tools:ke(e?.tools??[]),context:ke(e?.context??[]),forwardedProps:ke(e?.forwardedProps??{}),state:ke(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){let r=yield _e(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this17.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})),r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})})))})()}onError(e,t,r){return An(_e(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(wn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield _e(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=ke(this.messages),e.state=ke(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=ke(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=ke(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Rr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r)}),this).run(t)).pipe(Nc(this.debug),nf(this.debug),B_(this.threadId,t.runId,this.agentId),r=>r.pipe(wn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Av=class extends K_{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=ke(e.headers??{})}run(e){return __(R_(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=ke(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();p();f();var wv=(e,t,r)=>{let n=We(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var af=class extends Av{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},xv=(e,t,r)=>new af({url:`${wv(e,t,r)}/answer`});m();d();p();f();m();d();p();f();var Y_=new H({required:!0}),Cv=P("followUpAnswers/setIsEnabled",e=>q(e,new ue({required:!0}))),Ev=P("followUpAnswers/setFollowUpAnswersConversationId",e=>q(e,X)),_Z=P("followUpAnswers/createFollowUpAnswer",e=>q(e,{question:X})),kZ=P("followUpAnswers/setActiveFollowUpAnswerId",e=>q(e,X)),OZ=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>q(e,{contentFormat:Ss,answerId:X})),PZ=P("followUpAnswers/setFollowUpIsLoading",e=>q(e,{isLoading:new ue({required:!0}),answerId:X})),NZ=P("followUpAnswers/setFollowUpIsStreaming",e=>q(e,{isStreaming:new ue({required:!0}),answerId:X})),FZ=P("followUpAnswers/followUpMessageChunkReceived",e=>q(e,{textDelta:Y_,answerId:X})),DZ=P("followUpAnswers/followUpCitationsReceived",e=>q(e,{citations:new ge({required:!0,each:new ee({values:dd})}),answerId:X})),MZ=P("followUpAnswers/followUpCompleted",e=>q(e,{answerId:X,cannotAnswer:new ue({required:!1})})),qZ=P("followUpAnswers/followUpFailed",e=>q(e,{message:new H,code:new te({min:0}),answerId:X})),jZ=P("followUpAnswers/activeFollowUpStartFailed",e=>q(e,{message:new H})),LZ=P("followUpAnswers/likeFollowUp",e=>q(e,{answerId:X})),VZ=P("followUpAnswers/dislikeFollowUp",e=>q(e,{answerId:X})),UZ=P("followUpAnswers/submitFollowUpFeedback",e=>q(e,{answerId:X})),Rv=P("followUpAnswers/resetFollowUpAnswers"),BZ=P("followUpAnswers/stepStarted",e=>q(e,{answerId:X,name:new H({required:!0,constrainTo:yo}),startedAt:new te({min:0,required:!0})})),$Z=P("followUpAnswers/stepFinished",e=>q(e,{answerId:X,name:new H({required:!0,constrainTo:yo}),finishedAt:new te({min:0,required:!0})}));m();d();p();f();var X_={"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};function Iv(e){return e?X_[e]??1004:1004}var Tv=e=>({onRunStartedEvent:({event:t})=>{e(bs(t.runId)),e(Er(!1)),e(Oi(!0)),e(Ev(t.threadId))},onStepStartedEvent:({event:t})=>{e(wh({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(xh({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(Pi({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e(Di(n.contentFormat)),n?.followUpEnabled&&e(Cv(n.followUpEnabled));return}case"citations":{e(Ni({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=Iv(t.code);e(Fi({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.answerGenerated??!1;e(fd(r)),e(Mi(!r)),e(Oi(!1)),e(po(r)),e(mo())}});var _v=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref47=_asyncToGenerator(function*(n,o,i){t();let a=is(n),s=zm(n),c=Wm(n),u=Hm(n),h=xv(a,s,c);e=h;let v=Tv(o),S=vh(n,i());try{o(Er(!0)),yield h.runAgent({forwardedProps:{params:S,accessToken:u}},v)}catch(g){o(Er(!1)),o(Fi({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x84,_x85,_x86){return _ref47.apply(this,arguments)}}(),abortRun:t}};m();d();p();f();m();d();p();f();var Fc=P("breadcrumb/deselectAll"),kv=P("breadcrumb/deselectAllNonBreadcrumbs");m();d();p();f();var Ov=P("facet/updateFacetAutoSelection",e=>q(e,{allow:new ue({required:!0})}));m();d();p();f();m();d();p();f();var Dc=class extends vr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??St().q}get responseTime(){return this.activeInstantResultCache?.duration??Mt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Mt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Pv=()=>ct("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Dc(e)),Nv=()=>({actionCause:"searchboxAsYouType"});m();d();p();f();var sf={id:X},J_={...sf,q:Je},Jee=P("instantResults/register",e=>q(e,sf)),Mc=P("instantResults/updateQuery",e=>q(e,J_)),Zee=P("instantResults/clearExpired",e=>q(e,sf));m();d();p();f();var qc=new te({required:!0,min:0}),jc=P("pagination/registerNumberOfResults",e=>q(e,qc)),Lc=P("pagination/updateNumberOfResults",e=>q(e,qc)),Vc=P("pagination/registerPage",e=>q(e,qc)),qo=P("pagination/updatePage",e=>q(e,qc)),Uc=P("pagination/nextPage"),Bc=P("pagination/previousPage");m();d();p();f();var jo=P("query/updateQuery",e=>q(e,{q:new H,enableQuerySyntax:new ue}));m();d();p();f();m();d();p();f();m();d();p();f();var Nr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var cf=()=>ct("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Fr=e=>ct("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||St().q,aq:r.advancedSearchQueries?.aq||Nr().aq,cq:r.advancedSearchQueries?.cq||Nr().cq,dq:r.advancedSearchQueries?.dq||Nr().dq,errorType:e.type,errorMessage:e.message}));m();d();p();f();m();d();p();f();var qte=P("didYouMean/enable"),jte=P("didYouMean/disable"),Lte=P("didYouMean/automaticCorrections/disable"),Vte=P("didYouMean/automaticCorrections/enable"),$c=P("didYouMean/correction",e=>q(e,X)),Ute=P("didYouMean/automaticCorrections/mode",e=>q(e,new H({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();p();f();var uf=()=>ct("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Fv=()=>({actionCause:"didYouMeanAutomatic"});m();d();p();f();m();d();p();f();function Gc(){return{contextValues:{}}}m();d();p();f();function Qc(){return{contextValues:{}}}m();d();p();f();function Dv(){return{freezeFacetOrder:!1,facets:{}}}m();d();p();f();function Mv(){return[]}m();d();p();f();function Yi(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();p();f();function qv(){return{}}m();d();p();f();function jv(){return{}}m();d();p();f();function Lv(){return{}}function Wt(e){return{context:e.context||Gc(),dictionaryFieldContext:e.dictionaryFieldContext||Qc(),facetSet:e.facetSet||os(),numericFacetSet:e.numericFacetSet||ns(),dateFacetSet:e.dateFacetSet||rs(),categoryFacetSet:e.categoryFacetSet||ts(),automaticFacetSet:e.automaticFacetSet??es(),pagination:e.pagination||Yi(),query:e.query||St(),tabSet:e.tabSet||Lv(),advancedSearchQueries:e.advancedSearchQueries||Nr(),staticFilterSet:e.staticFilterSet||jv(),querySet:e.querySet||qv(),sortCriteria:e.sortCriteria||as(),pipeline:e.pipeline||Kn(),searchHub:e.searchHub||oo(),facetOptions:e.facetOptions||Dv(),facetOrder:e.facetOrder??Mv(),debug:e.debug??Da()}}m();d();p();f();var pne=new ee({values:{undoneQuery:Je},options:{required:!0}}),Vv=()=>ct("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();p();f();var Hc=P("trigger/query/ignore",e=>q(e,new H({emptyAllowed:!0,required:!0}))),zc=P("trigger/query/modification",e=>q(e,new ee({values:{originalQuery:Xe,modification:Xe}})));m();d();p();f();var Dr=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=t0(e),n=vs(e),o=Z_(e),i=yield xr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Ar({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Dr(_x87,_x88){return _ref48.apply(this,arguments)}}();function Z_(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(e0).filter(r=>r.currentValues.length>0):void 0}function e0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function t0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=r0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function r0(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Mr=class{constructor(t,r=n=>{this.dispatch(jo({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x89,_x90){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=ys(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return dt(t.response)?(this.dispatch(Fr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Vt(Wt(_this25.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return dt(i.response)?(_this26.dispatch(Fr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Vt(Wt(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:uf()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:uf()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(Hc("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return dt(a.response)?(_this27.dispatch(Fr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Vt(Wt(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Vv()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??St().enableQuerySyntax},search:{...Mt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Vt(Wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Dr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch($c(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(zc({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Dr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var foe=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Wc(r,t,e)});return function(_x91,_x92){return _ref49.apply(this,arguments)}}()),poe=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();return yield df(r,t,e)});return function(_x93,_x94){return _ref50.apply(this,arguments)}}()),moe=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();return yield ff(t,r)});return function(_x95,_x96){return _ref51.apply(this,arguments)}}()),goe=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield a0(t,e,r)});return function(_x97,_x98){return _ref52.apply(this,arguments)}}()),hoe=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){return lf(e,t)});return function(_x99,_x100){return _ref53.apply(this,arguments)}}()),n0=/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=yield Dr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function n0(_x101,_x102){return _ref54.apply(this,arguments)}}(),o0=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield xr(e);return Ar({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function o0(_x103,_x104,_x105){return _ref55.apply(this,arguments)}}(),i0=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){let r=yield Dr(e,t);return r.request.numberOfResults=0,r});return function i0(_x106,_x107){return _ref56.apply(this,arguments)}}(),Uv=e=>{e.configuration.analytics.enabled&&wt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function lf(_x108,_x109){return _lf.apply(this,arguments)}function _lf(){_lf=_asyncToGenerator(function*(e,t){q(e,{id:X,q:X,maxResultsPerQuery:new te({required:!0,min:1}),cacheTimeout:new te});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Mr({...t,analyticsAction:Pv()},u=>{t.dispatch(Mc({q:u,id:e.id}))}),a=yield o0(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(s);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _lf.apply(this,arguments)}function df(_x110,_x111,_x112){return _df.apply(this,arguments)}function _df(){_df=_asyncToGenerator(function*(e,t,r){Uv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Mr({...t,analyticsAction:r}),c=yield Dr(e,a),u=yield s.fetchFromAPI(c,{origin:"mainSearch"});return yield s.process(u)});return _df.apply(this,arguments)}function ff(_x113,_x114){return _ff.apply(this,arguments)}function _ff(){_ff=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield cf().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Mr({...e,analyticsAction:cf()}),s=yield n0(t,i),c=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(c)});return _ff.apply(this,arguments)}function a0(_x115,_x116,_x117){return _a2.apply(this,arguments)}function _a2(){_a2=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Mr({...e,analyticsAction:t}),c=yield i0(r,a),u=yield s.fetchFromAPI(c,{origin:"facetValues"});return yield s.process(u)});return _a2.apply(this,arguments)}function Wc(_x118,_x119,_x120){return _Wc.apply(this,arguments)}function _Wc(){_Wc=_asyncToGenerator(function*(e,t,r){Uv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Dr(e,a),c=new Mr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(s,{origin:"mainSearch"});return yield c.process(u)});return _Wc.apply(this,arguments)}m();d();p();f();var qr=class{constructor(t,r=n=>{this.dispatch(jo({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x121,_x122){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=ys(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return dt(t.response)?(this.dispatch(Fr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Vt(Wt(_this32.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return dt(i.response)?(_this33.dispatch(Fr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Vt(Wt(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(Hc("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return dt(a.response)?(_this34.dispatch(Fr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Vt(Wt(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Vt(Wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Fv(),o=yield _this35.fetchFromAPI(yield Cr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch($c(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(zc({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Cr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var tie=Ee("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{q:new H,enableQuerySyntax:new ue,clearFilters:new ue}),e.clearFilters&&(r(Fc()),r(kv())),r(Ov({allow:!0})),r(jo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(qo(1))}),rie=P("search/updateSearchAction"),Kc=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wc(r,t,e.legacy);$v(r);let n=e.next?Gv(e.next):void 0,o=yield Cr(r,t.extra.navigatorContext,n),i=new qr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x123,_x124){return _ref57.apply(this,arguments)}}()),Bv=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t){let r=t.getState();if($v(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return df(r,t,e.legacy);let n=new qr({...t,analyticsAction:e.next}),o=yield Cr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x125,_x126){return _ref58.apply(this,arguments)}}()),nie=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return ff(t,r);let n=pg("browseResults",t.getState),o=new qr({...t,analyticsAction:n}),i=yield s0(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x127,_x128){return _ref59.apply(this,arguments)}}()),oie=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wc(r,t,e.legacy);let n=new qr({...t,analyticsAction:{}}),o=yield u0(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x129,_x130){return _ref60.apply(this,arguments)}}()),iie=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return lf(e,t);q(e,{id:X,q:X,maxResultsPerQuery:new te({required:!0,min:1}),cacheTimeout:new te});let{q:n,maxResultsPerQuery:o}=e,i=Gv(Nv()),a=yield c0(r,t.extra.navigatorContext,n,o,i),s=new qr({...t,analyticsAction:i},h=>{t.dispatch(Mc({q:h,id:e.id}))}),c=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield s.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x131,_x132){return _ref61.apply(this,arguments)}}()),s0=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t,r){let n=yield Cr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function s0(_x133,_x134,_x135){return _ref62.apply(this,arguments)}}(),c0=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t,r,n,o){let i=ho(e,t,o);return Ar({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function c0(_x136,_x137,_x138,_x139,_x140){return _ref63.apply(this,arguments)}}(),u0=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t,r){let n=yield Cr(e,t,r);return n.request.numberOfResults=0,n});return function u0(_x141,_x142,_x143){return _ref64.apply(this,arguments)}}(),$v=e=>{e.configuration.analytics.enabled&&wt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Gv=e=>({actionCause:e.actionCause,type:e.actionCause});var Qv=e=>{let t=rm({extra:e}),r=_v();return t.startListening({actionCreator:Kc.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let i=o.getState();if(!Cl(i))return;r.abortRun(),o.dispatch(As()),o.dispatch(Rv());let a=Zr(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x144,_x145){return _ref65.apply(this,arguments)}}()}),t};m();d();p();f();var Hv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},zv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();p();f();var pf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();p();f();function Wv(e,t){let r={...e},n,o=i=>(a,s)=>{let c=i(a,s);return n?n(c,s):c};return{get combinedReducer(){let i=Wf(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Dn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();p();f();m();d();p();f();function l0(e){if(!e||!d0(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Kv(e,t=60){if(!e)return!1;let r=l0(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function d0(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Xv(e,t){let r=0,n=null,o=aa(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(gr({accessToken:v})),v});return function i(_x146){return _ref66.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(c){let u=c.getState(),h=p0(u);if(!(!h||!Kv(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x147){return _ref68.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Yv(c,u.error),u;r++,o(),yield i(c,!0),c.dispatch(h)});return function s(_x148,_x149,_x150){return _ref69.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield a(c));let g=yield u(h);return f0(g)?S?yield s(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Yv(c,g.error),g):g});return function(_x151){return _ref70.apply(this,arguments)}}())}function f0(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Fn().name}function Yv(e,t){e.dispatch(qa({status:401,statusCode:401,message:t.message,type:t.name}))}function p0(e){return e.configuration.accessToken}m();d();p();f();function Jv({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Bp({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(zv(n.logger))})}function m0(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&zf()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function Zv(e,t){let r={...e.reducers,configuration:Ot,version:Nh},n=g0({...e,reducers:r},t,Ot),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(gr({accessToken:o,environment:i,organizationId:a}));let s=m0(e.configuration,n.logger);return s&&n.dispatch(Qn(s)),n}function g0(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Wv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return wi(u.state,o)},get navigatorContext(){return pf(this.relay,o)}},c=h0(e,s,i),u={addReducers(h){i.containsAll(h)||(i.add(h),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(zn())},disableAnalytics(){c.dispatch(Hn())},get state(){return c.getState()},get relay(){return wi(this.state,o)},get navigatorContext(){return pf(this.relay,o)},logger:a,store:c};return u}function h0(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=y0(e,t.logger,()=>t.navigatorContext);return Jv({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function y0(e,t,r){let{renewAccessToken:n}=e.configuration,o=Xv(t,n),i=Qv({getNavigatorContext:r});return[Bh,o,Hv(t),Dh].concat(md.middleware,i.middleware,e.middlewares||[])}m();d();p();f();var cS=_t(sS(),1);function uS(e){return(0,cS.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();p();f();function lS(e,t){let r=D0(e),n=At,o=M0(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function D0(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function M0(e){return e.preprocessRequest||ua}m();d();p();f();m();d();p();f();var dS={organizationId:X,accessToken:X,name:new H({required:!1,emptyAllowed:!1}),analytics:new ee({options:{required:!1},values:{enabled:new ue({required:!1}),originContext:new H({required:!1}),originLevel2:new H({required:!1}),originLevel3:new H({required:!1}),analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new H({required:!1,url:!0}),trackingId:new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new H({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function fS(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var pS=new lt({...dS,pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:Xe,locale:Xe,timezone:Xe});function Sf(){return{...fS(),searchHub:"default"}}var q0={debug:Ma,pipeline:Yn,searchHub:uo,recommendation:so};function mS(e){let t=uS(e.loggerOptions);j0(e.configuration,t);let r=L0(e.configuration,t),n={...lS(e.configuration,t),apiClient:r},o={...e,reducers:q0},i=Zv(o,n),{pipeline:a,searchHub:s,timezone:c,locale:u,proxyBaseUrl:h}=e.configuration;return i.dispatch(Lt({timezone:c,locale:u,proxyBaseUrl:h})),ie(a)||i.dispatch(Wn(a)),ie(s)||i.dispatch(co(s)),{...i,get state(){return i.state}}}function j0(e,t){try{pS.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function L0(e,t){return new fa({logger:t,preprocessRequest:e.preprocessRequest||ua,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||dp,postprocessFacetSearchResponseMiddleware:fp,postprocessQuerySuggestResponseMiddleware:pp})}m();d();p();f();m();d();p();f();m();d();p();f();var V0=new ge({each:X,required:!0}),gS=(e,t)=>(q(e,X),oa(t)?q(t,X):q(t,V0),{payload:{contextKey:e,contextValue:t}}),Rn=P("context/set",e=>{for(let[t,r]of Object.entries(e))gS(t,r);return{payload:e}}),In=P("context/add",e=>gS(e.contextKey,e.contextValue)),Tn=P("context/remove",e=>q(e,X));m();d();p();f();var Jc=Me(Gc(),e=>{e.addCase(Rn,(t,r)=>{t.contextValues=r.payload}).addCase(In,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Tn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();p();f();function Lr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();p();f();var U0=["caseId","caseNumber"],B0={caseId:"caseContext",caseNumber:"caseContext"},Ji=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${B0[t]} to set this value.}`)}};function bf(e){return U0.includes(e)}var $0=new lt({values:new ee({options:{required:!1}})});function hS(e,t={}){if(!H0(e))throw Dt;let r=Lr(e),{dispatch:n}=e,o=()=>e.state,i=im(e,$0,t.initialState,"buildContext");return i.values&&n(Rn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Rn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?G0(n):Q0(n))}}var G0=e=>({add(t,r){e(In({contextKey:t,contextValue:r}))},remove(t){e(Tn(t))}}),Q0=e=>({add(t,r){if(bf(t))throw new Ji(t);e(In({contextKey:t,contextValue:r}))},remove(t){if(bf(t))throw new Ji(t);e(Tn(t))}});function H0(e){return e.addReducers({context:Jc}),!0}function yS(e,t){return hS(e,t)}m();d();p();f();m();d();p();f();var Vo=P("dictionaryFieldContext/set",e=>{let t=new ee({options:{required:!0}}),r=q(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ge({each:Je}),i=q(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Uo=P("dictionaryFieldContext/add",e=>{let t=new ee({options:{required:!0},values:{field:Je,key:Je}});return q(e,t)}),Bo=P("dictionaryFieldContext/remove",e=>q(e,Je));m();d();p();f();var Zc=Me(Qc(),e=>{e.addCase(Vo,(t,r)=>{t.contextValues=r.payload}).addCase(Uo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Bo,(t,r)=>{delete t.contextValues[r.payload]}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function vS(e){if(!z0(e))throw Dt;let t=Lr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(Vo(o))},add(o,i){r(Uo({field:o,key:i}))},remove(o){r(Bo(o))}}}function z0(e){return e.addReducers({dictionaryFieldContext:Zc}),!0}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var Zi={value:X,numberOfResults:new te({min:0}),state:X};m();d();p();f();var Ie=X;var X0=new te({min:1,default:8,required:!1}),J0=new te({min:1,max:20,default:5,required:!1}),Z0={desiredCount:J0,numberOfValues:X0},fue=P("automaticFacet/setOptions",e=>q(e,Z0)),pue=P("automaticFacet/deselectAll",e=>q(e,Ie)),ek=X,SS=P("automaticFacet/toggleSelectValue",e=>q(e,{field:ek,selection:new ee({values:Zi})}));m();d();p();f();m();d();p();f();var tk={state:new Oe({required:!0}),numberOfResults:new te({required:!0,min:0}),value:new H({required:!0,emptyAllowed:!0}),path:new ge({required:!0,each:X}),moreValuesAvailable:new ue({required:!1})};function Af(e){e.children.forEach(t=>{Af(t)}),At({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},tk)}var $o={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),delimitingCharacter:new H({required:!1,emptyAllowed:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),basePath:new ge({required:!1,each:X}),filterByBasePath:new ue({required:!1})};var Oue=P("categoryFacet/register",e=>q(e,$o)),bS=P("categoryFacet/toggleSelectValue",e=>{try{return At(e.facetId,X),Af(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),AS=P("categoryFacet/deselectAll",e=>q(e,$o.facetId)),Pue=P("categoryFacet/updateNumberOfValues",e=>q(e,{facetId:$o.facetId,numberOfValues:$o.numberOfValues})),Nue=P("categoryFacet/updateSortCriterion",e=>q(e,{facetId:$o.facetId,criterion:new Oe})),Fue=P("categoryFacet/updateBasePath",e=>q(e,{facetId:$o.facetId,basePath:new ge({each:X})}));m();d();p();f();m();d();p();f();var ea={facetId:Ie,captions:new ee({options:{required:!1}}),numberOfValues:new te({required:!1,min:1}),query:new H({required:!1,emptyAllowed:!0})};var rk={path:new ge({required:!0,each:X}),displayValue:Je,rawValue:Je,count:new te({required:!0,min:0})},wS=P("categoryFacet/selectSearchResult",e=>q(e,{facetId:Ie,value:new ee({values:rk})})),Jue=P("categoryFacetSearch/register",e=>q(e,ea));m();d();p();f();var xS={facetId:Ie,value:new ee({values:{displayValue:Je,rawValue:Je,count:new te({required:!0,min:0})}})},ule=P("facetSearch/register",e=>q(e,ea)),lle=P("facetSearch/update",e=>q(e,ea)),CS=P("facetSearch/toggleSelectValue",e=>q(e,xS)),ES=P("facetSearch/toggleExcludeValue",e=>q(e,xS));m();d();p();f();m();d();p();f();var yle=new H({regex:/^[a-zA-Z0-9-_]+$/}),vle=new H({required:!0}),Sle=new ge({each:new H}),ble=new H,Ale=new ue,wle=new ue,xle=new te({min:0}),nk=new te({min:1}),Cle=new ue({required:!0}),ok=new ee,ik=new H,ak={captions:ok,numberOfValues:nk,query:ik},Ele=new ee({values:ak}),RS=new ee({options:{required:!1},values:{type:new H({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ge({required:!0,max:25,each:new H({emptyAllowed:!1,required:!0})})}}),Rle=new ue,IS=new ge({min:1,max:25,required:!1,each:new H({emptyAllowed:!1,required:!0})});var sk={facetId:Ie,field:new H({required:!0,emptyAllowed:!0}),tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),resultsMustMatch:new Oe({required:!1}),allowedValues:RS,customSort:IS},jle=P("facet/register",e=>q(e,sk)),TS=P("facet/toggleSelectValue",e=>q(e,{facetId:Ie,selection:new ee({values:Zi})})),_S=P("facet/toggleExcludeValue",e=>q(e,{facetId:Ie,selection:new ee({values:Zi})})),eu=P("facet/deselectAll",e=>q(e,Ie)),Lle=P("facet/updateSortCriterion",e=>q(e,{facetId:Ie,criterion:new Oe({required:!0})})),Vle=P("facet/updateNumberOfValues",e=>q(e,{facetId:Ie,numberOfValues:new te({required:!0,min:1})})),Ule=P("facet/updateIsFieldExpanded",e=>q(e,{facetId:Ie,isFieldExpanded:new ue({required:!0})})),Ble=P("facet/updateFreezeCurrentValues",e=>q(e,{facetId:Ie,freezeCurrentValues:new ue({required:!0})}));m();d();p();f();m();d();p();f();function OS(e){let t=kS(e.start,e),r=kS(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function kS(e,t){let{dateFormat:r}=t;return th(e)?(td(e),Jg(e)):typeof e=="string"&&br(e)?(td(e),e):(Wg(e,r),hs(go(e,r)))}m();d();p();f();var PS=P("rangeFacet/updateSortCriterion",e=>q(e,{facetId:Ie,criterion:new Oe({required:!0})}));m();d();p();f();var tu={state:X,start:new te({required:!0}),end:new te({required:!0}),endInclusive:new ue({required:!0}),numberOfResults:new te({required:!0,min:0})},ru={start:X,end:X,endInclusive:new ue({required:!0}),state:X,numberOfResults:new te({required:!0,min:0})};var ck={start:X,end:X,endInclusive:new ue({required:!0}),state:X},uk={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),currentValues:new ge({required:!1,each:new ee({values:ck})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),rangeAlgorithm:new Oe({required:!1})};function NS(e){return br(e)?_i(e):e}function FS(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=OS(t);if(go(NS(r)).isAfter(go(NS(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Tde=P("dateFacet/register",e=>{try{return At(e,uk),FS(e),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),DS=P("dateFacet/toggleSelectValue",e=>q(e,{facetId:Ie,selection:new ee({values:ru})})),MS=P("dateFacet/toggleExcludeValue",e=>q(e,{facetId:Ie,selection:new ee({values:ru})})),qS=P("dateFacet/updateFacetValues",e=>{try{return At(e,{facetId:Ie,values:new ge({each:new ee({values:ru})})}),FS({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}});m();d();p();f();var lk={state:X,start:new te({required:!0}),end:new te({required:!0}),endInclusive:new ue({required:!0})},dk={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),currentValues:new ge({required:!1,each:new ee({values:lk})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),rangeAlgorithm:new Oe({required:!1})};function jS(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Ude=P("numericFacet/register",e=>{try{return q(e,dk),jS(e),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),LS=P("numericFacet/toggleSelectValue",e=>q(e,{facetId:Ie,selection:new ee({values:tu})})),VS=P("numericFacet/toggleExcludeValue",e=>q(e,{facetId:Ie,selection:new ee({values:tu})})),US=P("numericFacet/updateFacetValues",e=>{try{return At(e,{facetId:Ie,values:new ge({each:new ee({values:tu})})}),jS({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}});var BS=Me(Yi(),e=>{e.addCase(jc,(t,r)=>{let n=wf(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ta(n,o)}).addCase(Lc,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(ws,t=>{t.firstResult=0}).addCase(Vc,(t,r)=>{let n=r.payload;t.firstResult=ta(n,t.numberOfResults)}).addCase(qo,(t,r)=>{let n=r.payload;t.firstResult=ta(n,t.numberOfResults)}).addCase(Bc,t=>{let r=wf(t),n=Math.max(r-1,1);t.firstResult=ta(n,t.numberOfResults)}).addCase(Uc,t=>{let r=wf(t),n=pk(t),o=Math.min(r+1,n);t.firstResult=ta(o,t.numberOfResults)}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(hr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Kc.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Bv.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(eu,t=>{at(t)}).addCase(MS,t=>{at(t)}).addCase(_S,t=>{at(t)}).addCase(VS,t=>{at(t)}).addCase(ES,t=>{at(t)}).addCase(TS,t=>{at(t)}).addCase(AS,t=>{at(t)}).addCase(bS,t=>{at(t)}).addCase(wS,t=>{at(t)}).addCase(DS,t=>{at(t)}).addCase(LS,t=>{at(t)}).addCase(Fc,t=>{at(t)}).addCase(qS,t=>{at(t)}).addCase(US,t=>{at(t)}).addCase(CS,t=>{at(t)}).addCase(SS,t=>{at(t)})});function at(e){e.firstResult=Yi().firstResult}function wf(e){let{firstResult:t,numberOfResults:r}=e;return mk(t,r)}function pk(e){let{totalCountFiltered:t,numberOfResults:r}=e;return gk(t,r)}function ta(e,t){return(e-1)*t}function mk(e,t){return Math.round(e/t)+1}function gk(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function xf(e){return e.addReducers({pagination:BS}),{nextPage:Uc,previousPage:Bc,registerNumberOfResults:jc,registerPage:Vc,updateNumberOfResults:Lc,updatePage:qo}}var hk=new lt({id:new H({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new te({min:0})});function $S(e,t={}){if(!yk(e))throw Dt;let r=Lr(e),{dispatch:n}=e,o=()=>e.state,i=am(e,hk,t.options,"buildRecommendationList");return i.id!==""&&n(ao({id:i.id})),i.numberOfRecommendations&&n(xf(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Sr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function yk(e){return e.addReducers({recommendation:so,configuration:Ot}),!0}m();d();p();f();m();d();p();f();function GS(e,t,r){if(!vk(e))throw Dt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:aa(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function vk(e){return e.addReducers({configuration:Ot}),!0}function QS(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(ls(t.options.result)))};return GS(e,t,()=>{n()})}m();d();p();f();m();d();p();f();m();d();p();f();var Vr=()=>new H({required:!1,emptyAllowed:!0}),nu=P("advancedSearchQueries/update",e=>q(e,{aq:Vr(),cq:Vr(),lq:Vr(),dq:Vr()})),ou=P("advancedSearchQueries/register",e=>q(e,{aq:Vr(),cq:Vr(),lq:Vr(),dq:Vr()}));var HS=Me(Nr(),e=>{e.addCase(nu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;ze(n)||(t.aq=n,t.aqWasSet=!0),ze(o)||(t.cq=o,t.cqWasSet=!0),ze(i)||(t.lq=i,t.lqWasSet=!0),ze(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(ou,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;ze(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),ze(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),ze(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),ze(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(mt.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(hr,(t,r)=>{let{aq:n,cq:o}=r.payload;ze(n)||(t.aq=n,t.aqWasSet=!0),ze(o)||(t.cq=o,t.cqWasSet=!0)})});function Sk(e){return e.addReducers({advancedSearchQueries:HS}),{updateAdvancedSearchQueries:nu,registerAdvancedSearchQueries:ou}}m();d();p();f();function bk(e){return e.addReducers({configuration:Ot}),{disableAnalytics:Hn,enableAnalytics:zn,setOriginLevel2:Oa,setOriginLevel3:Pa,updateAnalyticsConfiguration:Qn,updateBasicConfiguration:gr}}m();d();p();f();function Ak(e){return e.addReducers({configuration:Ot,pipeline:Yn,searchHub:uo}),{updateSearchConfiguration:Lt}}m();d();p();f();function wk(e){return e.addReducers({context:Jc}),{addContext:In,removeContext:Tn,setContext:Rn}}m();d();p();f();function xk(e){return e.addReducers({debug:Ma}),{disableDebug:Fa,enableDebug:Na}}m();d();p();f();function Ck(e){return e.addReducers({dictionaryFieldContext:Zc}),{addContext:Uo,removeContext:Bo,setContext:Vo}}m();d();p();f();m();d();p();f();m();d();p();f();var Ek={collectionField:new H({emptyAllowed:!1,required:!1}),parentField:new H({emptyAllowed:!1,required:!1}),childField:new H({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new te({min:0,required:!1})},zS=P("folding/register",e=>q(e,Ek)),lme=Ee("folding/loadCollection",/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield xr(i):ho(i,o),s=yield n.search({...a,q:Rk(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return dt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x152,_x153){return _ref71.apply(this,arguments)}}());function Rk(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();p();f();var WS=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();p();f();var Go=P("fields/registerFieldsToInclude",e=>q(e,ka)),iu=P("fields/fetchall/enable"),au=P("fields/fetchall/disable"),su=Ee("fields/fetchDescription",/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:c}=o.configuration.search,u=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:c??dr(s,a)});return dt(u)?n(u.error):u.success.fields});return function(_x154,_x155){return _ref72.apply(this,arguments)}}());m();d();p();f();var cu=["author","language","urihash","objecttype","collection","source","permanentid"],Cf=[...cu,"date","filetype","parents"],KS=[...Cf,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],YS=()=>({fieldsToInclude:cu,fetchAllFields:!1,fieldsDescription:[]});var uu=Me(YS(),e=>e.addCase(Go,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(iu,t=>{t.fetchAllFields=!0}).addCase(au,t=>{t.fetchAllFields=!1}).addCase(su.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(zS,(t,{payload:r})=>{let n=WS().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function Ik(e){return e.addReducers({fields:uu}),{registerFieldsToInclude:Go,enableFetchAllFields:iu,disableFetchAllFields:au,fetchFieldsDescription:su}}m();d();p();f();function Tk(e){return e.addReducers({pipeline:Yn}),{setPipeline:Wn}}m();d();p();f();function _k(e){return e.addReducers({recommendation:so}),{getRecommendations:Sr,setRecommendationId:ao}}m();d();p();f();function kk(e){return e.addReducers({}),{logRecommendationOpen:ls}}m();d();p();f();m();d();p();f();var Ok=new lt({content:new Oe({required:!0}),conditions:new Oe({required:!0}),priority:new te({required:!1,default:0,min:0}),fields:new ge({required:!1,each:X})});function XS(){let e=[],t=r=>{let n=Ok.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new Jo("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function JS(e){if(!Pk(e))throw Dt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=XS();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Go(i))},selectTemplate:r,selectLinkTemplate:n}}function Pk(e){return e.addReducers({fields:uu}),!0}m();d();p();f();function Nk(e){return e.addReducers({searchHub:uo}),{setSearchHub:co}}/**
40
+ `),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},O_=e=>{let t=new zt,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Cn.HEADERS&&o.type===Cn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=mv(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},P_=e=>{let t=new zt,r=new Qs,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===Cn.HEADERS&&!n?(n=!0,o.headers.get("content-type")===gv?O_(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):k_(r).subscribe({next:i=>{try{let a=Os.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:F.RUN_ERROR,message:i.message||"Request aborted",code:"abort",rawEvent:i}),t.complete();return}return t.error(i)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:o=>{r.error(o),t.error(o)},complete:()=>{r.complete()}}),t.asObservable()},Pe=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),N_=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),F_=R.object({type:R.literal(Pe.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),D_=R.object({type:R.literal(Pe.enum.TextMessageContent),messageId:R.string(),content:R.string()}),M_=R.object({type:R.literal(Pe.enum.TextMessageEnd),messageId:R.string()}),j_=R.object({type:R.literal(Pe.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),q_=R.object({type:R.literal(Pe.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),L_=R.object({type:R.literal(Pe.enum.ActionExecutionEnd),actionExecutionId:R.string()}),V_=R.object({type:R.literal(Pe.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),U_=R.object({type:R.literal(Pe.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),B_=R.object({type:R.literal(Pe.enum.MetaEvent),name:N_,value:R.any()}),G_=R.object({type:R.literal(Pe.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[F_,D_,M_,j_,q_,L_,V_,U_,B_,G_]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var $_=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
+ `)},Q_=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",c=null,u=null,h=[],v={},S=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(yt(g=>{switch(g.type){case F.TEXT_MESSAGE_START:{let y=g;return[{type:Pe.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case F.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:Pe.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case F.TEXT_MESSAGE_END:{let y=g;return[{type:Pe.enum.TextMessageEnd,messageId:y.messageId}]}case F.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,v[y.toolCallId]=y.toolCallName,[{type:Pe.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case F.TOOL_CALL_ARGS:{let y=g,x=h.find(C=>C.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let E=!1;if(u){let C=u.find(I=>I.tool==x.function.name);if(C)try{let I=JSON.parse(cc(x.function.arguments));C.tool_argument&&C.tool_argument in I?(S({...o,[C.state_key]:I[C.tool_argument]}),E=!0):C.tool_argument||(S({...o,[C.state_key]:I}),E=!0)}catch{}}return[{type:Pe.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(E?[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case F.TOOL_CALL_END:{let y=g;return[{type:Pe.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case F.TOOL_CALL_RESULT:{let y=g;return[{type:Pe.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:v[y.toolCallId]||"unknown"}]}case F.RAW:return[];case F.CUSTOM:{let y=g;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:Pe.enum.MetaEvent,name:y.name,value:y.value}]}case F.STATE_SNAPSHOT:return S(g.snapshot),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case F.STATE_DELTA:{let y=g,x=Or(o,y.delta,!0,!1);return x?(S(x.newDocument),[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case F.MESSAGES_SNAPSHOT:return c=g.messages,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case F.RUN_STARTED:return[];case F.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:H_(c)}:{})}),active:!1}];case F.RUN_ERROR:{let y=g;return[{type:Pe.enum.RunError,message:y.message,code:y.code}]}case F.STEP_STARTED:return s=g.stepName,h=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case F.STEP_FINISHED:return h=[],u=null,[{type:Pe.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function H_(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=$_(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var Fc=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:F.TEXT_MESSAGE_END,messageId:r.messageId};return i=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},s=()=>{if(!n||i!=="tool")throw Error("No tool call to close");let h={type:F.TOOL_CALL_END,toolCallId:n.toolCallId};return i=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!o||i!=="reasoning")throw Error("No reasoning message to close");let h={type:F.REASONING_MESSAGE_END,messageId:o.messageId};return i=void 0,o=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>i==="text"?[a()]:i==="tool"?[s()]:i==="reasoning"?[c()]:[];return t.pipe(yt(h=>{switch(h.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.MESSAGES_SNAPSHOT:case F.CUSTOM:case F.RUN_STARTED:case F.RUN_FINISHED:case F.RUN_ERROR: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[...u(),h];case F.RAW:case F.ACTIVITY_SNAPSHOT:case F.ACTIVITY_DELTA:case F.REASONING_ENCRYPTED_VALUE:return[h];case F.TEXT_MESSAGE_CHUNK:let v=h,S=[];if((i!=="text"||v.messageId!==void 0&&v.messageId!==r?.messageId)&&S.push(...u()),i!=="text"){if(v.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:v.messageId},i="text";let C={type:F.TEXT_MESSAGE_START,messageId:v.messageId,role:v.role||"assistant"};S.push(C),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(C))}if(v.delta!==void 0){let C={type:F.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:v.delta};S.push(C),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(C))}return S;case F.TOOL_CALL_CHUNK:let g=h,y=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),i!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},i="tool";let C={type:F.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(C),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(C))}if(g.delta!==void 0){let C={type:F.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(C),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(C))}return y;case F.REASONING_MESSAGE_CHUNK:let x=h,E=[];if((i!=="reasoning"||x.messageId&&x.messageId!==o?.messageId)&&E.push(...u()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");o={messageId:x.messageId},i="reasoning";let C={type:F.REASONING_MESSAGE_START,messageId:x.messageId};E.push(C),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(C))}if(x.delta!==void 0){let C={type:F.REASONING_MESSAGE_CONTENT,messageId:o.messageId,delta:x.delta};E.push(C),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(C))}return E}return h.type,[]}),xn(()=>{u()}))},ip=class{runNext(e,t){return t.run(e).pipe(Fc(!1))}runNextWithState(e,t){let r=ke(e.messages||[]),n=ke(e.state||{}),o=new Qs;return xv(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(ac(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:ke(r),state:ke(n)}});return function(_x89){return _ref45.apply(this,arguments)}}()))}},z_=class extends ip{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function W_(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var K_=class extends ip{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(W_)};return this.runNext(o,t)}},vv="THINKING_START",Sv="THINKING_END",bv="THINKING_TEXT_MESSAGE_START",Av="THINKING_TEXT_MESSAGE_CONTENT",wv="THINKING_TEXT_MESSAGE_END",Y_=class extends ip{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){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(wn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case vv:{this.currentReasoningId=Wi();let{title:t,...r}=e;return this.warnAboutTransformation(vv,F.REASONING_START),{...r,type:F.REASONING_START,messageId:this.currentReasoningId}}case bv:return this.currentMessageId=Wi(),this.warnAboutTransformation(bv,F.REASONING_MESSAGE_START),{...e,type:F.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case Av:{let{delta:t,...r}=e;return this.warnAboutTransformation(Av,F.REASONING_MESSAGE_CONTENT),{...r,type:F.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Wi(),delta:t}}case wv:{let t=this.currentMessageId??Wi();return this.warnAboutTransformation(wv,F.REASONING_MESSAGE_END),{...e,type:F.REASONING_MESSAGE_END,messageId:t}}case Sv:{let t=this.currentReasoningId??Wi();return this.warnAboutTransformation(Sv,F.REASONING_END),{...e,type:F.REASONING_END,messageId:t}}default:return e}}},X_="0.0.45",J_=class{get maxVersion(){return X_}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Rr(),this.messages=ke(n??[]),this.state=ke(o??{}),this.debug=i??!1,Nc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new K_),Nc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new Y_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new z_(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Rr();let r=_this14.prepareRunAgentInput(e),n,o=new Set(_this14.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new zt;let a;_this14.activeRunCompletionPromise=new Promise(c=>{a=c}),yield ic($s(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this14).run(r),Fc(_this14.debug),op(_this14.debug),c=>c.pipe(sc(_this14.activeRunDetach$)),c=>_this14.apply(r,c,i),c=>_this14.processApplyEvents(r,c,i),Qi(c=>(_this14.isRunning=!1,_this14.onError(r,c,i))),xn(()=>{_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(qe(null)));let s=ke(_this14.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new Id}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Rr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new zt;let a;_this15.activeRunCompletionPromise=new Promise(c=>{a=c}),yield ic($s(()=>_this15.connect(r),Fc(_this15.debug),op(_this15.debug),c=>c.pipe(sc(_this15.activeRunDetach$)),c=>_this15.apply(r,c,i),c=>_this15.processApplyEvents(r,c,i),Qi(c=>(_this15.isRunning=!1,c instanceof Id?Hs:_this15.onError(r,c,i))),xn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(qe(null)));let s=ke(_this15.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return xv(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe($d(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=ke(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Rr(),tools:ke(e?.tools??[]),context:ke(e?.context??[]),forwardedProps:ke(e?.forwardedProps??{}),state:ke(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){let r=yield _e(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this17.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})),r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})})))})()}onError(e,t,r){return An(_e(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(wn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield _e(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=ke(this.messages),e.state=ke(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=ke(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=ke(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Rr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r)}),this).run(t)).pipe(Fc(this.debug),op(this.debug),Q_(this.threadId,t.runId,this.agentId),r=>r.pipe(wn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Cv=class extends J_{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=ke(e.headers??{})}run(e){return P_(__(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=ke(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();f();p();var Ev=(e,t,r)=>{let n=We(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var ap=class extends Cv{requestInit(t){let{params:r,accessToken:n}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal}}},Rv=(e,t,r)=>new ap({url:`${Ev(e,t,r)}/answer`});m();d();f();p();m();d();f();p();var Z_=new H({required:!0}),Iv=new H({required:!0,constrainTo:vs}),Tv=e=>({...e,name:Ss(e.name)}),_v=P("followUpAnswers/setIsEnabled",e=>j(e,new ue({required:!0}))),kv=P("followUpAnswers/setFollowUpAnswersConversationId",e=>j(e,X)),kZ=P("followUpAnswers/createFollowUpAnswer",e=>j(e,{question:X})),OZ=P("followUpAnswers/setActiveFollowUpAnswerId",e=>j(e,X)),PZ=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>j(e,{contentFormat:bs,answerId:X})),NZ=P("followUpAnswers/setFollowUpIsLoading",e=>j(e,{isLoading:new ue({required:!0}),answerId:X})),FZ=P("followUpAnswers/setFollowUpIsStreaming",e=>j(e,{isStreaming:new ue({required:!0}),answerId:X})),DZ=P("followUpAnswers/followUpMessageChunkReceived",e=>j(e,{textDelta:Z_,answerId:X})),MZ=P("followUpAnswers/followUpCitationsReceived",e=>j(e,{citations:new ge({required:!0,each:new ee({values:pd})}),answerId:X})),jZ=P("followUpAnswers/followUpCompleted",e=>j(e,{answerId:X,cannotAnswer:new ue({required:!1})})),qZ=P("followUpAnswers/followUpFailed",e=>j(e,{message:new H,code:new te({min:0}),answerId:X})),LZ=P("followUpAnswers/activeFollowUpStartFailed",e=>j(e,{message:new H})),VZ=P("followUpAnswers/likeFollowUp",e=>j(e,{answerId:X})),UZ=P("followUpAnswers/dislikeFollowUp",e=>j(e,{answerId:X})),BZ=P("followUpAnswers/submitFollowUpFeedback",e=>j(e,{answerId:X})),Ov=P("followUpAnswers/resetFollowUpAnswers"),GZ=P("followUpAnswers/stepStarted",e=>j(Tv(e),{answerId:X,name:Iv,startedAt:new te({min:0,required:!0})})),$Z=P("followUpAnswers/stepFinished",e=>j(Tv(e),{answerId:X,name:Iv,finishedAt:new te({min:0,required:!0})}));m();d();f();p();var e0={"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:TURN_LIMIT_REACHED":1005};function Pv(e){return e?e0[e]??1004:1004}var Nv=e=>({onRunStartedEvent:({event:t})=>{e(As(t.runId)),e(Er(!1)),e(ki(!0)),e(kv(t.threadId))},onStepStartedEvent:({event:t})=>{e(Eh({name:t.stepName,startedAt:t.timestamp??Date.now()}))},onStepFinishedEvent:({event:t})=>{e(Rh({name:t.stepName,finishedAt:t.timestamp??Date.now()}))},onTextMessageContentEvent:({event:t})=>{e(Oi({textDelta:t.delta}))},onCustomEvent:({event:t})=>{let{name:r,value:n}=t;switch(r){case"header":{n?.contentFormat&&e(Fi(n.contentFormat)),n?.followUpEnabled&&e(_v(n.followUpEnabled));return}case"citations":{e(Pi({citations:n.citations}));return}}},onRunErrorEvent:({event:t})=>{let r=Pv(t.code);e(Ni({message:t.message,code:r}))},onRunFinishedEvent:({event:t})=>{let r=t.result?.completionReason==="ANSWERED";e(fd(r)),e(Di(!r)),e(ki(!1)),e(fo(r)),e(mo())}});var Fv=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=os(n),s=Wm(n),c=Km(n),u=zm(n),h=Rv(a,s,c);e=h;let v=Nv(o),S=Sh(n,i());try{o(Er(!0)),yield h.runAgent({forwardedProps:{params:S,accessToken:u}},v)}catch(g){o(Er(!1)),o(Ni({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",g)}});return function run(_x90,_x91,_x92){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();f();p();m();d();f();p();var Dc=P("breadcrumb/deselectAll"),Dv=P("breadcrumb/deselectAllNonBreadcrumbs");m();d();f();p();var Mv=P("facet/updateFacetAutoSelection",e=>j(e,{allow:new ue({required:!0})}));m();d();f();p();m();d();f();p();var Mc=class extends vr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??St().q}get responseTime(){return this.activeInstantResultCache?.duration??Mt().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??Mt().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var jv=()=>ct("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Mc(e)),qv=()=>({actionCause:"searchboxAsYouType"});m();d();f();p();var sp={id:X},t0={...sp,q:Je},Zee=P("instantResults/register",e=>j(e,sp)),jc=P("instantResults/updateQuery",e=>j(e,t0)),ete=P("instantResults/clearExpired",e=>j(e,sp));m();d();f();p();var qc=new te({required:!0,min:0}),Lc=P("pagination/registerNumberOfResults",e=>j(e,qc)),Vc=P("pagination/updateNumberOfResults",e=>j(e,qc)),Uc=P("pagination/registerPage",e=>j(e,qc)),Mo=P("pagination/updatePage",e=>j(e,qc)),Bc=P("pagination/nextPage"),Gc=P("pagination/previousPage");m();d();f();p();var jo=P("query/updateQuery",e=>j(e,{q:new H,enableQuerySyntax:new ue}));m();d();f();p();m();d();f();p();m();d();f();p();var Nr=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var cp=()=>ct("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Fr=e=>ct("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||St().q,aq:r.advancedSearchQueries?.aq||Nr().aq,cq:r.advancedSearchQueries?.cq||Nr().cq,dq:r.advancedSearchQueries?.dq||Nr().dq,errorType:e.type,errorMessage:e.message}));m();d();f();p();m();d();f();p();var qte=P("didYouMean/enable"),Lte=P("didYouMean/disable"),Vte=P("didYouMean/automaticCorrections/disable"),Ute=P("didYouMean/automaticCorrections/enable"),$c=P("didYouMean/correction",e=>j(e,X)),Bte=P("didYouMean/automaticCorrections/mode",e=>j(e,new H({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();f();p();var up=()=>ct("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Lv=()=>({actionCause:"didYouMeanAutomatic"});m();d();f();p();m();d();f();p();function Qc(){return{contextValues:{}}}m();d();f();p();function Hc(){return{contextValues:{}}}m();d();f();p();function Vv(){return{freezeFacetOrder:!1,facets:{}}}m();d();f();p();function Uv(){return[]}m();d();f();p();function Ki(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();f();p();function Bv(){return{}}m();d();f();p();function Gv(){return{}}m();d();f();p();function $v(){return{}}function Wt(e){return{context:e.context||Qc(),dictionaryFieldContext:e.dictionaryFieldContext||Hc(),facetSet:e.facetSet||ns(),numericFacetSet:e.numericFacetSet||rs(),dateFacetSet:e.dateFacetSet||ts(),categoryFacetSet:e.categoryFacetSet||es(),automaticFacetSet:e.automaticFacetSet??Za(),pagination:e.pagination||Ki(),query:e.query||St(),tabSet:e.tabSet||$v(),advancedSearchQueries:e.advancedSearchQueries||Nr(),staticFilterSet:e.staticFilterSet||Gv(),querySet:e.querySet||Bv(),sortCriteria:e.sortCriteria||is(),pipeline:e.pipeline||Kn(),searchHub:e.searchHub||oo(),facetOptions:e.facetOptions||Vv(),facetOrder:e.facetOrder??Uv(),debug:e.debug??Fa()}}m();d();f();p();var mne=new ee({values:{undoneQuery:Je},options:{required:!0}}),Qv=()=>ct("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();f();p();var zc=P("trigger/query/ignore",e=>j(e,new H({emptyAllowed:!0,required:!0}))),Wc=P("trigger/query/modification",e=>j(e,new ee({values:{originalQuery:Xe,modification:Xe}})));m();d();f();p();var Dr=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=o0(e),n=ys(e),o=r0(e),i=yield xr(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Ar({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Dr(_x93,_x94){return _ref51.apply(this,arguments)}}();function r0(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(n0).filter(r=>r.currentValues.length>0):void 0}function n0(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function o0(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=i0(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function i0(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Mr=class{constructor(t,r=n=>{this.dispatch(jo({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x95,_x96){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=hs(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return dt(t.response)?(this.dispatch(Fr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(Vt(Wt(_this25.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return dt(i.response)?(_this26.dispatch(Fr(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(Vt(Wt(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:up()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:up()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(zc("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return dt(a.response)?(_this27.dispatch(Fr(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(Vt(Wt(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Qv()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??St().enableQuerySyntax},search:{...Mt(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Vt(Wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield Dr(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch($c(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(Wc({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield Dr(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var foe=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Kc(r,t,e)});return function(_x97,_x98){return _ref52.apply(this,arguments)}}()),moe=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield dp(r,t,e)});return function(_x99,_x100){return _ref53.apply(this,arguments)}}()),goe=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pp(t,r)});return function(_x101,_x102){return _ref54.apply(this,arguments)}}()),hoe=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield u0(t,e,r)});return function(_x103,_x104){return _ref55.apply(this,arguments)}}()),yoe=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return lp(e,t)});return function(_x105,_x106){return _ref56.apply(this,arguments)}}()),a0=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield Dr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function a0(_x107,_x108){return _ref57.apply(this,arguments)}}(),s0=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield xr(e);return Ar({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function s0(_x109,_x110,_x111){return _ref58.apply(this,arguments)}}(),c0=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield Dr(e,t);return r.request.numberOfResults=0,r});return function c0(_x112,_x113){return _ref59.apply(this,arguments)}}(),Hv=e=>{e.configuration.analytics.enabled&&wt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function lp(_x114,_x115){return _lp.apply(this,arguments)}function _lp(){_lp=_asyncToGenerator(function*(e,t){j(e,{id:X,q:X,maxResultsPerQuery:new te({required:!0,min:1}),cacheTimeout:new te});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Mr({...t,analyticsAction:jv()},u=>{t.dispatch(jc({q:u,id:e.id}))}),a=yield s0(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(s);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _lp.apply(this,arguments)}function dp(_x116,_x117,_x118){return _dp.apply(this,arguments)}function _dp(){_dp=_asyncToGenerator(function*(e,t,r){Hv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Mr({...t,analyticsAction:r}),c=yield Dr(e,a),u=yield s.fetchFromAPI(c,{origin:"mainSearch"});return yield s.process(u)});return _dp.apply(this,arguments)}function pp(_x119,_x120){return _pp.apply(this,arguments)}function _pp(){_pp=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield cp().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Mr({...e,analyticsAction:cp()}),s=yield a0(t,i),c=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(c)});return _pp.apply(this,arguments)}function u0(_x121,_x122,_x123){return _u2.apply(this,arguments)}function _u2(){_u2=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Mr({...e,analyticsAction:t}),c=yield c0(r,a),u=yield s.fetchFromAPI(c,{origin:"facetValues"});return yield s.process(u)});return _u2.apply(this,arguments)}function Kc(_x124,_x125,_x126){return _Kc.apply(this,arguments)}function _Kc(){_Kc=_asyncToGenerator(function*(e,t,r){Hv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield Dr(e,a),c=new Mr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(s,{origin:"mainSearch"});return yield c.process(u)});return _Kc.apply(this,arguments)}m();d();f();p();var jr=class{constructor(t,r=n=>{this.dispatch(jo({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x127,_x128){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=hs(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return dt(t.response)?(this.dispatch(Fr(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!ie(c)&&!ie(c.correctedQuery);if(!u&&!h)return null;let S=u?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(Vt(Wt(_this32.getState()))),S})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return dt(i.response)?(_this33.dispatch(Fr(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(Vt(Wt(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(zc("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return dt(a.response)?(_this34.dispatch(Fr(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(Vt(Wt(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(Vt(Wt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Lv(),o=yield _this35.fetchFromAPI(yield Cr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch($c(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(Wc({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Cr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var rie=Ee("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;j(e,{q:new H,enableQuerySyntax:new ue,clearFilters:new ue}),e.clearFilters&&(r(Dc()),r(Dv())),r(Mv({allow:!0})),r(jo({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Mo(1))}),nie=P("search/updateSearchAction"),Yc=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Kc(r,t,e.legacy);Wv(r);let n=e.next?Kv(e.next):void 0,o=yield Cr(r,t.extra.navigatorContext,n),i=new jr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x129,_x130){return _ref60.apply(this,arguments)}}()),zv=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Wv(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return dp(r,t,e.legacy);let n=new jr({...t,analyticsAction:e.next}),o=yield Cr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x131,_x132){return _ref61.apply(this,arguments)}}()),oie=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return pp(t,r);let n=mg("browseResults",t.getState),o=new jr({...t,analyticsAction:n}),i=yield l0(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x133,_x134){return _ref62.apply(this,arguments)}}()),iie=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Kc(r,t,e.legacy);let n=new jr({...t,analyticsAction:{}}),o=yield p0(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x135,_x136){return _ref63.apply(this,arguments)}}()),aie=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return lp(e,t);j(e,{id:X,q:X,maxResultsPerQuery:new te({required:!0,min:1}),cacheTimeout:new te});let{q:n,maxResultsPerQuery:o}=e,i=Kv(qv()),a=yield d0(r,t.extra.navigatorContext,n,o,i),s=new jr({...t,analyticsAction:i},h=>{t.dispatch(jc({q:h,id:e.id}))}),c=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield s.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x137,_x138){return _ref64.apply(this,arguments)}}()),l0=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Cr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function l0(_x139,_x140,_x141){return _ref65.apply(this,arguments)}}(),d0=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=ho(e,t,o);return Ar({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function d0(_x142,_x143,_x144,_x145,_x146){return _ref66.apply(this,arguments)}}(),p0=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Cr(e,t,r);return n.request.numberOfResults=0,n});return function p0(_x147,_x148,_x149){return _ref67.apply(this,arguments)}}(),Wv=e=>{e.configuration.analytics.enabled&&wt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Kv=e=>({actionCause:e.actionCause,type:e.actionCause});var Yv=e=>{let t=nm({extra:e}),r=Fv();return t.startListening({actionCreator:Yc.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!El(i))return;r.abortRun(),o.dispatch(ws()),o.dispatch(Ov());let a=Zr(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x150,_x151){return _ref68.apply(this,arguments)}}()}),t};m();d();f();p();var Xv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},Jv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();f();p();var fp=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();f();p();function Zv(e,t){let r={...e},n,o=i=>(a,s)=>{let c=i(a,s);return n?n(c,s):c};return{get combinedReducer(){let i=Wp(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Dn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();f();p();m();d();f();p();function f0(e){if(!e||!m0(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function eS(e,t=60){if(!e)return!1;let r=f0(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function m0(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function rS(e,t){let r=0,n=null,o=ia(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(S){if(!u)throw S;return null}})().finally(()=>{n=null}));let v=yield n;return h&&v&&c.dispatch(gr({accessToken:v})),v});return function i(_x152){return _ref69.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(c){let u=c.getState(),h=h0(u);if(!(!h||!eS(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(v){e.warn(v,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x153){return _ref71.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),tS(c,u.error),u;r++,o(),yield i(c,!0),c.dispatch(h)});return function s(_x154,_x155,_x156){return _ref72.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(h){let v=typeof h=="function",S=typeof t=="function";if(!v)return u(h);S&&(yield a(c));let g=yield u(h);return g0(g)?S?yield s(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),tS(c,g.error),g):g});return function(_x157){return _ref73.apply(this,arguments)}}())}function g0(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Fn().name}function tS(e,t){e.dispatch(Ma({status:401,statusCode:401,message:t.message,type:t.name}))}function h0(e){return e.configuration.accessToken}m();d();f();p();function nS({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Gf({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(Jv(n.logger))})}function y0(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&zp()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function oS(e,t){let r={...e.reducers,configuration:Ot,version:Mh},n=v0({...e,reducers:r},t,Ot),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(gr({accessToken:o,environment:i,organizationId:a}));let s=y0(e.configuration,n.logger);return s&&n.dispatch(Qn(s)),n}function v0(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Zv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Ai(u.state,o)},get navigatorContext(){return fp(this.relay,o)}},c=S0(e,s,i),u={addReducers(h){i.containsAll(h)||(i.add(h),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(zn())},disableAnalytics(){c.dispatch(Hn())},get state(){return c.getState()},get relay(){return Ai(this.state,o)},get navigatorContext(){return fp(this.relay,o)},logger:a,store:c};return u}function S0(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=b0(e,t.logger,()=>t.navigatorContext);return nS({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function b0(e,t,r){let{renewAccessToken:n}=e.configuration,o=rS(t,n),i=Yv({getNavigatorContext:r});return[Qh,o,Xv(t),qh].concat(gd.middleware,i.middleware,e.middlewares||[])}m();d();f();p();var fS=_t(pS(),1);function mS(e){return(0,fS.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();f();p();function gS(e,t){let r=q0(e),n=At,o=L0(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function q0(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function L0(e){return e.preprocessRequest||ca}m();d();f();p();m();d();f();p();var hS={organizationId:X,accessToken:X,name:new H({required:!1,emptyAllowed:!1}),analytics:new ee({options:{required:!1},values:{enabled:new ue({required:!1}),originContext:new H({required:!1}),originLevel2:new H({required:!1}),originLevel3:new H({required:!1}),analyticsMode:new H({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new H({required:!1,url:!0}),trackingId:new H({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new H({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function yS(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var vS=new lt({...hS,pipeline:new H({required:!1,emptyAllowed:!0}),searchHub:Xe,locale:Xe,timezone:Xe});function Sp(){return{...yS(),searchHub:"default"}}var V0={debug:Da,pipeline:Yn,searchHub:uo,recommendation:so};function SS(e){let t=mS(e.loggerOptions);U0(e.configuration,t);let r=B0(e.configuration,t),n={...gS(e.configuration,t),apiClient:r},o={...e,reducers:V0},i=oS(o,n),{pipeline:a,searchHub:s,timezone:c,locale:u,proxyBaseUrl:h}=e.configuration;return i.dispatch(Lt({timezone:c,locale:u,proxyBaseUrl:h})),ie(a)||i.dispatch(Wn(a)),ie(s)||i.dispatch(co(s)),{...i,get state(){return i.state}}}function U0(e,t){try{vS.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function B0(e,t){return new da({logger:t,preprocessRequest:e.preprocessRequest||ca,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||pf,postprocessFacetSearchResponseMiddleware:ff,postprocessQuerySuggestResponseMiddleware:mf})}m();d();f();p();m();d();f();p();m();d();f();p();var G0=new ge({each:X,required:!0}),bS=(e,t)=>(j(e,X),na(t)?j(t,X):j(t,G0),{payload:{contextKey:e,contextValue:t}}),Rn=P("context/set",e=>{for(let[t,r]of Object.entries(e))bS(t,r);return{payload:e}}),In=P("context/add",e=>bS(e.contextKey,e.contextValue)),Tn=P("context/remove",e=>j(e,X));m();d();f();p();var Zc=Me(Qc(),e=>{e.addCase(Rn,(t,r)=>{t.contextValues=r.payload}).addCase(In,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Tn,(t,r)=>{delete t.contextValues[r.payload]}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();f();p();function Lr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();f();p();var $0=["caseId","caseNumber"],Q0={caseId:"caseContext",caseNumber:"caseContext"},Xi=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${Q0[t]} to set this value.}`)}};function bp(e){return $0.includes(e)}var H0=new lt({values:new ee({options:{required:!1}})});function AS(e,t={}){if(!K0(e))throw Dt;let r=Lr(e),{dispatch:n}=e,o=()=>e.state,i=am(e,H0,t.initialState,"buildContext");return i.values&&n(Rn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(Rn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?z0(n):W0(n))}}var z0=e=>({add(t,r){e(In({contextKey:t,contextValue:r}))},remove(t){e(Tn(t))}}),W0=e=>({add(t,r){if(bp(t))throw new Xi(t);e(In({contextKey:t,contextValue:r}))},remove(t){if(bp(t))throw new Xi(t);e(Tn(t))}});function K0(e){return e.addReducers({context:Zc}),!0}function wS(e,t){return AS(e,t)}m();d();f();p();m();d();f();p();var Lo=P("dictionaryFieldContext/set",e=>{let t=new ee({options:{required:!0}}),r=j(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ge({each:Je}),i=j(n,o).error;return i?{payload:e,error:i}:{payload:e}}),Vo=P("dictionaryFieldContext/add",e=>{let t=new ee({options:{required:!0},values:{field:Je,key:Je}});return j(e,t)}),Uo=P("dictionaryFieldContext/remove",e=>j(e,Je));m();d();f();p();var eu=Me(Hc(),e=>{e.addCase(Lo,(t,r)=>{t.contextValues=r.payload}).addCase(Vo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Uo,(t,r)=>{delete t.contextValues[r.payload]}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function xS(e){if(!Y0(e))throw Dt;let t=Lr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(Lo(o))},add(o,i){r(Vo({field:o,key:i}))},remove(o){r(Uo(o))}}}function Y0(e){return e.addReducers({dictionaryFieldContext:eu}),!0}m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();m();d();f();p();var Ji={value:X,numberOfResults:new te({min:0}),state:X};m();d();f();p();var Ie=X;var ek=new te({min:1,default:8,required:!1}),tk=new te({min:1,max:20,default:5,required:!1}),rk={desiredCount:tk,numberOfValues:ek},fue=P("automaticFacet/setOptions",e=>j(e,rk)),mue=P("automaticFacet/deselectAll",e=>j(e,Ie)),nk=X,CS=P("automaticFacet/toggleSelectValue",e=>j(e,{field:nk,selection:new ee({values:Ji})}));m();d();f();p();m();d();f();p();var ok={state:new Oe({required:!0}),numberOfResults:new te({required:!0,min:0}),value:new H({required:!0,emptyAllowed:!0}),path:new ge({required:!0,each:X}),moreValuesAvailable:new ue({required:!1})};function Ap(e){e.children.forEach(t=>{Ap(t)}),At({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},ok)}var Bo={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),delimitingCharacter:new H({required:!1,emptyAllowed:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),basePath:new ge({required:!1,each:X}),filterByBasePath:new ue({required:!1})};var Pue=P("categoryFacet/register",e=>j(e,Bo)),ES=P("categoryFacet/toggleSelectValue",e=>{try{return At(e.facetId,X),Ap(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),RS=P("categoryFacet/deselectAll",e=>j(e,Bo.facetId)),Nue=P("categoryFacet/updateNumberOfValues",e=>j(e,{facetId:Bo.facetId,numberOfValues:Bo.numberOfValues})),Fue=P("categoryFacet/updateSortCriterion",e=>j(e,{facetId:Bo.facetId,criterion:new Oe})),Due=P("categoryFacet/updateBasePath",e=>j(e,{facetId:Bo.facetId,basePath:new ge({each:X})}));m();d();f();p();m();d();f();p();var Zi={facetId:Ie,captions:new ee({options:{required:!1}}),numberOfValues:new te({required:!1,min:1}),query:new H({required:!1,emptyAllowed:!0})};var ik={path:new ge({required:!0,each:X}),displayValue:Je,rawValue:Je,count:new te({required:!0,min:0})},IS=P("categoryFacet/selectSearchResult",e=>j(e,{facetId:Ie,value:new ee({values:ik})})),Zue=P("categoryFacetSearch/register",e=>j(e,Zi));m();d();f();p();var TS={facetId:Ie,value:new ee({values:{displayValue:Je,rawValue:Je,count:new te({required:!0,min:0})}})},lle=P("facetSearch/register",e=>j(e,Zi)),dle=P("facetSearch/update",e=>j(e,Zi)),_S=P("facetSearch/toggleSelectValue",e=>j(e,TS)),kS=P("facetSearch/toggleExcludeValue",e=>j(e,TS));m();d();f();p();m();d();f();p();var vle=new H({regex:/^[a-zA-Z0-9-_]+$/}),Sle=new H({required:!0}),ble=new ge({each:new H}),Ale=new H,wle=new ue,xle=new ue,Cle=new te({min:0}),ak=new te({min:1}),Ele=new ue({required:!0}),sk=new ee,ck=new H,uk={captions:sk,numberOfValues:ak,query:ck},Rle=new ee({values:uk}),OS=new ee({options:{required:!1},values:{type:new H({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ge({required:!0,max:25,each:new H({emptyAllowed:!1,required:!0})})}}),Ile=new ue,PS=new ge({min:1,max:25,required:!1,each:new H({emptyAllowed:!1,required:!0})});var lk={facetId:Ie,field:new H({required:!0,emptyAllowed:!0}),tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),resultsMustMatch:new Oe({required:!1}),allowedValues:OS,customSort:PS},Lle=P("facet/register",e=>j(e,lk)),NS=P("facet/toggleSelectValue",e=>j(e,{facetId:Ie,selection:new ee({values:Ji})})),FS=P("facet/toggleExcludeValue",e=>j(e,{facetId:Ie,selection:new ee({values:Ji})})),tu=P("facet/deselectAll",e=>j(e,Ie)),Vle=P("facet/updateSortCriterion",e=>j(e,{facetId:Ie,criterion:new Oe({required:!0})})),Ule=P("facet/updateNumberOfValues",e=>j(e,{facetId:Ie,numberOfValues:new te({required:!0,min:1})})),Ble=P("facet/updateIsFieldExpanded",e=>j(e,{facetId:Ie,isFieldExpanded:new ue({required:!0})})),Gle=P("facet/updateFreezeCurrentValues",e=>j(e,{facetId:Ie,freezeCurrentValues:new ue({required:!0})}));m();d();f();p();m();d();f();p();function MS(e){let t=DS(e.start,e),r=DS(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function DS(e,t){let{dateFormat:r}=t;return rh(e)?(rd(e),Zg(e)):typeof e=="string"&&br(e)?(rd(e),e):(Kg(e,r),gs(go(e,r)))}m();d();f();p();var jS=P("rangeFacet/updateSortCriterion",e=>j(e,{facetId:Ie,criterion:new Oe({required:!0})}));m();d();f();p();var ru={state:X,start:new te({required:!0}),end:new te({required:!0}),endInclusive:new ue({required:!0}),numberOfResults:new te({required:!0,min:0})},nu={start:X,end:X,endInclusive:new ue({required:!0}),state:X,numberOfResults:new te({required:!0,min:0})};var dk={start:X,end:X,endInclusive:new ue({required:!0}),state:X},pk={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),currentValues:new ge({required:!1,each:new ee({values:dk})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),rangeAlgorithm:new Oe({required:!1})};function qS(e){return br(e)?Ti(e):e}function LS(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=MS(t);if(go(qS(r)).isAfter(go(qS(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var _de=P("dateFacet/register",e=>{try{return At(e,pk),LS(e),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),VS=P("dateFacet/toggleSelectValue",e=>j(e,{facetId:Ie,selection:new ee({values:nu})})),US=P("dateFacet/toggleExcludeValue",e=>j(e,{facetId:Ie,selection:new ee({values:nu})})),BS=P("dateFacet/updateFacetValues",e=>{try{return At(e,{facetId:Ie,values:new ge({each:new ee({values:nu})})}),LS({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}});m();d();f();p();var fk={state:X,start:new te({required:!0}),end:new te({required:!0}),endInclusive:new ue({required:!0})},mk={facetId:Ie,field:X,tabs:new ee({options:{required:!1},values:{included:new ge({each:new H}),excluded:new ge({each:new H})}}),activeTab:new H({required:!1}),currentValues:new ge({required:!1,each:new ee({values:fk})}),generateAutomaticRanges:new ue({required:!0}),filterFacetCount:new ue({required:!1}),injectionDepth:new te({required:!1,min:0}),numberOfValues:new te({required:!1,min:1}),sortCriteria:new Oe({required:!1}),rangeAlgorithm:new Oe({required:!1})};function GS(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Bde=P("numericFacet/register",e=>{try{return j(e,mk),GS(e),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}}),$S=P("numericFacet/toggleSelectValue",e=>j(e,{facetId:Ie,selection:new ee({values:ru})})),QS=P("numericFacet/toggleExcludeValue",e=>j(e,{facetId:Ie,selection:new ee({values:ru})})),HS=P("numericFacet/updateFacetValues",e=>{try{return At(e,{facetId:Ie,values:new ge({each:new ee({values:ru})})}),GS({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Zt(t)}}});var zS=Me(Ki(),e=>{e.addCase(Lc,(t,r)=>{let n=wp(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ea(n,o)}).addCase(Vc,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(xs,t=>{t.firstResult=0}).addCase(Uc,(t,r)=>{let n=r.payload;t.firstResult=ea(n,t.numberOfResults)}).addCase(Mo,(t,r)=>{let n=r.payload;t.firstResult=ea(n,t.numberOfResults)}).addCase(Gc,t=>{let r=wp(t),n=Math.max(r-1,1);t.firstResult=ea(n,t.numberOfResults)}).addCase(Bc,t=>{let r=wp(t),n=hk(t),o=Math.min(r+1,n);t.firstResult=ea(o,t.numberOfResults)}).addCase(mt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(hr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Yc.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(zv.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(tu,t=>{at(t)}).addCase(US,t=>{at(t)}).addCase(FS,t=>{at(t)}).addCase(QS,t=>{at(t)}).addCase(kS,t=>{at(t)}).addCase(NS,t=>{at(t)}).addCase(RS,t=>{at(t)}).addCase(ES,t=>{at(t)}).addCase(IS,t=>{at(t)}).addCase(VS,t=>{at(t)}).addCase($S,t=>{at(t)}).addCase(Dc,t=>{at(t)}).addCase(BS,t=>{at(t)}).addCase(HS,t=>{at(t)}).addCase(_S,t=>{at(t)}).addCase(CS,t=>{at(t)})});function at(e){e.firstResult=Ki().firstResult}function wp(e){let{firstResult:t,numberOfResults:r}=e;return yk(t,r)}function hk(e){let{totalCountFiltered:t,numberOfResults:r}=e;return vk(t,r)}function ea(e,t){return(e-1)*t}function yk(e,t){return Math.round(e/t)+1}function vk(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function xp(e){return e.addReducers({pagination:zS}),{nextPage:Bc,previousPage:Gc,registerNumberOfResults:Lc,registerPage:Uc,updateNumberOfResults:Vc,updatePage:Mo}}var Sk=new lt({id:new H({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new te({min:0})});function WS(e,t={}){if(!bk(e))throw Dt;let r=Lr(e),{dispatch:n}=e,o=()=>e.state,i=sm(e,Sk,t.options,"buildRecommendationList");return i.id!==""&&n(ao({id:i.id})),i.numberOfRecommendations&&n(xp(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Sr())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function bk(e){return e.addReducers({recommendation:so,configuration:Ot}),!0}m();d();f();p();m();d();f();p();function KS(e,t,r){if(!Ak(e))throw Dt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:ia(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function Ak(e){return e.addReducers({configuration:Ot}),!0}function YS(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(us(t.options.result)))};return KS(e,t,()=>{n()})}m();d();f();p();m();d();f();p();m();d();f();p();var Vr=()=>new H({required:!1,emptyAllowed:!0}),ou=P("advancedSearchQueries/update",e=>j(e,{aq:Vr(),cq:Vr(),lq:Vr(),dq:Vr()})),iu=P("advancedSearchQueries/register",e=>j(e,{aq:Vr(),cq:Vr(),lq:Vr(),dq:Vr()}));var XS=Me(Nr(),e=>{e.addCase(ou,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;ze(n)||(t.aq=n,t.aqWasSet=!0),ze(o)||(t.cq=o,t.cqWasSet=!0),ze(i)||(t.lq=i,t.lqWasSet=!0),ze(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(iu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;ze(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),ze(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),ze(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),ze(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(mt.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(hr,(t,r)=>{let{aq:n,cq:o}=r.payload;ze(n)||(t.aq=n,t.aqWasSet=!0),ze(o)||(t.cq=o,t.cqWasSet=!0)})});function wk(e){return e.addReducers({advancedSearchQueries:XS}),{updateAdvancedSearchQueries:ou,registerAdvancedSearchQueries:iu}}m();d();f();p();function xk(e){return e.addReducers({configuration:Ot}),{disableAnalytics:Hn,enableAnalytics:zn,setOriginLevel2:ka,setOriginLevel3:Oa,updateAnalyticsConfiguration:Qn,updateBasicConfiguration:gr}}m();d();f();p();function Ck(e){return e.addReducers({configuration:Ot,pipeline:Yn,searchHub:uo}),{updateSearchConfiguration:Lt}}m();d();f();p();function Ek(e){return e.addReducers({context:Zc}),{addContext:In,removeContext:Tn,setContext:Rn}}m();d();f();p();function Rk(e){return e.addReducers({debug:Da}),{disableDebug:Na,enableDebug:Pa}}m();d();f();p();function Ik(e){return e.addReducers({dictionaryFieldContext:eu}),{addContext:Vo,removeContext:Uo,setContext:Lo}}m();d();f();p();m();d();f();p();m();d();f();p();var Tk={collectionField:new H({emptyAllowed:!1,required:!1}),parentField:new H({emptyAllowed:!1,required:!1}),childField:new H({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new te({min:0,required:!1})},JS=P("folding/register",e=>j(e,Tk)),dme=Ee("folding/loadCollection",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield xr(i):ho(i,o),s=yield n.search({...a,q:_k(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return dt(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x158,_x159){return _ref74.apply(this,arguments)}}());function _k(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();f();p();var ZS=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();f();p();var Go=P("fields/registerFieldsToInclude",e=>j(e,_a)),au=P("fields/fetchall/enable"),su=P("fields/fetchall/disable"),cu=Ee("fields/fetchDescription",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:c}=o.configuration.search,u=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:c??dr(s,a)});return dt(u)?n(u.error):u.success.fields});return function(_x160,_x161){return _ref75.apply(this,arguments)}}());m();d();f();p();var uu=["author","language","urihash","objecttype","collection","source","permanentid"],Cp=[...uu,"date","filetype","parents"],eb=[...Cp,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],tb=()=>({fieldsToInclude:uu,fetchAllFields:!1,fieldsDescription:[]});var lu=Me(tb(),e=>e.addCase(Go,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(au,t=>{t.fetchAllFields=!0}).addCase(su,t=>{t.fetchAllFields=!1}).addCase(cu.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(JS,(t,{payload:r})=>{let n=ZS().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function kk(e){return e.addReducers({fields:lu}),{registerFieldsToInclude:Go,enableFetchAllFields:au,disableFetchAllFields:su,fetchFieldsDescription:cu}}m();d();f();p();function Ok(e){return e.addReducers({pipeline:Yn}),{setPipeline:Wn}}m();d();f();p();function Pk(e){return e.addReducers({recommendation:so}),{getRecommendations:Sr,setRecommendationId:ao}}m();d();f();p();function Nk(e){return e.addReducers({}),{logRecommendationOpen:us}}m();d();f();p();m();d();f();p();var Fk=new lt({content:new Oe({required:!0}),conditions:new Oe({required:!0}),priority:new te({required:!1,default:0,min:0}),fields:new ge({required:!1,each:X})});function rb(){let e=[],t=r=>{let n=Fk.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new Xo("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function nb(e){if(!Dk(e))throw Dt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=rb();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Go(i))},selectTemplate:r,selectLinkTemplate:n}}function Dk(e){return e.addReducers({fields:lu}),!0}m();d();f();p();function Mk(e){return e.addReducers({searchHub:uo}),{setSearchHub:co}}/**
42
42
  * @license
43
43
  *
44
44
  * Copyright 2026 Coveo Solutions Inc.
@@ -71,4 +71,4 @@ fast-json-patch/module/duplex.mjs:
71
71
  *)
72
72
  */if(__exports!=exports)module.exports=exports;return module.exports});
73
73
 
74
- window.coveoQuanticVersion = '3.36.8';
74
+ window.coveoQuanticVersion = '3.36.9';