@visma-swno/gaia-chat-ui 2.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +27 -5
  3. package/dist/app/app.d.ts +41 -0
  4. package/dist/app/app.styles.d.ts +2 -0
  5. package/dist/{src/app → app}/controllers/error-controller.d.ts +0 -1
  6. package/dist/{src/app → app}/localization.d.ts +1 -2
  7. package/dist/auth/auth-errors.d.ts +17 -0
  8. package/dist/auth/auth-provider.d.ts +10 -0
  9. package/dist/auth/strategies/base-strategy.d.ts +21 -0
  10. package/dist/auth/strategies/null-auth-strategy.d.ts +8 -0
  11. package/dist/auth/strategies/visitor-token-strategy.d.ts +9 -0
  12. package/dist/auth/strategies/visma-token-strategy.d.ts +9 -0
  13. package/dist/auth/strategy-factory.d.ts +13 -0
  14. package/dist/auth/token-cache.d.ts +17 -0
  15. package/dist/auth/token-parser.d.ts +6 -0
  16. package/dist/auth/types.d.ts +17 -0
  17. package/dist/components/app-header/app-header.d.ts +25 -0
  18. package/dist/components/app-header/app-header.styles.d.ts +2 -0
  19. package/dist/components/avatar/avatar.d.ts +17 -0
  20. package/dist/components/avatar/avatar.styles.d.ts +2 -0
  21. package/dist/components/button/button.d.ts +16 -0
  22. package/dist/components/button/button.styles.d.ts +2 -0
  23. package/dist/components/conversation/conversation.d.ts +39 -0
  24. package/dist/components/conversation/conversation.styles.d.ts +2 -0
  25. package/dist/components/conversation/message-renderers.d.ts +39 -0
  26. package/dist/components/conversation/scroll-controller.d.ts +47 -0
  27. package/dist/components/disclaimer/disclaimer.d.ts +10 -0
  28. package/dist/components/disclaimer/disclaimer.styles.d.ts +2 -0
  29. package/dist/components/error-notification/error-notification.d.ts +16 -0
  30. package/dist/components/error-notification/error-notification.styles.d.ts +2 -0
  31. package/dist/components/feedback/feedback.d.ts +26 -0
  32. package/dist/components/feedback/feedback.styles.d.ts +2 -0
  33. package/dist/components/icon/icon-library.d.ts +40 -0
  34. package/dist/components/icon/icon.d.ts +19 -0
  35. package/dist/components/icon/icon.styles.d.ts +2 -0
  36. package/dist/components/markdown-content/markdown-content.d.ts +11 -0
  37. package/dist/components/markdown-content/markdown-content.styles.d.ts +2 -0
  38. package/dist/components/message/message.d.ts +12 -0
  39. package/dist/components/message/message.styles.d.ts +2 -0
  40. package/dist/components/message-composer/message-composer.d.ts +52 -0
  41. package/dist/components/message-composer/message-composer.styles.d.ts +2 -0
  42. package/dist/components/message-composer/resize-controller.d.ts +11 -0
  43. package/dist/components/popover/popover.d.ts +45 -0
  44. package/dist/components/popover/popover.styles.d.ts +2 -0
  45. package/dist/components/shared/base-element.d.ts +6 -0
  46. package/dist/components/shared/watch.d.ts +11 -0
  47. package/dist/components/source-list/source-list.d.ts +15 -0
  48. package/dist/components/source-list/source-list.styles.d.ts +2 -0
  49. package/dist/components/spinner/spinner.d.ts +10 -0
  50. package/dist/components/spinner/spinner.styles.d.ts +2 -0
  51. package/dist/components/typing-indicator/typing-indicator.d.ts +10 -0
  52. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +2 -0
  53. package/dist/components/welcome-message/welcome-message.d.ts +15 -0
  54. package/dist/components/welcome-message/welcome-message.styles.d.ts +2 -0
  55. package/dist/core/context/app-context.d.ts +49 -0
  56. package/dist/{src/core → core}/effects/bootstrap-effect.d.ts +5 -2
  57. package/dist/{src/core → core}/effects/conversation-effect.d.ts +5 -2
  58. package/dist/{src/core → core}/effects/feedback-effect.d.ts +5 -3
  59. package/dist/{src/core → core}/effects/stream-effect.d.ts +9 -3
  60. package/dist/{src/core → core}/effects/stream-event-router.d.ts +0 -1
  61. package/dist/core/effects/support-effect.d.ts +33 -0
  62. package/dist/{src/core → core}/effects/task-runner.d.ts +0 -1
  63. package/dist/{src/core → core}/errors/app-error.d.ts +0 -1
  64. package/dist/{src/core → core}/events/public/app.d.ts +0 -21
  65. package/dist/{src/core → core}/events/transport/sse.d.ts +0 -1
  66. package/dist/{src/core → core}/events/transport/ws.d.ts +0 -1
  67. package/dist/{src/core → core}/state/index.d.ts +0 -1
  68. package/dist/{src/core → core}/state/root-reducer.d.ts +0 -1
  69. package/dist/{src/core → core}/state/slices/config-slice.d.ts +0 -1
  70. package/dist/{src/core → core}/state/slices/messages-slice.d.ts +0 -1
  71. package/dist/{src/core → core}/state/slices/session-slice.d.ts +0 -1
  72. package/dist/{src/core → core}/state/slices/ui-slice.d.ts +0 -1
  73. package/dist/{src/core → core}/state/store.d.ts +0 -1
  74. package/dist/core/types/host-context.d.ts +49 -0
  75. package/dist/{src/core → core}/types.d.ts +0 -1
  76. package/dist/{src/core → core}/utils/message-factory.d.ts +0 -1
  77. package/dist/{da-CIz_JTpK.js → da-BhU73DwX.js} +10 -8
  78. package/dist/fi-CWA_79BI.js +47 -0
  79. package/dist/{src/generated → generated}/locale-codes.d.ts +2 -3
  80. package/dist/{src/generated → generated}/locales/da.d.ts +6 -4
  81. package/dist/generated/locales/fi.d.ts +43 -0
  82. package/dist/{src/generated → generated}/locales/nb.d.ts +6 -4
  83. package/dist/generated/locales/nl.d.ts +43 -0
  84. package/dist/{src/generated → generated}/locales/sv.d.ts +6 -4
  85. package/dist/index-DCCkNOcP.js +7847 -0
  86. package/dist/index.d.ts +3 -2
  87. package/dist/index.es.js +1 -2
  88. package/dist/index.umd.js +500 -570
  89. package/dist/infra/http/api-client.d.ts +13 -0
  90. package/dist/{src/infra → infra}/http/api-error.d.ts +0 -1
  91. package/dist/infra/http/auth-header-strategy.d.ts +14 -0
  92. package/dist/{src/infra → infra}/http/guards.d.ts +0 -1
  93. package/dist/{src/infra → infra}/signalr/signalr-error.d.ts +0 -1
  94. package/dist/{src/infra → infra}/sse/sse.d.ts +0 -1
  95. package/dist/{src/infra → infra}/sse/stream-error.d.ts +0 -1
  96. package/dist/{src/infra → infra}/storage/bootstrap-config-storage.d.ts +0 -1
  97. package/dist/{src/infra → infra}/storage/conversation-id-storage.d.ts +0 -1
  98. package/dist/{src/infra → infra}/storage/types.d.ts +0 -1
  99. package/dist/{src/infra → infra}/storage/visitor-token-storage.d.ts +0 -1
  100. package/dist/{nb-BRpEPPS7.js → nb-BWt8rKAf.js} +10 -8
  101. package/dist/nl-dkWq4g54.js +47 -0
  102. package/dist/{src/services → services}/bootstrap-service.d.ts +2 -2
  103. package/dist/{src/services → services}/chat-service.d.ts +2 -1
  104. package/dist/{src/services → services}/feedback-service.d.ts +0 -1
  105. package/dist/services/support-service.d.ts +7 -0
  106. package/dist/styles/host.styles.d.ts +2 -0
  107. package/dist/{sv-DMfrf_18.js → sv-Dyhy3RXT.js} +10 -8
  108. package/package.json +43 -20
  109. package/custom-elements.json +0 -261
  110. package/dist/da-CIz_JTpK.js.map +0 -1
  111. package/dist/index-CEIcDKQq.js +0 -6286
  112. package/dist/index-CEIcDKQq.js.map +0 -1
  113. package/dist/index.es.js.map +0 -1
  114. package/dist/index.umd.js.map +0 -1
  115. package/dist/nb-BRpEPPS7.js.map +0 -1
  116. package/dist/package.json.d.ts +0 -89
  117. package/dist/src/app/app.d.ts +0 -52
  118. package/dist/src/app/app.d.ts.map +0 -1
  119. package/dist/src/app/controllers/error-controller.d.ts.map +0 -1
  120. package/dist/src/app/localization.d.ts.map +0 -1
  121. package/dist/src/app/middlewares/middleware.d.ts +0 -12
  122. package/dist/src/app/middlewares/middleware.d.ts.map +0 -1
  123. package/dist/src/auth/access-token-provider.d.ts +0 -27
  124. package/dist/src/auth/access-token-provider.d.ts.map +0 -1
  125. package/dist/src/auth/auth-errors.d.ts +0 -13
  126. package/dist/src/auth/auth-errors.d.ts.map +0 -1
  127. package/dist/src/auth/strategies/strategy.d.ts +0 -38
  128. package/dist/src/auth/strategies/strategy.d.ts.map +0 -1
  129. package/dist/src/auth/strategies/visitor-token-strategy.d.ts +0 -14
  130. package/dist/src/auth/strategies/visitor-token-strategy.d.ts.map +0 -1
  131. package/dist/src/auth/strategies/visma-token-strategy.d.ts +0 -10
  132. package/dist/src/auth/strategies/visma-token-strategy.d.ts.map +0 -1
  133. package/dist/src/auth/strategy-factory.d.ts +0 -10
  134. package/dist/src/auth/strategy-factory.d.ts.map +0 -1
  135. package/dist/src/components/base-tw-element.d.ts +0 -5
  136. package/dist/src/components/base-tw-element.d.ts.map +0 -1
  137. package/dist/src/components/composer.d.ts +0 -21
  138. package/dist/src/components/composer.d.ts.map +0 -1
  139. package/dist/src/components/error-message.d.ts +0 -9
  140. package/dist/src/components/error-message.d.ts.map +0 -1
  141. package/dist/src/components/feedback-form.d.ts +0 -14
  142. package/dist/src/components/feedback-form.d.ts.map +0 -1
  143. package/dist/src/components/menu.d.ts +0 -11
  144. package/dist/src/components/menu.d.ts.map +0 -1
  145. package/dist/src/components/message/assistant.d.ts +0 -14
  146. package/dist/src/components/message/assistant.d.ts.map +0 -1
  147. package/dist/src/components/message/base.d.ts +0 -14
  148. package/dist/src/components/message/base.d.ts.map +0 -1
  149. package/dist/src/components/message/index.d.ts +0 -5
  150. package/dist/src/components/message/index.d.ts.map +0 -1
  151. package/dist/src/components/message/operator.d.ts +0 -7
  152. package/dist/src/components/message/operator.d.ts.map +0 -1
  153. package/dist/src/components/message/system.d.ts +0 -11
  154. package/dist/src/components/message/system.d.ts.map +0 -1
  155. package/dist/src/components/message/user.d.ts +0 -7
  156. package/dist/src/components/message/user.d.ts.map +0 -1
  157. package/dist/src/components/message-list.d.ts +0 -25
  158. package/dist/src/components/message-list.d.ts.map +0 -1
  159. package/dist/src/components/shared/markdown.d.ts +0 -2
  160. package/dist/src/components/shared/markdown.d.ts.map +0 -1
  161. package/dist/src/components/thinking-indicator.d.ts +0 -5
  162. package/dist/src/components/thinking-indicator.d.ts.map +0 -1
  163. package/dist/src/components/welcome-message.d.ts +0 -11
  164. package/dist/src/components/welcome-message.d.ts.map +0 -1
  165. package/dist/src/core/effects/bootstrap-effect.d.ts.map +0 -1
  166. package/dist/src/core/effects/conversation-effect.d.ts.map +0 -1
  167. package/dist/src/core/effects/feedback-effect.d.ts.map +0 -1
  168. package/dist/src/core/effects/stream-effect.d.ts.map +0 -1
  169. package/dist/src/core/effects/stream-event-router.d.ts.map +0 -1
  170. package/dist/src/core/effects/support-effect.d.ts +0 -25
  171. package/dist/src/core/effects/support-effect.d.ts.map +0 -1
  172. package/dist/src/core/effects/task-runner.d.ts.map +0 -1
  173. package/dist/src/core/errors/app-error.d.ts.map +0 -1
  174. package/dist/src/core/events/internal/commands.d.ts +0 -48
  175. package/dist/src/core/events/internal/commands.d.ts.map +0 -1
  176. package/dist/src/core/events/internal/index.d.ts +0 -3
  177. package/dist/src/core/events/internal/index.d.ts.map +0 -1
  178. package/dist/src/core/events/internal/utils.d.ts +0 -17
  179. package/dist/src/core/events/internal/utils.d.ts.map +0 -1
  180. package/dist/src/core/events/public/app.d.ts.map +0 -1
  181. package/dist/src/core/events/transport/sse.d.ts.map +0 -1
  182. package/dist/src/core/events/transport/ws.d.ts.map +0 -1
  183. package/dist/src/core/state/index.d.ts.map +0 -1
  184. package/dist/src/core/state/root-reducer.d.ts.map +0 -1
  185. package/dist/src/core/state/slices/config-slice.d.ts.map +0 -1
  186. package/dist/src/core/state/slices/messages-slice.d.ts.map +0 -1
  187. package/dist/src/core/state/slices/session-slice.d.ts.map +0 -1
  188. package/dist/src/core/state/slices/ui-slice.d.ts.map +0 -1
  189. package/dist/src/core/state/store.d.ts.map +0 -1
  190. package/dist/src/core/types.d.ts.map +0 -1
  191. package/dist/src/core/utils/message-factory.d.ts.map +0 -1
  192. package/dist/src/generated/locale-codes.d.ts.map +0 -1
  193. package/dist/src/generated/locales/da.d.ts.map +0 -1
  194. package/dist/src/generated/locales/nb.d.ts.map +0 -1
  195. package/dist/src/generated/locales/sv.d.ts.map +0 -1
  196. package/dist/src/index.d.ts +0 -3
  197. package/dist/src/index.d.ts.map +0 -1
  198. package/dist/src/infra/http/api-client.d.ts +0 -16
  199. package/dist/src/infra/http/api-client.d.ts.map +0 -1
  200. package/dist/src/infra/http/api-error.d.ts.map +0 -1
  201. package/dist/src/infra/http/guards.d.ts.map +0 -1
  202. package/dist/src/infra/signalr/signalr-error.d.ts.map +0 -1
  203. package/dist/src/infra/sse/sse.d.ts.map +0 -1
  204. package/dist/src/infra/sse/stream-error.d.ts.map +0 -1
  205. package/dist/src/infra/storage/bootstrap-config-storage.d.ts.map +0 -1
  206. package/dist/src/infra/storage/conversation-id-storage.d.ts.map +0 -1
  207. package/dist/src/infra/storage/types.d.ts.map +0 -1
  208. package/dist/src/infra/storage/visitor-token-storage.d.ts.map +0 -1
  209. package/dist/src/services/bootstrap-service.d.ts.map +0 -1
  210. package/dist/src/services/chat-service.d.ts.map +0 -1
  211. package/dist/src/services/feedback-service.d.ts.map +0 -1
  212. package/dist/sv-DMfrf_18.js.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,613 +1,543 @@
1
- (function(C,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/live.js"),require("lit/directives/unsafe-svg.js"),require("lit/directives/unsafe-html.js"),require("lit/directives/repeat.js"),require("lit/directives/map.js"),require("lit/directives/ref.js"),require("lit/directives/guard.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/live.js","lit/directives/unsafe-svg.js","lit/directives/unsafe-html.js","lit/directives/repeat.js","lit/directives/map.js","lit/directives/ref.js","lit/directives/guard.js"],g):(C=typeof globalThis<"u"?globalThis:C||self,g(C["gaia-chat-ui"]={},C.Lit,C.decorators_js,C.live_js,C.unsafeSvg_js,C.unsafeHtml_js,C.repeat_js,C.map_js,C.ref_js,C.guard_js))})(this,(function(C,g,w,Xn,P,Kr,Jr,Qr,es,ts){"use strict";function Zn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var qt={exports:{}};/*!
2
- Copyright (c) 2018 Jed Watson.
3
- Licensed under the MIT License (MIT), see
4
- http://jedwatson.github.io/classnames
5
- */var rs;function Kn(){return rs||(rs=1,(function(r){(function(){var e={}.hasOwnProperty;function t(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=s(o,n(a)))}return o}function n(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return t.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)e.call(o,a)&&o[a]&&(i=s(i,a));return i}function s(o,i){return i?o?o+" "+i:o+i:o}r.exports?(t.default=t,r.exports=t):window.classNames=t})()})(qt)),qt.exports}var Jn=Kn();const _e=Zn(Jn);class Qn{constructor(e={}){this.listeners=e,this.strategy=null,this.kind=null,this.expiringLeadMs=null}setStrategy(e,t){this.kind=e,this.strategy=t,this.strategy.setListeners(this.listeners),this.expiringLeadMs!==null&&this.strategy.setExpiringBufferMs(this.expiringLeadMs),this.strategy.init()}get strategyKind(){return this.kind}setExpiringLeadMs(e){const t=Number.isFinite(e)&&e>=0?Math.floor(e):1e4;this.expiringLeadMs=t,this.strategy?.setExpiringBufferMs(t)}getIdentifier(){return this.requireStrategy().getIdentifier()}async getAccessToken(){return this.requireStrategy().getAccessToken()}async clear(){await this.strategy?.clear()}requireStrategy(){if(!this.strategy)throw new Error("Auth not configured");return this.strategy}}class xe extends Error{constructor(e,t,n,s,o,i){super(e),this.status=t,this.url=n,this.innerError=s,this.bodyText=o,this.problem=i,this.name="ApiError"}get isUnauthorized(){return this.status===401}get isForbidden(){return this.status===403}get isNotFound(){return this.status===404}get isServerError(){return this.status>=500}get isNetworkError(){return this.status===0}}async function eo(r){let e,t;try{e=await r.clone().text()}catch{e=void 0}try{const s=r.headers.get("content-type")||"";(s.includes("application/problem+json")||s.includes("application/json"))&&(t=JSON.parse(e||"{}"))}catch{t=void 0}const n=t?.detail||t?.title||e&&e.slice(0,200)||`HTTP ${r.status} ${r.statusText}`;return new xe(n,r.status,r.url,void 0,e,t)}async function ss(r){if(!r.ok)throw await eo(r)}function Wt(r){if(!r.body)throw new xe("No response body",r.status,r.url);return r.body}async function Vt(r){try{return await r.json()}catch(e){throw new xe("Failed to parse response body as JSON",r.status,r.url,e)}}class to{constructor(){this.key="gaia-chat:visitor-token"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class qe extends Error{constructor(e){super(e),this.name="AuthError"}}class ns extends qe{constructor(){super("Token expired"),this.name="TokenExpiredError"}}class We extends qe{constructor(){super("Token invalid"),this.name="TokenInvalidError"}}class Ve extends qe{constructor(){super("Token required"),this.name="TokenRequiredError"}}class Ge extends Error{}Ge.prototype.name="InvalidTokenError";function ro(r){return decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function so(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ro(e)}catch{return atob(e)}}function os(r,e){if(typeof r!="string")throw new Ge("Invalid token specified: must be a string");e||(e={});const t=e.header===!0?0:1,n=r.split(".")[t];if(typeof n!="string")throw new Ge(`Invalid token specified: missing part #${t+1}`);let s;try{s=so(n)}catch(o){throw new Ge(`Invalid token specified: invalid base64 for part #${t+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new Ge(`Invalid token specified: invalid json for part #${t+1} (${o.message})`)}}class is{constructor(e=1e4){this._token=null,this.expiringTimer=null,this.expiredTimer=null,this.hasEmittedExpiring=!1,this.hasEmittedExpired=!1,this.listeners={},this._expiringBufferMs=e}init(){this.onInit()}clear(){return this.token=null,this.onClear()}setListeners(e){this.listeners=e}async getIdentifier(){const e=await this.getAccessToken(!0);if(!e)throw new Ve;return os(e).sub}setExpiringBufferMs(e){const t=Number.isFinite(e)&&e>=0?Math.floor(e):12e4;this._expiringBufferMs=t,this.armTimers()}get expiringBufferMs(){return this._expiringBufferMs}set token(e){typeof e=="string"?this._token=this.getDecodedAccessToken(e):this._token=e,this.hasEmittedExpiring=!1,this.hasEmittedExpired=!1,this.listeners.onUpdated?.(this._token?.exp??null,e),this.armTimers()}get token(){return this._token?.value??null}isExpiring(){if(!this._token?.exp)throw new Ve;return this._token.exp<Date.now()+this.expiringBufferMs}isExpired(){if(!this._token?.exp)throw new Ve;return this._token.exp<Date.now()}clearTimers(){this.expiringTimer&&clearTimeout(this.expiringTimer),this.expiredTimer&&clearTimeout(this.expiredTimer),this.expiringTimer=null,this.expiredTimer=null}armTimers(){if(this.clearTimers(),!this._token?.exp)return;const e=Date.now(),t=this._token.exp-e;if(t<=0)return this.emitExpired();t<=this.expiringBufferMs&&!this.hasEmittedExpiring&&this.emitExpiring(t),this.hasEmittedExpiring||(this.expiringTimer=window.setTimeout(()=>{this._token?.exp&&this.emitExpiring(this._token.exp-Date.now())},Math.max(0,t-this.expiringBufferMs))),this.expiredTimer=window.setTimeout(()=>{this.emitExpired()},Math.max(0,t))}emitExpiring(e){this.hasEmittedExpiring||!this._token?.exp||(this.hasEmittedExpiring=!0,this.listeners.onExpiring?.(this._token.exp,e))}emitExpired(){this.hasEmittedExpired||!this._token?.exp||(this.hasEmittedExpired=!0,this.listeners.onExpired?.(this._token.exp))}getDecodedAccessToken(e){try{const t=os(e);return{value:e,exp:t.exp?t.exp*1e3:void 0}}catch{throw new We}}}class no extends is{constructor(e,t=new to,n=fetch){super(),this.baseUrl=e,this.storage=t,this.fetchImpl=n}onInit(){try{this.token=this.storage.load()}catch(e){if(e instanceof We)this.storage.clear(),this.token=null;else throw e}}async getAccessToken(e){if(!this.token){const t=await this.requestVisitorToken();return this.storage.save(t),this.token=t,this.token}if(this.isExpiring()&&!e){const t=await this.refreshVisitorToken();this.storage.save(t),this.token=t}return this.token}async onClear(){this.storage.clear()}async requestVisitorToken(){const e=await(this.fetchImpl??fetch)(`${this.baseUrl}/api/v1/auth/visitor`,{method:"GET",headers:{"Content-Type":"application/json"}});return ss(e),(await Vt(e)).accessToken}async refreshVisitorToken(){return await this.requestVisitorToken()}}class oo extends is{constructor(e=null){super(),this.initialToken=e}onInit(){try{this.token=this.initialToken}catch(e){if(e instanceof We)this.token=null;else throw e}}async getAccessToken(e){if(!this.token)throw new Ve;if(this.isExpired()&&!e)throw new ns;return this.token}setToken(e){try{this.token=e}catch(t){if(t instanceof We){this.token=null;return}throw t}}async onClear(){}}function Gt(r,e){return e?{kind:"visma",strategy:new oo(e)}:{kind:"visitor",strategy:new no(r)}}/**
6
- * @license
7
- * Copyright 2021 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const Yt="lit-localize-status";/**
10
- * @license
11
- * Copyright 2021 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const ft=(r,...e)=>({strTag:!0,strings:r,values:e}),io=r=>typeof r!="string"&&"strTag"in r,as=(r,e,t)=>{let n=r[0];for(let s=1;s<r.length;s++)n+=e[t?t[s-1]:s-1],n+=r[s];return n};/**
14
- * @license
15
- * Copyright 2021 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */const ls=(r=>io(r)?as(r.strings,r.values):r);let y=ls,cs=!1;function ao(r){if(cs)throw new Error("lit-localize can only be configured once");y=r,cs=!0}/**
18
- * @license
19
- * Copyright 2021 Google LLC
20
- * SPDX-License-Identifier: BSD-3-Clause
21
- */class lo{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(Yt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Yt,this.__litLocalizeEventHandler)}}const co=r=>r.addController(new lo(r));/**
22
- * @license
23
- * Copyright 2021 Google LLC
24
- * SPDX-License-Identifier: BSD-3-Clause
25
- */const ho=()=>(r,e)=>(r.addInitializer(co),r);/**
26
- * @license
27
- * Copyright 2020 Google LLC
28
- * SPDX-License-Identifier: BSD-3-Clause
29
- */class hs{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}}/**
30
- * @license
31
- * Copyright 2014 Travis Webb
32
- * SPDX-License-Identifier: MIT
33
- */const ce=[];for(let r=0;r<256;r++)ce[r]=(r>>4&15).toString(16)+(r&15).toString(16);function po(r){let e=0,t=8997,n=0,s=33826,o=0,i=40164,a=0,c=52210;for(let d=0;d<r.length;d++)t^=r.charCodeAt(d),e=t*435,n=s*435,o=i*435,a=c*435,o+=t<<8,a+=s<<8,n+=e>>>16,t=e&65535,o+=n>>>16,s=n&65535,c=a+(o>>>16)&65535,i=o&65535;return ce[c>>8]+ce[c&255]+ce[i>>8]+ce[i&255]+ce[s>>8]+ce[s&255]+ce[t>>8]+ce[t&255]}/**
34
- * @license
35
- * Copyright 2020 Google LLC
36
- * SPDX-License-Identifier: BSD-3-Clause
37
- */const uo="",go="h",fo="s";function mo(r,e){return(e?go:fo)+po(typeof r=="string"?r:r.join(uo))}/**
38
- * @license
39
- * Copyright 2021 Google LLC
40
- * SPDX-License-Identifier: BSD-3-Clause
41
- */const ds=new WeakMap,ps=new Map;function wo(r,e,t){if(r){const n=t?.id??bo(e),s=r[n];if(s){if(typeof s=="string")return s;if("strTag"in s)return as(s.strings,e.values,s.values);{let o=ds.get(s);return o===void 0&&(o=s.values,ds.set(s,o)),{...s,values:o.map(i=>e.values[i])}}}}return ls(e)}function bo(r){const e=typeof r=="string"?r:r.strings;let t=ps.get(e);return t===void 0&&(t=mo(e,typeof r!="string"&&!("strTag"in r)),ps.set(e,t)),t}/**
42
- * @license
43
- * Copyright 2021 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */function Xt(r){window.dispatchEvent(new CustomEvent(Yt,{detail:r}))}let mt="",Zt,us,wt,Kt,gs,Se=new hs;Se.resolve();let bt=0;const vo=r=>(ao(((e,t)=>wo(gs,e,t))),mt=us=r.sourceLocale,wt=new Set(r.targetLocales),wt.add(r.sourceLocale),Kt=r.loadLocale,{getLocale:yo,setLocale:ko}),yo=()=>mt,ko=r=>{if(r===(Zt??mt))return Se.promise;if(!wt||!Kt)throw new Error("Internal error");if(!wt.has(r))throw new Error("Invalid locale code");bt++;const e=bt;return Zt=r,Se.settled&&(Se=new hs),Xt({status:"loading",loadingLocale:r}),(r===us?Promise.resolve({templates:void 0}):Kt(r)).then(n=>{bt===e&&(mt=r,Zt=void 0,gs=n.templates,Xt({status:"ready",readyLocale:r}),Se.resolve())},n=>{bt===e&&(Xt({status:"error",errorLocale:r,errorMessage:n.toString()}),Se.reject(n))}),Se.promise},_o=`/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:#fcf1ee;--color-red-600:#cc453e;--color-green-100:#eef5ee;--color-green-600:#448548;--color-blue-100:#edf4fe;--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-neutral-100:#f2f3f5;--color-neutral-200:#e2e4e9;--color-neutral-300:#cccfd7;--color-neutral-600:#6f7687;--color-neutral-700:oklch(37.1% 0 0);--spacing: 4px ;--container-2xl: 672px ;--text-xs: 12px ;--text-xs--line-height:calc(1/.75);--text-sm: 14px ;--text-sm--line-height:calc(1.25/.875);--text-lg: 18px ;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm: 4px ;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:"Inter",sans-serif;--default-mono-font-family:var(--font-mono);--color-primary-600:#377ea0;--color-primary-800:#1f4e66;--color-primary-900:#133445;--color-secondary-100:#fcf0e7;--color-secondary-200:#fae0ce;--color-utility-gray:#b9b9b9;--scrollbar-color-default:var(--color-neutral-300);--scrollbar-color-hover:var(--color-neutral-600);--tw-inset-shadow:0 0 #0000;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-outline-style:solid}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root,:host,html{font-size:16px}[role=button]:not(:disabled),button:not(:disabled){cursor:pointer}}@layer components{.btn{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;cursor:pointer;outline-offset:4px;border-radius:4px;outline-width:2px;justify-content:center;align-items:center;transition:all .2s ease-in-out;display:flex;position:relative}.btn:disabled{pointer-events:none}.btn-primary{background-color:var(--color-primary-800);color:var(--color-secondary-100);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-primary:hover{background-color:var(--color-primary-900)}}.btn-primary:disabled{background-color:var(--color-gray-200);color:var(--color-gray-500)}.btn-primary svg{color:var(--color-secondary-200)}.btn-primary:disabled{border-color:var(--color-neutral-200);background-color:var(--color-neutral-200);color:var(--color-neutral-600)}.btn-primary:disabled svg{color:var(--color-neutral-600)}.btn-secondary{border-style:var(--tw-border-style);--tw-border-style:solid;border-style:solid;border-width:1px;border-color:var(--color-primary-800);color:var(--color-primary-800);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover{background-color:var(--color-secondary-200);color:var(--color-primary-900)}}.btn-secondary svg{color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover svg{color:var(--color-primary-600)}}.btn-secondary:disabled{border-color:var(--color-neutral-300);background-color:var(--color-neutral-100);color:var(--color-utility-gray)}.btn-secondary:disabled svg{color:var(--color-neutral-600)}.btn-ghost{border-style:var(--tw-border-style);--tw-border-style:solid;outline-color:var(--color-primary-800);background-color:#0000;border:1px solid #0000}@media (hover:hover){.btn-ghost:hover{border-color:var(--color-primary-600);color:var(--color-primary-900);background-color:#0000}}.btn-ghost svg{color:var(--color-primary-800)}@media (hover:hover){.btn-ghost:hover svg{color:var(--color-primary-600)}}.btn-ghost:disabled{color:var(--color-utility-gray)}.btn-ghost:disabled svg{color:var(--color-neutral-300)}.prose>:last-child,.prose>:last-child table,.prose>:last-child pre{margin-bottom:0!important}.text-shimmer-primary{--shimmer-color:var(--color-primary-900);--shimmer-contrast:oklch(60% 0 0)}.text-shimmer{color:#0000;-webkit-text-fill-color:transparent;background:var(--shimmer-color)linear-gradient(to right,var(--shimmer-color)0,var(--shimmer-contrast)40%,var(--shimmer-contrast)60%,var(--shimmer-color)100%);background:var(--shimmer-color)-webkit-gradient(linear,100% 0,0 0,from(var(--shimmer-color)),color-stop(.4,var(--shimmer-contrast)),color-stop(.6,var(--shimmer-contrast)),to(var(--shimmer-color)));background-repeat:no-repeat;background-size:50% 200%;-webkit-background-clip:text;background-clip:text;animation-name:loading-shimmer;animation-duration:3s;animation-iteration-count:infinite;animation-delay:.1s;display:inline-block}.animate-grow{opacity:.3;animation-name:grow;animation-duration:1.5s;animation-timing-function:ease-in-out;animation-iteration-count:infinite;animation-delay:0s}.skeleton{animation:var(--animate-pulse);border-radius:var(--radius-sm);background-color:var(--color-neutral-200)}}@layer utilities{.\\@container\\/main{container:main/inline-size}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-1\\/2{left:50%}.z-50{z-index:50}.m-0{margin:calc(var(--spacing)*0)}.m-4{margin:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-auto{margin-block:auto}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);margin-top:1.2em;margin-bottom:1.2em;font-size:1.25em;line-height:1.6}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:decimal}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:disc}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.25em;font-weight:600}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em;font-style:italic;font-weight:500}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:0;margin-bottom:.888889em;font-size:2.25em;font-weight:800;line-height:1.11111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:2em;margin-bottom:1em;font-size:1.5em;font-weight:700;line-height:1.33333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.6em;margin-bottom:.6em;font-size:1.25em;font-weight:600;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.5em;margin-bottom:.5em;font-weight:600;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em;display:block}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows)/10%),0 3px rgb(var(--tw-prose-kbd-shadows)/10%);padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;border-radius:.3125rem;padding-inline-start:.375em;font-family:inherit;font-size:.875em;font-weight:500}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-weight:600}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"\`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);padding-top:.857143em;padding-inline-end:1.14286em;padding-bottom:.857143em;border-radius:.375rem;margin-top:1.71429em;margin-bottom:1.71429em;padding-inline-start:1.14286em;font-size:.875em;font-weight:400;line-height:1.71429;overflow-x:auto}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;background-color:#0000;border-width:0;border-radius:0;padding:0}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){table-layout:auto;width:100%;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.71429}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);vertical-align:bottom;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em;font-weight:600}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);margin-top:.857143em;font-size:.875em;line-height:1.42857}.prose{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:NaN NaN NaN;--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:255 255 255;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.571429em;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.h-0{height:calc(var(--spacing)*0)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-14{height:calc(var(--spacing)*14)}.h-24{height:calc(var(--spacing)*24)}.h-\\[18\\.4px\\]{height:18.4px}.h-auto{height:auto}.h-full{height:100%}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-full{min-height:100%}.w-2{width:calc(var(--spacing)*2)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[90\\%\\]{max-width:90%}.max-w-\\[calc\\(100\\%-80px\\)\\]{max-width:calc(100% - 80px)}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-grow-1{flex-grow:1}.basis-auto{flex-basis:auto}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.resize-none{resize:none}.grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.\\[grid-template-rows\\:auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-x-2{column-gap:calc(var(--spacing)*2)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-4{row-gap:calc(var(--spacing)*4)}.gap-y-8{row-gap:calc(var(--spacing)*8)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-solid{--tw-border-style:solid;border-style:solid}.border-green-600{border-color:var(--color-green-600)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-neutral-600{border-color:var(--color-neutral-600)}.border-red-600{border-color:var(--color-red-600)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-green-100{background-color:var(--color-green-100)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-600{background-color:var(--color-neutral-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-secondary-200{background-color:var(--color-secondary-200)}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.pt-2{padding-top:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.whitespace-normal{white-space:normal}.whitespace-pre-wrap{white-space:pre-wrap}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-primary-800{color:var(--color-primary-800)}.text-primary-900{color:var(--color-primary-900)}.text-red-600{color:var(--color-red-600)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-primary-800{outline-color:var(--color-primary-800)}.transition-\\[transform\\,opacity\\,height\\,visibility\\]{transition-property:transform,opacity,height,visibility;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[-webkit-mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.\\[animation-delay\\:0\\.3s\\]{animation-delay:.3s}.\\[animation-delay\\:0\\.6s\\]{animation-delay:.6s}.\\[background\\:conic-gradient\\(theme\\(colors\\.primary-600\\)_0_30\\%\\,transparent_30\\%_100\\%\\)\\]{background:conic-gradient(#377ea0 0 30%,transparent 30% 100%)}.\\[grid-area\\:content\\]{grid-area:content}.\\[grid-area\\:footer\\]{grid-area:footer}.\\[grid-area\\:header\\]{grid-area:header}.\\[grid-area\\:leading\\]{grid-area:leading}.\\[grid-area\\:primary\\]{grid-area:primary}.\\[grid-area\\:trailing\\]{grid-area:trailing}.\\[grid-template-areas\\:\\'header\\'\\'content\\'\\'footer\\'\\]{grid-template-areas:"header""content""footer"}.\\[grid-template-areas\\:\\'header_header_header\\'_\\'leading_primary_trailing\\'_\\'\\._footer_\\.\\'\\]{grid-template-areas:"header header header""leading primary trailing"".footer."}.\\[grid-template-areas\\:\\'leading_primary\\'\\]{grid-template-areas:"leading primary"}.\\[grid-template-areas\\:\\'leading_primary_trailing\\'\\]{grid-template-areas:"leading primary trailing"}.\\[mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0);mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.not-group-aria-expanded\\:-rotate-90:not(:is(:where(.group)[aria-expanded=true] *)){rotate:-90deg}.group-focus-within\\/composer\\:outline-solid:is(:where(.group\\/composer):focus-within *){--tw-outline-style:solid;outline-style:solid}.group-data-expanded\\/composer\\:\\[grid-template-areas\\:\\'header_header_header\\'_\\'primary_primary_primary\\'_\\'leading_footer_trailing\\'\\]:is(:where(.group\\/composer)[data-expanded] *){grid-template-areas:"header header header""primary primary primary""leading footer trailing"}.group-data-\\[error\\=true\\]\\/composer\\:border-red-600:is(:where(.group\\/composer)[data-error=true] *){border-color:var(--color-red-600)}.group-data-\\[error\\=true\\]\\/composer\\:bg-red-100:is(:where(.group\\/composer)[data-error=true] *){background-color:var(--color-red-100)}.group-data-\\[error\\=true\\]\\/composer\\:outline-red-600:is(:where(.group\\/composer)[data-error=true] *){outline-color:var(--color-red-600)}.placeholder\\:text-utility-gray::placeholder{color:var(--color-utility-gray)}.empty\\:hidden:empty{display:none}@media (hover:hover){.hover\\:text-primary-900:hover{color:var(--color-primary-900)}.hover\\:underline:hover{text-decoration-line:underline}}.active\\:outline-2:active{outline-style:var(--tw-outline-style);outline-width:2px}.data-\\[loading\\=true\\]\\:bg-transparent[data-loading=true]{background-color:#0000}.data-\\[selected\\=true\\]\\:bg-secondary-200[data-selected=true]{background-color:var(--color-secondary-200)}.data-\\[selected\\=true\\]\\:text-primary-900[data-selected=true]{color:var(--color-primary-900)}@container (min-width:20rem){.\\@xs\\:flex{display:flex}}@container (min-width:28rem){.\\@md\\:w-1\\/2{width:50%}.\\@md\\:w-36{width:calc(var(--spacing)*36)}.\\@md\\:w-\\[90\\%\\]{width:90%}.\\@md\\:flex-row{flex-direction:row}}@container main (min-width:32rem){.\\@lg\\/main\\:px-4{padding-inline:calc(var(--spacing)*4)}}@container (min-width:36rem){.\\@xl\\:grid{display:grid}.\\@xl\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.prose-table\\:min-w-max :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){min-width:max-content}.\\[\\&_svg\\]\\:text-green-600 svg{color:var(--color-green-600)}.\\[\\&_svg\\]\\:text-red-600 svg{color:var(--color-red-600)}.text-message{font-size:14px;line-height:1.71429}}@layer scroll{.overflow-auto:hover,.overflow-scroll:hover,.overflow-x-auto:hover,.overflow-y-auto:hover,textarea:hover{scrollbar-color:var(--scrollbar-color-hover)transparent}.overflow-auto,.overflow-scroll,.overflow-x-auto,.overflow-y-auto,textarea{scrollbar-width:thin;scrollbar-gutter:stable both-edges;scrollbar-color:var(--scrollbar-color-default)transparent;padding-inline:4px}:host-context([data-platform="windows"]) .overflow-scroll{padding-inline:0}:host-context([data-platform="windows"]) .overflow-x-auto{padding-inline:0}:host-context([data-platform="windows"]) .overflow-y-auto{padding-inline:0}:host-context([data-platform="windows"]) textarea{padding-inline:0}}@keyframes loading-shimmer{0%{background-position:-100% 0}to{background-position:250% 0}}@keyframes grow{0%{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}80%{opacity:.3;transform:scale(.8)}to{opacity:.3;transform:scale(.8)}}:host{box-sizing:border-box}.prose-gaia{--tw-prose-body:var(--color-primary-900);--tw-prose-headings:var(--color-primary-900);--tw-prose-lead:var(--color-primary-900);--tw-prose-links:var(--color-primary-800);--tw-prose-bold:var(--color-primary-900);--tw-prose-counters:var(--color-primary-900);--tw-prose-bullets:var(--color-primary-900);--tw-prose-hr:var(--color-neutral-300);--tw-prose-quotes:var(--color-primary-800);--tw-prose-quote-borders:var(--color-neutral-300);--tw-prose-captions:var(--color-primary-900);--tw-prose-kbd:var(--color-primary-900);--tw-prose-kbd-shadows:0 0 0;--tw-prose-code:var(--color-primary-900);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:var(--color-neutral-300);--tw-prose-td-borders:var(--color-neutral-200);max-width:unset;overflow-wrap:break-word;width:100%;font-size:14px;line-height:1.71429}svg{width:inherit;height:inherit}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;var xo=Object.getOwnPropertyDescriptor,So=(r,e,t,n)=>{for(var s=n>1?void 0:n?xo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let te=class extends g.LitElement{connectedCallback(){super.connectedCallback(),this.shadowRoot&&g.adoptStyles(this.shadowRoot,[g.unsafeCSS(_o),...this.shadowRoot.adoptedStyleSheets])}};te=So([ho()],te);const Eo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-icon lucide-arrow-up"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>',Jt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-alert-icon lucide-circle-alert"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>';class To extends CustomEvent{constructor(e){super("send-message",{detail:{message:e},composed:!0})}}class Co extends CustomEvent{constructor(e,t){super("approve-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class Io extends CustomEvent{constructor(e,t){super("decline-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class Ao extends CustomEvent{constructor(e,t,n){super("submit-feedback",{detail:{target:e,rating:t,comment:n},composed:!0})}}class Qt extends CustomEvent{constructor(e){super("toggle-feedback-form",{detail:{target:e},composed:!0})}}class er extends CustomEvent{constructor(){super("clear-conversation",{composed:!0})}}class $o extends CustomEvent{constructor(){super("clear-error",{composed:!0})}}class Ro extends CustomEvent{constructor(){super("send-typing",{composed:!0})}}class Po extends CustomEvent{constructor(){super("close-chat",{composed:!0})}}var Mo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Ee=(r,e,t,n)=>{for(var s=n>1?void 0:n?Do(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Mo(e,t,s),s};let be=class extends te{constructor(){super(...arguments),this.maxHeightPx=192,this.typingThrottleMs=2e3,this.lastTypingSent=0,this.maxInputLength=100,this.disabled=!1,this.loading=!1,this.text="",this.error=""}get canSubmit(){return this.text.trim()!==""&&!this.loading&&!this.hasError&&!this.disabled}get hasError(){return this.error.length>0}validateInput(){this.text.length>this.maxInputLength?this.error=y("Character limit exceeded.",{id:"composer-error-character-limit"}):this.error=""}sendMessage(){this.canSubmit&&(this.dispatchEvent(new To(this.text)),this.text="",this.textarea.style.height="auto")}onKeyDown(r){r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),this.sendMessage())}onInput(){this.text=this.textarea.value,this.maybeEmitTyping(),this.textarea.style.height="auto",this.textarea.style.height=Math.min(this.textarea.scrollHeight,this.maxHeightPx)+"px",this.textarea.style.overflowY=this.textarea.scrollHeight>this.maxHeightPx?"auto":"hidden",this.validateInput()}maybeEmitTyping(){if(this.disabled)return;const r=Date.now();r-this.lastTypingSent>=this.typingThrottleMs&&(this.dispatchEvent(new Ro),this.lastTypingSent=r)}render(){return g.html` <div class="group/composer w-full p-4 max-w-2xl mx-auto" data-error=${this.hasError}>
46
- <div
47
- class="outline-primary-800 rounded-sm outline-none border border-solid border-neutral-600 px-2 outline-2 group-focus-within/composer:outline-solid group-data-[error=true]/composer:border-red-600 group-data-[error=true]/composer:bg-red-100 group-data-[error=true]/composer:outline-red-600"
1
+ (function(P,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/if-defined.js"),require("lit/directives/when.js"),require("lit/directives/ref.js"),require("lit/directives/repeat.js"),require("lit/directives/map.js"),require("lit/directives/unsafe-html.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/class-map.js","lit/directives/if-defined.js","lit/directives/when.js","lit/directives/ref.js","lit/directives/repeat.js","lit/directives/map.js","lit/directives/unsafe-html.js"],y):(P=typeof globalThis<"u"?globalThis:P||self,y(P["gaia-chat-ui"]={},P.Lit,P.LitDecorators,P.LitDirectives.classMap,P.LitDirectives.ifDefined,P.LitDirectives.when,P.LitDirectives.ref,P.LitDirectives.repeat,P.LitDirectives.map,P.LitDirectives.unsafeHtml))})(this,(function(P,y,f,Gr,Kr,le,pt,yi,cs,ki){"use strict";let hs=class extends Event{constructor(e,r,s,n){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=r,this.callback=s,this.subscribe=n??!1}};function Qd(t){return t}let ds=class{constructor(e,r,s,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,i)=>{this.unsubscribe&&(this.unsubscribe!==i&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,i)),this.unsubscribe=i},this.host=e,r.context!==void 0){const o=r;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=r,this.callback=s,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new hs(this.context,this.host,this.t,this.subscribe))}};class xi{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,r=!1){const s=r||!Object.is(e,this.o);this.o=e,s&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(const[r,{disposer:s}]of this.subscriptions)r(this.o,s)},e!==void 0&&(this.value=e)}addCallback(e,r,s){if(!s)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:r});const{disposer:n}=this.subscriptions.get(e);e(this.value,n)}clearCallbacks(){this.subscriptions.clear()}}let _i=class extends Event{constructor(e,r){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=r}};class us extends xi{constructor(e,r,s){super(r.context!==void 0?r.initialValue:s),this.onContextRequest=n=>{if(n.context!==this.context)return;const o=n.contextTarget??n.composedPath()[0];o!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,o,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;const o=new Set;for(const[i,{consumerHost:a}]of this.subscriptions)o.has(i)||(o.add(i),a.dispatchEvent(new hs(this.context,a,i,!0)));n.stopPropagation()},this.host=e,r.context!==void 0?this.context=r.context:this.context=r,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new _i(this.context,this.host))}}function gt({context:t}){return(e,r)=>{const s=new WeakMap;if(typeof r=="object")return{get(){return e.get.call(this)},set(n){return s.get(this).setValue(n),e.set.call(this,n)},init(n){return s.set(this,new us(this,{context:t,initialValue:n})),n}};{e.constructor.addInitializer((i=>{s.set(i,new us(i,{context:t}))}));const n=Object.getOwnPropertyDescriptor(e,r);let o;if(n===void 0){const i=new WeakMap;o={get(){return i.get(this)},set(a){s.get(this).setValue(a),i.set(this,a)},configurable:!0,enumerable:!0}}else{const i=n.set;o={...n,set(a){s.get(this).setValue(a),i?.call(this,a)}}}return void Object.defineProperty(e,r,o)}}}function ce({context:t,subscribe:e}){return(r,s)=>{typeof s=="object"?s.addInitializer((function(){new ds(this,{context:t,callback:n=>{r.set.call(this,n)},subscribe:e})})):r.constructor.addInitializer((n=>{new ds(n,{context:t,callback:o=>{n[s]=o},subscribe:e})}))}}class me extends Error{constructor(e,r){super(e),this.code=r,this.name="AuthError"}}class ps extends me{constructor(){super("Token has expired","TOKEN_EXPIRED")}}class cr extends me{constructor(e){super(e||"Token is invalid","TOKEN_INVALID")}}class gs extends me{constructor(e){super("Failed to refresh token","TOKEN_REFRESH_FAILED"),this.innerError=e}}class fs extends me{constructor(){super("Auth strategy has not been configured","STRATEGY_NOT_CONFIGURED")}}class Si{getName(){return"null"}getIdentifier(){return null}async getAccessToken(){throw new fs}async refresh(){throw new fs}clear(){}}class Ti{constructor(){this.strategy=new Si}useStrategy(e){this.strategy=e}getStrategy(){return this.strategy}getIdentifier(){return this.strategy.getIdentifier()}getAccessToken(){return this.strategy.getAccessToken()}async refresh(){await this.strategy.refresh()}clear(){this.strategy.clear()}}class Ei{constructor(e,r){this.parser=e,this.storage=r,this.currentToken=null,this.refreshPromise=null,this.loadFromStorage()}loadFromStorage(){if(this.storage)try{const e=this.storage.load();if(!e)return;const r=this.parser.parse(e);this.parser.isExpired(r)?this.storage.clear():this.currentToken=r}catch{this.storage.clear()}}get(){return this.currentToken?this.parser.isExpired(this.currentToken)?(this.clear(),null):this.currentToken:null}set(e){const r=this.parser.parse(e);if(this.parser.isExpired(r))throw new ps;return this.currentToken=r,this.storage?.save(e),r}clear(){this.currentToken=null,this.storage?.clear()}isExpired(){return!this.currentToken||this.parser.isExpired(this.currentToken)}getIdentifier(){return this.currentToken?.subject??null}async refreshWith(e){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performRefresh(e);try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performRefresh(e){if(!this.isExpired())return this.currentToken;try{const r=await e();return this.set(r)}catch(r){throw this.clear(),r instanceof me?r:new gs(r)}}}class ms{constructor(e,r){this.parser=e,this.cache=new Ei(e,r)}getIdentifier(){return this.cache.getIdentifier()}async getAccessToken(){const e=this.cache.get();return e?e.raw:(await this.refresh(),this.cache.get()?.raw??null)}async refresh(){await this.cache.refreshWith(()=>this.fetchToken())}clear(){this.cache.clear()}}class Ci extends ms{constructor(e,r,s){super(r,s),this.baseUrl=e}getName(){return"visitor"}async fetchToken(){const e=await fetch(`${this.baseUrl}/api/v1/auth/visitor`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new gs(new Error(`HTTP ${e.status}: ${e.statusText}`));const r=await e.json();if(!r.accessToken)throw new cr("Response missing accessToken");return r.accessToken}}class Ai extends ms{constructor(e,r){super(r),this.tokenProvider=e}getName(){return"visma"}async fetchToken(){return this.tokenProvider()}}class Mt extends Error{}Mt.prototype.name="InvalidTokenError";function Ii(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let s=r.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function Ri(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Ii(e)}catch{return atob(e)}}function Pi(t,e){if(typeof t!="string")throw new Mt("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,s=t.split(".")[r];if(typeof s!="string")throw new Mt(`Invalid token specified: missing part #${r+1}`);let n;try{n=Ri(s)}catch(o){throw new Mt(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(n)}catch(o){throw new Mt(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}class $i{parse(e){try{const r=Pi(e);if(!r.exp||!r.sub)throw new cr("Missing required claims (exp, sub)");return{raw:e,decoded:r,expiresAt:r.exp*1e3,subject:r.sub}}catch(r){throw r instanceof me?r:new cr("Failed to decode JWT")}}isExpired(e){return e.expiresAt<Date.now()}getTimeToExpiry(e){return Math.max(0,e.expiresAt-Date.now())}}class Oi{constructor(e){this.config=e}create(e,r,s){const n=this.config.parser??new $i;switch(e){case"visma":if(!r)throw new me("Token provider required for Visma strategy","MISSING_TOKEN_CALLBACK");return new Ai(r,n);case"visitor":if(!s)throw new me("Base URL required for Visitor strategy","MISSING_BASE_URL");return new Ci(s,n,this.config.storage);default:throw new me(`Unknown strategy type: ${e}`,"UNKNOWN_STRATEGY")}}}const Yr="lit-localize-status";const ft=(t,...e)=>({strTag:!0,strings:t,values:e}),Di=t=>typeof t!="string"&&"strTag"in t,bs=(t,e,r)=>{let s=t[0];for(let n=1;n<t.length;n++)s+=e[r?r[n-1]:n-1],s+=t[n];return s};const ws=(t=>Di(t)?bs(t.strings,t.values):t);let E=ws,vs=!1;function Mi(t){if(vs)throw new Error("lit-localize can only be configured once");E=t,vs=!0}class Li{constructor(e){this.__litLocalizeEventHandler=r=>{r.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(Yr,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Yr,this.__litLocalizeEventHandler)}}const Ni=t=>t.addController(new Li(t));const zi=()=>(t,e)=>(t.addInitializer(Ni),t);class ys{constructor(){this.settled=!1,this.promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}}const Me=[];for(let t=0;t<256;t++)Me[t]=(t>>4&15).toString(16)+(t&15).toString(16);function Fi(t){let e=0,r=8997,s=0,n=33826,o=0,i=40164,a=0,l=52210;for(let h=0;h<t.length;h++)r^=t.charCodeAt(h),e=r*435,s=n*435,o=i*435,a=l*435,o+=r<<8,a+=n<<8,s+=e>>>16,r=e&65535,o+=s>>>16,n=s&65535,l=a+(o>>>16)&65535,i=o&65535;return Me[l>>8]+Me[l&255]+Me[i>>8]+Me[i&255]+Me[n>>8]+Me[n&255]+Me[r>>8]+Me[r&255]}const Bi="",Ui="h",Hi="s";function Wi(t,e){return(e?Ui:Hi)+Fi(typeof t=="string"?t:t.join(Bi))}const ks=new WeakMap,xs=new Map;function ji(t,e,r){if(t){const s=r?.id??qi(e),n=t[s];if(n){if(typeof n=="string")return n;if("strTag"in n)return bs(n.strings,e.values,n.values);{let o=ks.get(n);return o===void 0&&(o=n.values,ks.set(n,o)),{...n,values:o.map(i=>e.values[i])}}}}return ws(e)}function qi(t){const e=typeof t=="string"?t:t.strings;let r=xs.get(e);return r===void 0&&(r=Wi(e,typeof t!="string"&&!("strTag"in t)),xs.set(e,r)),r}function Zr(t){window.dispatchEvent(new CustomEvent(Yr,{detail:t}))}let hr="",Xr,_s,dr,Jr,Ss,Qe=new ys;Qe.resolve();let ur=0;const Vi=t=>(Mi(((e,r)=>ji(Ss,e,r))),hr=_s=t.sourceLocale,dr=new Set(t.targetLocales),dr.add(t.sourceLocale),Jr=t.loadLocale,{getLocale:Gi,setLocale:Ki}),Gi=()=>hr,Ki=t=>{if(t===(Xr??hr))return Qe.promise;if(!dr||!Jr)throw new Error("Internal error");if(!dr.has(t))throw new Error("Invalid locale code");ur++;const e=ur;return Xr=t,Qe.settled&&(Qe=new ys),Zr({status:"loading",loadingLocale:t}),(t===_s?Promise.resolve({templates:void 0}):Jr(t)).then(s=>{ur===e&&(hr=t,Xr=void 0,Ss=s.templates,Zr({status:"ready",readyLocale:t}),Qe.resolve())},s=>{ur===e&&(Zr({status:"error",errorLocale:t,errorMessage:s.toString()}),Qe.reject(s))}),Qe.promise},Yi=y.css`
2
+ :host{box-sizing:border-box!important;font-family:var(--gaia-font-family)}:host *,
3
+ :host *::before,
4
+ :host *::after{box-sizing:inherit!important;margin:0}[hidden]{display:none!important}*{scrollbar-color:var(--gaia-color-border-primary) transparent;scrollbar-width:thin}
5
+ `,Zi=':host,:root{--gaia-font-family:"Inter",system-ui,sans-serif;--gaia-font-size-xs:11px;--gaia-font-size-sm:12px;--gaia-font-size-base:14px;--gaia-font-size-lg:16px;--gaia-font-size-xl:20px;--gaia-font-size-2xl:24px;--gaia-font-size-3xl:36px;--gaia-line-height-xs:16px;--gaia-line-height-sm:20px;--gaia-line-height-base:20px;--gaia-line-height-lg:24px;--gaia-line-height-xl:32px;--gaia-line-height-2xl:36px;--gaia-line-height-3xl:56px;--gaia-letter-spacing-xs:.005em;--gaia-letter-spacing-sm:0;--gaia-letter-spacing-base:-.096px;--gaia-letter-spacing-lg:-.176px;--gaia-letter-spacing-xl:-.017em;--gaia-letter-spacing-2xl:-.019em;--gaia-letter-spacing-3xl:-.022em;--gaia-font-weight-regular:400;--gaia-font-weight-medium:500;--gaia-font-weight-semibold:600;--gaia-font-weight-bold:700;--gaia-color-border-primary:#6f7687;--gaia-color-border-secondary:#f5c3a1;--gaia-color-border-information:#366af6;--gaia-color-border-success:#448548;--gaia-color-border-warning:#bb5822;--gaia-color-border-error:#cc453e;--gaia-color-border-disabled:#cccfd7;--gaia-color-border-action:#1f4e66;--gaia-color-border-action-hover:#377ea0;--gaia-color-border-focus:#1f4e66;--gaia-color-border-action-hover-2:#f5c3a1;--gaia-color-border-selected:#448548;--gaia-color-border-tertiary:#cccfd7;--gaia-color-icon-primary:#133445;--gaia-color-icon-information:#366af6;--gaia-color-icon-success:#448548;--gaia-color-icon-warning:#bb5822;--gaia-color-icon-error:#cc453e;--gaia-color-icon-on-primary:#fff;--gaia-color-icon-action-hover:#377ea0;--gaia-color-icon-on-disabled:#6f7687;--gaia-color-icon-on-action:#fae0ce;--gaia-color-icon-action:#1f4e66;--gaia-color-icon-disabled:#cccfd7;--gaia-color-surface-page:#f2f3f5;--gaia-color-surface-primary:#fff;--gaia-color-surface-success:#eef5ee;--gaia-color-surface-disabled:#e2e4e9;--gaia-color-surface-error:#fcf1ee;--gaia-color-surface-information:#edf4fe;--gaia-color-surface-action:#1f4e66;--gaia-color-surface-action-hover:#133445;--gaia-color-surface-action-hover-2:#fae0ce;--gaia-color-surface-disable-selected:#6f7687;--gaia-color-surface-warning:#fcf0e7;--gaia-color-surface-selected:#eef5ee;--gaia-color-text-headings:#133445;--gaia-color-text-body:#133445;--gaia-color-text-action:#1f4e66;--gaia-color-text-action-hover:#133445;--gaia-color-text-disabled:#b9b9b9;--gaia-color-text-information:#133445;--gaia-color-text-success:#133445;--gaia-color-text-warning:#133445;--gaia-color-text-error:#133445;--gaia-color-text-on-action:#fcf0e7;--gaia-color-text-on-disabled:#6f7687;--gaia-color-text-link-visited:#591ab5;--gaia-color-text-disable-selected:#6f7687;--gaia-color-text-menu:#fae0ce;--gaia-color-text-body-secondary:#2a6480;--gaia-color-message-user:#edf4fe;--gaia-color-message-system:#f2f3f5;--gaia-color-message-operator:#fcf0e7;--gaia-color-neutral-10:#f2f3f5;--gaia-color-neutral-20:#e2e4e9;--gaia-color-neutral-30:#cccfd7;--gaia-color-neutral-40:#b4b9c4;--gaia-color-neutral-50:#8f95a4;--gaia-color-neutral-60:#6f7687;--gaia-color-neutral-70:#575e6d;--gaia-color-neutral-80:#444957;--gaia-color-neutral-90:#2d313b;--gaia-color-neutral-100:#1a1c23;--gaia-container-2xl:672px}';var Xi=Object.getOwnPropertyDescriptor,Ji=(t,e,r,s)=>{for(var n=s>1?void 0:s?Xi(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=i(n)||n);return n};let U=class extends y.LitElement{static set styles(t){this._styles=[...this._styles,...t]}static get styles(){return this._styles}};U._styles=[y.unsafeCSS(Zi),Yi],U=Ji([zi()],U);const Qi=y.css`
6
+ :host{--speed:1.1s;--track-color:#fae0ce;--indicator-color:#1f4e66;--size:16px;display:inline-flex;flex:none;height:var(--size);width:var(--size)}svg{animation:spin var(--speed) linear infinite;aspect-ratio:1;height:100%;width:100%}.track{stroke:var(--track-color)}.indicator{stroke:var(--indicator-color);stroke-dasharray:40,150;stroke-dashoffset:-6;stroke-linecap:round}@keyframes spin{0%{transform:rotate(0deg)}25%{transform:rotate(90deg)}75%{transform:rotate(180deg)}to{transform:rotate(1turn)}}
7
+ `;var ea=Object.getOwnPropertyDescriptor,ta=(t,e,r,s)=>{for(var n=s>1?void 0:s?ea(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=i(n)||n);return n};let Qr=class extends U{render(){return y.html`
8
+ <svg
9
+ part="base"
10
+ role="progressbar"
11
+ fill="none"
12
+ viewBox="0 0 50 50"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ aria-label="loading"
48
15
  >
49
- <div
50
- class="grid grid-cols-[auto_1fr_auto] [grid-template-areas:'header_header_header'_'leading_primary_trailing'_'._footer_.'] group-data-expanded/composer:[grid-template-areas:'header_header_header'_'primary_primary_primary'_'leading_footer_trailing']"
51
- >
52
- <div class="flex items-center overflow-x-hidden px-1.5 py-2 [grid-area:primary]">
53
- <textarea style=${`max-height: ${this.maxHeightPx}px`}
54
- data-testid="composer-textarea"
55
- name="composer-textarea"
56
- class="text-primary-900 placeholder:text-utility-gray h-[18.4px] w-full resize-none overflow-hidden text-sm outline-none"
57
- spellcheck="false"
58
- @keydown=${this.onKeyDown}
59
- @input=${this.onInput}
60
- .disabled=${this.disabled}
61
- .value=${Xn.live(this.text)}
62
- rows="1"
63
- placeholder=${y("Type your question here...",{id:"composer-placeholder"})}
64
- ></textarea>
65
- </div>
66
- <div class="flex items-center [grid-area:leading]"></div>
67
- <div class="flex items-end py-2 [grid-area:trailing]">
68
- <span class="flex">
69
- <button
70
- data-testid="send-message-btn"
71
- aria-label="Send message"
72
- class="btn btn-primary size-8 data-[loading=true]:bg-transparent"
73
- @click=${this.sendMessage}
74
- ?disabled=${!this.canSubmit}
75
- data-loading=${this.loading}
76
- >
77
- <div class="flex items-center justify-center">
78
- ${this.loading?g.html`
79
- <div class="relative size-4">
80
- <div
81
- class="bg-secondary-200 absolute inset-0 rounded-full [-webkit-mask:radial-gradient(farthest-side,transparent_calc(100%-3px),#000_0)] [mask:radial-gradient(farthest-side,transparent_calc(100%-3px),#000_0)]"
82
- ></div>
83
- <div
84
- class="[background:conic-gradient(theme(colors.primary-600)_0_30%,transparent_30%_100%)] absolute inset-0 animate-spin rounded-full [-webkit-mask:radial-gradient(farthest-side,transparent_calc(100%-3px),#000_0)] [mask:radial-gradient(farthest-side,transparent_calc(100%-3px),#000_0)]"
85
- ></div>
86
- </div>
87
- `:g.html`<div class="flex size-5 items-center justify-center">
88
- ${P.unsafeSVG(Eo)}
89
- </div>`}
90
- </div>
91
- </button>
92
- </span>
93
- </div>
94
- </div>
95
- </div>
96
- <div class="relative flex h-6 w-full items-center justify-between gap-x-2">
97
- <div class="flex max-w-[calc(100%-80px)] flex-row items-center gap-x-2 overflow-x-clip">
98
- ${this.hasError?g.html`
99
- <div class="flex size-4 items-center justify-center text-red-600">
100
- ${P.unsafeSVG(Jt)}
101
- </div>
102
- <span class="text-primary-900 truncate text-xs">${this.error}</span>
103
- `:g.nothing}
104
- </div>
105
- <div class="flex flex-col items-end">
106
- <span class="text-primary-900 text-xs font-medium">
107
- ${this.text.length}/${this.maxInputLength}
108
- </span>
109
- </div>
110
- </div>
16
+ <circle class="track" cx="25" cy="25" r="20" fill="none" stroke-width="6" />
17
+ <circle class="indicator" cx="25" cy="25" r="20" fill="none" stroke-width="8" />
18
+ </svg>
19
+ `}};Qr.styles=[Qi],Qr=ta([f.customElement("gaia-spinner")],Qr);const ra=y.css`
20
+ :host{display:inline-flex}button{all:unset}.button{align-items:center;border:1px solid transparent;border-radius:4px;cursor:pointer;display:inline-flex;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);height:32px;justify-content:center;letter-spacing:var(--gaia-letter-spacing-base);line-height:1;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:100%;&.icon{aspect-ratio:1/1;width:auto}&:not(.icon){padding:0 16px}&:focus-visible{outline:2px solid var(--gaia-color-border-focus);outline-offset:2px}}.button.disabled{cursor:not-allowed;*{pointer-events:none}}.prefix,
21
+ .label{align-items:center;display:flex;flex:0 0 auto;pointer-events:none}slot[name=prefix]::slotted(*){margin-inline-end:8px!important}:host([variant=primary]) .button{background-color:var(--gaia-color-surface-action);color:var(--gaia-color-text-on-action);::slotted(gaia-icon){color:var(--gaia-color-icon-on-action)}}:host([variant=primary]) .button.disabled{background-color:var(--gaia-color-surface-disabled);color:var(--gaia-color-text-on-disabled);::slotted(gaia-icon){color:var(--gaia-color-icon-on-disabled)}}:host([variant=primary]) .button:not(.disabled):hover{background-color:var(--gaia-color-surface-action-hover)}:host([variant=secondary]) .button{background-color:var(--gaia-color-surface-primary);border-color:var(--gaia-color-border-action);color:var(--gaia-color-text-action);::slotted(gaia-icon){color:var(--gaia-color-icon-action)}}:host([variant=secondary]) .button.disabled{background-color:var(--gaia-color-surface-page);border-color:var(--gaia-color-border-disabled);color:var(--gaia-color-text-disabled);::slotted(gaia-icon){color:var(--gaia-color-icon-on-disabled)}}:host([variant=secondary]) .button:not(.disabled):hover{background-color:var(--gaia-color-surface-action-hover-2);border-color:var(--gaia-color-border-action-hover);color:var(--gaia-color-text-action-hover)}:host([variant=ghost]) .button{color:var(--gaia-color-text-action);::slotted(gaia-icon){color:var(--gaia-color-icon-action)}}:host([variant=ghost]) .button.disabled{color:var(--gaia-color-text-disabled);::slotted(gaia-icon){color:var(--gaia-color-icon-disabled)}}:host([variant=ghost]) .button:not(.disabled):hover{border-color:var(--gaia-color-border-action-hover);color:var(--gaia-color-text-action-hover)}:host([variant=transparent]) .button{color:var(--gaia-color-text-action);::slotted(gaia-icon){color:var(--gaia-color-icon-action)}}:host([variant=transparent]) .button.disabled{color:var(--gaia-color-text-disabled);::slotted(gaia-icon){color:var(--gaia-color-icon-disabled)}}:host([variant=transparent]) .button:not(.disabled):hover{color:var(--gaia-color-text-action-hover)}.loading{cursor:wait;position:relative;.prefix,
22
+ .suffix,
23
+ .label{visibility:hidden}gaia-spinner{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}}
24
+ `;var na=Object.defineProperty,sa=Object.getOwnPropertyDescriptor,mt=(t,e,r,s)=>{for(var n=s>1?void 0:s?sa(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&na(e,r,n),n};let Ve=class extends U{constructor(){super(...arguments),this.isIconButton=!1,this.variant="primary",this.disabled=!1,this.loading=!1}handleLabelSlotChange(){const t=this.labelSlot.assignedNodes({flatten:!0});let e=!1,r=!1,s=!1;[...t].forEach(n=>{n.nodeType===Node.ELEMENT_NODE?n.localName==="gaia-icon"?e=!0:s=!0:n.nodeType===Node.TEXT_NODE&&(n.textContent?.trim()||"").length>0&&(r=!0)}),this.isIconButton=e&&!r&&!s}render(){return y.html`<button
25
+ class=${Gr.classMap({button:!0,icon:this.isIconButton,disabled:this.disabled,loading:this.loading})}
26
+ ?disabled=${this.disabled}
27
+ aria-disabled=${this.disabled?"true":"false"}
28
+ >
29
+ <slot name="prefix" class="prefix"></slot>
30
+ <slot class="label" @slotchange=${this.handleLabelSlotChange}></slot>
31
+ ${le.when(this.loading,()=>y.html`<gaia-spinner part="spinner"></gaia-spinner>`)}
32
+ </button>`}};Ve.styles=[ra],mt([f.query("slot:not([name])")],Ve.prototype,"labelSlot",2),mt([f.state()],Ve.prototype,"isIconButton",2),mt([f.property({reflect:!0})],Ve.prototype,"variant",2),mt([f.property({type:Boolean,reflect:!0})],Ve.prototype,"disabled",2),mt([f.property({type:Boolean,reflect:!0})],Ve.prototype,"loading",2),Ve=mt([f.customElement("gaia-button")],Ve);function pr(t,e){const r={waitUntilFirstUpdate:!1,...e};return(s,n)=>{const{update:o}=s,i=Array.isArray(t)?t:[t];s.update=function(a){i.forEach(l=>{const h=l;if(a.has(h)){const d=a.get(h),p=this[h];d!==p&&(!r.waitUntilFirstUpdate||this.hasUpdated)&&this[n](d,p)}}),o.call(this,a)}}}const Ts={angry:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M16 16s-1.5-2-4-2-4 2-4 2"/><path d="M7.5 8 10 9"/><path d="m14 9 2.5-1"/><path d="M9 10h.01"/><path d="M15 10h.01"/></svg>',"arrow-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>',"bell-ring":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M22 8c0-2.3-.8-4.3-2-6"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/><path d="M4 2C2.8 3.7 2 5.7 2 8"/></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>',"chevron-down":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>',"circle-alert":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>',"circle-check":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',"circle-x":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',frown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M16 16s-1.5-2-4-2-4 2-4 2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg>',globe:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>',headset:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z"/><path d="M21 16v2a4 4 0 0 1-4 4h-5"/></svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',laugh:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg>',lightbulb:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',megaphone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/><path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14"/><path d="M8 6v8"/></svg>',meh:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="8" x2="16" y1="15" y2="15"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg>',"message-circle":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/></svg>',"minimize-2":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/></svg>',"octagon-alert":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16h.01"/><path d="M12 8v4"/><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/></svg>',send:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/></svg>',smile:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg>',sparkles:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg>',"square-pen":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>',"thumbs-down":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 14V2"/><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/></svg>',"thumbs-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/></svg>',"triangle-alert":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',"user-round":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/></svg>',x:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',"learning-universe":'<svg version="1.1" id="LOGO" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve"><style type="text/css">.st0{fill:url(#SVGID_1_);}</style><g><linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5469" y1="23.618" x2="95.0059" y2="65.1887" gradientTransform="matrix(1 0 0 -1 0 98)"><stop offset="0.14" style="stop-color:#003356"/><stop offset="0.26" style="stop-color:#092D54"/><stop offset="0.47" style="stop-color:#241E4F"/><stop offset="0.74" style="stop-color:#4E0648"/><stop offset="0.8" style="stop-color:#5A0047"/><stop offset="0.87" style="stop-color:#5C0148"/><stop offset="0.9" style="stop-color:#64044D"/><stop offset="0.93" style="stop-color:#720A56"/><stop offset="0.96" style="stop-color:#861362"/><stop offset="0.98" style="stop-color:#A01E71"/><stop offset="1" style="stop-color:#B6287F"/></linearGradient><path class="st0" d="M80.1,39.2c-0.7-11.3-10.9-16.4-19.8-15.8c-13.2,0.9-23.2,7.6-29.1,16.2c-10,16.7,7,13.3,5,6.4 c-0.7-2.6-0.4-4.3,1.3-6.8c3.4-4.1,7.1-6.8,12.8-9.1c7.4-2.6,14.5-1.9,19.5,3.6c5.8,7,2.9,21.1-9.3,33.4 C49.7,77.8,35.7,83.1,24.6,83.1c-5.1,0-11.8-0.6-16.8-5.5c-7.9-7.9-5.2-18.7-5-20.1c0.3-1-1.3-1.6-1.7,0.1 C-5,83,17.3,87.6,20.3,88.2c2.9,0.3,27.1,3.4,49.2-21.6C78.8,55.4,80.5,46,80.1,39.2z M44,72.5c11.4-4.6,18.7-12,22.8-20.3 c3.6-7.6,2-14.7-1.4-18c-5.1-5.1-14.4-2.9-16.9-0.4c-2.5,2.5-1.1,5.3,2,4.6c9-1.9,10.6,3,10.5,5.6c-0.3,7.1-6.8,14.8-13.2,18.9 C37.4,69.4,27,70,20.6,65.8c-6.7-4.5-7.4-13.5-2.9-22.6c3.7-7.6,12.5-18,25.4-25.3C51.9,12.9,59,10.3,68.5,9c1.3-0.4,1-1.6-0.3-1.4 c-10,1.6-18,4.4-25.4,8.5c-9.7,5.3-24.5,16.7-30.3,31c-3.2,8.1-2.9,15.1,0.3,20.2c5.4,8.8,20.2,9.5,31,5.1L44,72.5z M91,25.2 c-4.5-5.8-11.1-8.7-18.3-9.4c-8.1-0.8-16.9,1-24.5,4.2C22.8,31,20.1,49.3,20.1,49.3c-0.9,3.8-2.2,15.8,13.1,15.1 c7.8-0.3,15.5-4.5,20.3-11.3c2.3-4.2-2.6-6.8-6.8-2.3c-2.3,2.5-6.5,7-13.3,6.8c-9.5-0.2-11.2-10.3-1.9-21.6c0,0,11.4-14.5,31-16.7 c12.3-1.3,22.9,4.2,26.5,13.9c2.5,6.7,2.2,15-2.5,26.1c-3.3,8-8.3,14.8-15.6,21.3c-2,1.9,0,3.7,2,2C86.8,71.5,96,54.8,96,40.8 C96,36.6,95.1,31,91,25.2z"/></g></svg>',vsn:`
33
+ <svg id="LOGO" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 605 220" style="background-color: #133445; border-radius: 4px; padding: 1px;">
34
+ <defs>
35
+ <style>
36
+ .cls-1 {
37
+ fill: #0080a4;
38
+ }
39
+
40
+ .cls-2 {
41
+ fill: #fff;
42
+ }
43
+ </style>
44
+ </defs>
45
+ <path class="cls-2" d="M189.5,3.41c-1.34-1.23-2.83-1.85-4.47-1.85h-27.12c-2.88,0-5.08.77-6.63,2.31-1.54,1.54-2.62,3.03-3.24,4.47l-51.79,158.69-.05-.15-13.7,41.54c-1.44,4.36,1.81,8.84,6.39,8.84h24.3c3.28,0,5.85-.81,7.7-2.46,1.85-1.64,3.18-3.7,4.01-6.16L190.89,10.81c.41-1.03.62-1.95.62-2.77,0-1.85-.67-3.39-2-4.62ZM45.16,11.42c-.41-2.66-1.39-4.98-2.93-6.93-1.54-1.95-3.85-2.93-6.93-2.93H6.95c-1.64,0-2.98.57-4.01,1.7-1.03,1.13-1.54,2.52-1.54,4.16,0,1.44.31,2.77.92,4.01l19.73,51.15c.82,2.05,1.96,3.85,3.39,5.39,1.44,1.54,3.7,2.31,6.78,2.31h15.72c1.85,0,3.24-.62,4.16-1.86.92-1.23,1.28-2.77,1.08-4.62l-8.02-52.39Z"/>
46
+ <g>
47
+ <g>
48
+ <path class="cls-2" d="M547.39,215.55c-1.34,1.23-2.83,1.85-4.47,1.85h-27.12c-2.88,0-5.08-.76-6.63-2.3-1.54-1.54-2.62-3.03-3.24-4.47l-51.81-158.67-.05.15-13.71-41.53c-1.44-4.36,1.81-8.84,6.39-8.85h24.3c3.28,0,5.85.81,7.7,2.46,1.85,1.64,3.18,3.7,4.01,6.16l66,197.8c.41,1.03.62,1.95.62,2.77,0,1.85-.67,3.39-2,4.62Z"/>
49
+ <path class="cls-1" d="M572.54,70.43c3.08,0,5.34-.77,6.78-2.31,1.43-1.54,2.57-3.34,3.39-5.39l19.72-51.15c.62-1.23.92-2.57.92-4.01,0-1.64-.51-3.03-1.54-4.16-1.03-1.13-2.36-1.7-4.01-1.7h-28.35c-3.08,0-5.39.98-6.93,2.93-1.54,1.96-2.52,4.27-2.93,6.93l-8.01,52.38c-.21,1.85.15,3.39,1.08,4.62.92,1.23,2.31,1.85,4.16,1.85h15.71Z"/>
50
+ </g>
51
+ <path class="cls-2" d="M437.52,210.12c0,2.23-.66,4-1.98,5.32-1.31,1.32-3.09,1.97-5.32,1.97h-21.87c-2.02,0-3.75-.65-5.16-1.97-1.42-1.31-2.13-3.09-2.13-5.32v-27.65c0-2.23.71-4.05,2.13-5.47,1.42-1.42,3.14-2.13,5.16-2.13h21.87c2.23,0,4,.71,5.32,2.13,1.32,1.42,1.98,3.24,1.98,5.47v27.65Z"/>
52
+ </g>
53
+ <g>
54
+ <path class="cls-2" d="M294.4,1.62c-7.18,1.33-13.8,3.31-19.81,5.99-12.01,5.34-21.24,12.62-27.71,21.85-6.47,9.23-9.7,19.81-9.7,31.7,0,12.31,2.61,22.47,7.84,30.48,5.23,8,13.03,14.62,23.39,19.86,7.29,3.68,15.86,6.98,25.65,9.9,2.17.65,4.36-.95,4.36-3.22v-32.94c0-1.31-.77-2.48-1.95-3.05-4.72-2.29-8.33-4.83-10.82-7.63-3.39-3.8-5.08-8.57-5.08-14.32,0-8.62,3.39-14.98,10.16-19.08,1.73-1.05,3.6-1.95,5.61-2.72,1.27-.49,2.08-1.75,2.08-3.11V4.93c0-2.12-1.94-3.69-4.03-3.31ZM262.75,156.31c-.82-2.05-1.95-3.85-3.39-5.39-1.44-1.54-3.69-2.31-6.77-2.31h-15.7c-1.85,0-3.23.62-4.16,1.85-.92,1.23-1.28,2.77-1.08,4.61l8.01,52.33c.41,2.66,1.38,4.97,2.93,6.92,1.54,1.95,3.85,2.92,6.93,2.92h28.32c1.64,0,2.97-.57,4-1.7,1.03-1.13,1.54-2.51,1.54-4.15,0-1.44-.31-2.77-.92-4l-19.71-51.09Z"/>
55
+ <path class="cls-2" d="M371.13,1.56c2.23,0,4,.66,5.32,1.98,1.32,1.31,1.97,3.09,1.97,5.32v21.87c0,2.02-.65,3.75-1.97,5.16-1.31,1.42-3.09,2.13-5.32,2.13h-27.65c-2.23,0-4.05-.71-5.47-2.13-1.42-1.42-2.13-3.14-2.13-5.16V8.85c0-2.23.71-4,2.13-5.32,1.42-1.32,3.24-1.98,5.47-1.98h27.65Z"/>
56
+ </g>
57
+ </svg>`},oa={resolver:t=>t in Ts?Ts[t]:null},ia=y.css`
58
+ :host{align-items:center;display:flex;flex:0 0 auto;justify-content:center}svg{fill:none;height:var(--icon-size);stroke:currentcolor;width:var(--icon-size)}:host([size=sm]){--icon-size:12px}:host([size=base]){--icon-size:16px}:host([size=lg]){--icon-size:20px}:host([size=xl]){--icon-size:24px}:host([size="2xl"]){--icon-size:28px}:host([size="3xl"]){--icon-size:32px}
59
+ `;var aa=Object.defineProperty,la=Object.getOwnPropertyDescriptor,et=(t,e,r,s)=>{for(var n=s>1?void 0:s?la(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&aa(e,r,n),n};let en;const Es=new Map;let Le=class extends U{constructor(){super(...arguments),this.svgTemplate=null,this.name=null,this.label="",this.size="base"}resolveIcon(t){let e=Es.get(t)??null;return e||(e=oa.resolver(t)),e?(Es.set(t,e),this.createSvgNode(e)):null}createSvgNode(t){const e=document.createElement("div");e.innerHTML=t;const r=e.firstElementChild;if(r?.tagName?.toLowerCase()!=="svg")return null;en||(en=new DOMParser);const n=en.parseFromString(r.outerHTML,"text/html").body.querySelector("svg");if(!n)return null;try{n.part.add("svg")}catch{}return document.adoptNode(n)}handleLabelChange(){typeof this.label=="string"&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){this.svgTemplate=this.name?this.resolveIcon(this.name):null}render(){return this.svgTemplate??y.html`<svg part="svg" fill="currentColor" width="24" height="24"></svg>`}};Le.styles=[ia],et([f.state()],Le.prototype,"svgTemplate",2),et([f.property({reflect:!0})],Le.prototype,"name",2),et([f.property()],Le.prototype,"label",2),et([f.property({reflect:!0})],Le.prototype,"size",2),et([pr("label")],Le.prototype,"handleLabelChange",1),et([pr("name")],Le.prototype,"setIcon",1),Le=et([f.customElement("gaia-icon")],Le);const bt=Math.min,tt=Math.max,gr=Math.round,fr=Math.floor,Ae=t=>({x:t,y:t}),ca={left:"right",right:"left",bottom:"top",top:"bottom"},ha={start:"end",end:"start"};function tn(t,e,r){return tt(t,bt(e,r))}function Lt(t,e){return typeof t=="function"?t(e):t}function rt(t){return t.split("-")[0]}function Nt(t){return t.split("-")[1]}function Cs(t){return t==="x"?"y":"x"}function rn(t){return t==="y"?"height":"width"}const da=new Set(["top","bottom"]);function Ge(t){return da.has(rt(t))?"y":"x"}function nn(t){return Cs(Ge(t))}function ua(t,e,r){r===void 0&&(r=!1);const s=Nt(t),n=nn(t),o=rn(n);let i=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(i=mr(i)),[i,mr(i)]}function pa(t){const e=mr(t);return[sn(t),e,sn(e)]}function sn(t){return t.replace(/start|end/g,e=>ha[e])}const As=["left","right"],Is=["right","left"],ga=["top","bottom"],fa=["bottom","top"];function ma(t,e,r){switch(t){case"top":case"bottom":return r?e?Is:As:e?As:Is;case"left":case"right":return e?ga:fa;default:return[]}}function ba(t,e,r,s){const n=Nt(t);let o=ma(rt(t),r==="start",s);return n&&(o=o.map(i=>i+"-"+n),e&&(o=o.concat(o.map(sn)))),o}function mr(t){return t.replace(/left|right|bottom|top/g,e=>ca[e])}function wa(t){return{top:0,right:0,bottom:0,left:0,...t}}function Rs(t){return typeof t!="number"?wa(t):{top:t,right:t,bottom:t,left:t}}function br(t){const{x:e,y:r,width:s,height:n}=t;return{width:s,height:n,top:r,left:e,right:e+s,bottom:r+n,x:e,y:r}}function Ps(t,e,r){let{reference:s,floating:n}=t;const o=Ge(e),i=nn(e),a=rn(i),l=rt(e),h=o==="y",d=s.x+s.width/2-n.width/2,p=s.y+s.height/2-n.height/2,b=s[a]/2-n[a]/2;let m;switch(l){case"top":m={x:d,y:s.y-n.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:p};break;case"left":m={x:s.x-n.width,y:p};break;default:m={x:s.x,y:s.y}}switch(Nt(e)){case"start":m[i]-=b*(r&&h?-1:1);break;case"end":m[i]+=b*(r&&h?-1:1);break}return m}const va=async(t,e,r)=>{const{placement:s="bottom",strategy:n="absolute",middleware:o=[],platform:i}=r,a=o.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(e));let h=await i.getElementRects({reference:t,floating:e,strategy:n}),{x:d,y:p}=Ps(h,s,l),b=s,m={},w=0;for(let v=0;v<a.length;v++){const{name:_,fn:S}=a[v],{x:A,y:I,data:R,reset:D}=await S({x:d,y:p,initialPlacement:s,placement:b,strategy:n,middlewareData:m,rects:h,platform:i,elements:{reference:t,floating:e}});d=A??d,p=I??p,m={...m,[_]:{...m[_],...R}},D&&w<=50&&(w++,typeof D=="object"&&(D.placement&&(b=D.placement),D.rects&&(h=D.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:n}):D.rects),{x:d,y:p}=Ps(h,b,l)),v=-1)}return{x:d,y:p,placement:b,strategy:n,middlewareData:m}};async function $s(t,e){var r;e===void 0&&(e={});const{x:s,y:n,platform:o,rects:i,elements:a,strategy:l}=t,{boundary:h="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:b=!1,padding:m=0}=Lt(e,t),w=Rs(m),_=a[b?p==="floating"?"reference":"floating":p],S=br(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(_)))==null||r?_:_.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:h,rootBoundary:d,strategy:l})),A=p==="floating"?{x:s,y:n,width:i.floating.width,height:i.floating.height}:i.reference,I=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),R=await(o.isElement==null?void 0:o.isElement(I))?await(o.getScale==null?void 0:o.getScale(I))||{x:1,y:1}:{x:1,y:1},D=br(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:A,offsetParent:I,strategy:l}):A);return{top:(S.top-D.top+w.top)/R.y,bottom:(D.bottom-S.bottom+w.bottom)/R.y,left:(S.left-D.left+w.left)/R.x,right:(D.right-S.right+w.right)/R.x}}const ya=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:s,placement:n,rects:o,platform:i,elements:a,middlewareData:l}=e,{element:h,padding:d=0}=Lt(t,e)||{};if(h==null)return{};const p=Rs(d),b={x:r,y:s},m=nn(n),w=rn(m),v=await i.getDimensions(h),_=m==="y",S=_?"top":"left",A=_?"bottom":"right",I=_?"clientHeight":"clientWidth",R=o.reference[w]+o.reference[m]-b[m]-o.floating[w],D=b[m]-o.reference[m],Z=await(i.getOffsetParent==null?void 0:i.getOffsetParent(h));let j=Z?Z[I]:0;(!j||!await(i.isElement==null?void 0:i.isElement(Z)))&&(j=a.floating[I]||o.floating[w]);const ht=R/2-D/2,Be=j/2-v[w]/2-1,Te=bt(p[S],Be),F=bt(p[A],Be),Ee=Te,Ue=j-v[w]-F,G=j/2-v[w]/2+ht,He=tn(Ee,G,Ue),Ce=!l.arrow&&Nt(n)!=null&&G!==He&&o.reference[w]/2-(G<Ee?Te:F)-v[w]/2<0,ge=Ce?G<Ee?G-Ee:G-Ue:0;return{[m]:b[m]+ge,data:{[m]:He,centerOffset:G-He-ge,...Ce&&{alignmentOffset:ge}},reset:Ce}}}),ka=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,s;const{placement:n,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:h}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:b,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:v=!0,..._}=Lt(t,e);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const S=rt(n),A=Ge(a),I=rt(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(h.floating)),D=b||(I||!v?[mr(a)]:pa(a)),Z=w!=="none";!b&&Z&&D.push(...ba(a,v,w,R));const j=[a,...D],ht=await $s(e,_),Be=[];let Te=((s=o.flip)==null?void 0:s.overflows)||[];if(d&&Be.push(ht[S]),p){const G=ua(n,i,R);Be.push(ht[G[0]],ht[G[1]])}if(Te=[...Te,{placement:n,overflows:Be}],!Be.every(G=>G<=0)){var F,Ee;const G=(((F=o.flip)==null?void 0:F.index)||0)+1,He=j[G];if(He&&(!(p==="alignment"?A!==Ge(He):!1)||Te.every(ie=>Ge(ie.placement)===A?ie.overflows[0]>0:!0)))return{data:{index:G,overflows:Te},reset:{placement:He}};let Ce=(Ee=Te.filter(ge=>ge.overflows[0]<=0).sort((ge,ie)=>ge.overflows[1]-ie.overflows[1])[0])==null?void 0:Ee.placement;if(!Ce)switch(m){case"bestFit":{var Ue;const ge=(Ue=Te.filter(ie=>{if(Z){const Oe=Ge(ie.placement);return Oe===A||Oe==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(Oe=>Oe>0).reduce((Oe,Fr)=>Oe+Fr,0)]).sort((ie,Oe)=>ie[1]-Oe[1])[0])==null?void 0:Ue[0];ge&&(Ce=ge);break}case"initialPlacement":Ce=a;break}if(n!==Ce)return{reset:{placement:Ce}}}return{}}}},xa=new Set(["left","top"]);async function _a(t,e){const{placement:r,platform:s,elements:n}=t,o=await(s.isRTL==null?void 0:s.isRTL(n.floating)),i=rt(r),a=Nt(r),l=Ge(r)==="y",h=xa.has(i)?-1:1,d=o&&l?-1:1,p=Lt(e,t);let{mainAxis:b,crossAxis:m,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof w=="number"&&(m=a==="end"?w*-1:w),l?{x:m*d,y:b*h}:{x:b*h,y:m*d}}const Sa=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,s;const{x:n,y:o,placement:i,middlewareData:a}=e,l=await _a(e,t);return i===((r=a.offset)==null?void 0:r.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:n+l.x,y:o+l.y,data:{...l,placement:i}}}}},Ta=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:s,placement:n}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:_=>{let{x:S,y:A}=_;return{x:S,y:A}}},...l}=Lt(t,e),h={x:r,y:s},d=await $s(e,l),p=Ge(rt(n)),b=Cs(p);let m=h[b],w=h[p];if(o){const _=b==="y"?"top":"left",S=b==="y"?"bottom":"right",A=m+d[_],I=m-d[S];m=tn(A,m,I)}if(i){const _=p==="y"?"top":"left",S=p==="y"?"bottom":"right",A=w+d[_],I=w-d[S];w=tn(A,w,I)}const v=a.fn({...e,[b]:m,[p]:w});return{...v,data:{x:v.x-r,y:v.y-s,enabled:{[b]:o,[p]:i}}}}}};function wr(){return typeof window<"u"}function wt(t){return Os(t)?(t.nodeName||"").toLowerCase():"#document"}function he(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ie(t){var e;return(e=(Os(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Os(t){return wr()?t instanceof Node||t instanceof he(t).Node:!1}function be(t){return wr()?t instanceof Element||t instanceof he(t).Element:!1}function Re(t){return wr()?t instanceof HTMLElement||t instanceof he(t).HTMLElement:!1}function Ds(t){return!wr()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof he(t).ShadowRoot}const Ea=new Set(["inline","contents"]);function zt(t){const{overflow:e,overflowX:r,overflowY:s,display:n}=we(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+r)&&!Ea.has(n)}const Ca=new Set(["table","td","th"]);function Aa(t){return Ca.has(wt(t))}const Ia=[":popover-open",":modal"];function vr(t){return Ia.some(e=>{try{return t.matches(e)}catch{return!1}})}const Ra=["transform","translate","scale","rotate","perspective"],Pa=["transform","translate","scale","rotate","perspective","filter"],$a=["paint","layout","strict","content"];function on(t){const e=an(),r=be(t)?we(t):t;return Ra.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||Pa.some(s=>(r.willChange||"").includes(s))||$a.some(s=>(r.contain||"").includes(s))}function Oa(t){let e=Ke(t);for(;Re(e)&&!vt(e);){if(on(e))return e;if(vr(e))return null;e=Ke(e)}return null}function an(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Da=new Set(["html","body","#document"]);function vt(t){return Da.has(wt(t))}function we(t){return he(t).getComputedStyle(t)}function yr(t){return be(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ke(t){if(wt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ds(t)&&t.host||Ie(t);return Ds(e)?e.host:e}function Ms(t){const e=Ke(t);return vt(e)?t.ownerDocument?t.ownerDocument.body:t.body:Re(e)&&zt(e)?e:Ms(e)}function Ft(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=Ms(t),o=n===((s=t.ownerDocument)==null?void 0:s.body),i=he(n);if(o){const a=ln(i);return e.concat(i,i.visualViewport||[],zt(n)?n:[],a&&r?Ft(a):[])}return e.concat(n,Ft(n,[],r))}function ln(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ls(t){const e=we(t);let r=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const n=Re(t),o=n?t.offsetWidth:r,i=n?t.offsetHeight:s,a=gr(r)!==o||gr(s)!==i;return a&&(r=o,s=i),{width:r,height:s,$:a}}function cn(t){return be(t)?t:t.contextElement}function yt(t){const e=cn(t);if(!Re(e))return Ae(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:o}=Ls(e);let i=(o?gr(r.width):r.width)/s,a=(o?gr(r.height):r.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ma=Ae(0);function Ns(t){const e=he(t);return!an()||!e.visualViewport?Ma:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function La(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==he(t)?!1:e}function nt(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),o=cn(t);let i=Ae(1);e&&(s?be(s)&&(i=yt(s)):i=yt(t));const a=La(o,r,s)?Ns(o):Ae(0);let l=(n.left+a.x)/i.x,h=(n.top+a.y)/i.y,d=n.width/i.x,p=n.height/i.y;if(o){const b=he(o),m=s&&be(s)?he(s):s;let w=b,v=ln(w);for(;v&&s&&m!==w;){const _=yt(v),S=v.getBoundingClientRect(),A=we(v),I=S.left+(v.clientLeft+parseFloat(A.paddingLeft))*_.x,R=S.top+(v.clientTop+parseFloat(A.paddingTop))*_.y;l*=_.x,h*=_.y,d*=_.x,p*=_.y,l+=I,h+=R,w=he(v),v=ln(w)}}return br({width:d,height:p,x:l,y:h})}function kr(t,e){const r=yr(t).scrollLeft;return e?e.left+r:nt(Ie(t)).left+r}function zs(t,e){const r=t.getBoundingClientRect(),s=r.left+e.scrollLeft-kr(t,r),n=r.top+e.scrollTop;return{x:s,y:n}}function Na(t){let{elements:e,rect:r,offsetParent:s,strategy:n}=t;const o=n==="fixed",i=Ie(s),a=e?vr(e.floating):!1;if(s===i||a&&o)return r;let l={scrollLeft:0,scrollTop:0},h=Ae(1);const d=Ae(0),p=Re(s);if((p||!p&&!o)&&((wt(s)!=="body"||zt(i))&&(l=yr(s)),Re(s))){const m=nt(s);h=yt(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}const b=i&&!p&&!o?zs(i,l):Ae(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-l.scrollLeft*h.x+d.x+b.x,y:r.y*h.y-l.scrollTop*h.y+d.y+b.y}}function za(t){return Array.from(t.getClientRects())}function Fa(t){const e=Ie(t),r=yr(t),s=t.ownerDocument.body,n=tt(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=tt(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let i=-r.scrollLeft+kr(t);const a=-r.scrollTop;return we(s).direction==="rtl"&&(i+=tt(e.clientWidth,s.clientWidth)-n),{width:n,height:o,x:i,y:a}}const Fs=25;function Ba(t,e){const r=he(t),s=Ie(t),n=r.visualViewport;let o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(n){o=n.width,i=n.height;const d=an();(!d||d&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}const h=kr(s);if(h<=0){const d=s.ownerDocument,p=d.body,b=getComputedStyle(p),m=d.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,w=Math.abs(s.clientWidth-p.clientWidth-m);w<=Fs&&(o-=w)}else h<=Fs&&(o+=h);return{width:o,height:i,x:a,y:l}}const Ua=new Set(["absolute","fixed"]);function Ha(t,e){const r=nt(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,o=Re(t)?yt(t):Ae(1),i=t.clientWidth*o.x,a=t.clientHeight*o.y,l=n*o.x,h=s*o.y;return{width:i,height:a,x:l,y:h}}function Bs(t,e,r){let s;if(e==="viewport")s=Ba(t,r);else if(e==="document")s=Fa(Ie(t));else if(be(e))s=Ha(e,r);else{const n=Ns(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return br(s)}function Us(t,e){const r=Ke(t);return r===e||!be(r)||vt(r)?!1:we(r).position==="fixed"||Us(r,e)}function Wa(t,e){const r=e.get(t);if(r)return r;let s=Ft(t,[],!1).filter(a=>be(a)&&wt(a)!=="body"),n=null;const o=we(t).position==="fixed";let i=o?Ke(t):t;for(;be(i)&&!vt(i);){const a=we(i),l=on(i);!l&&a.position==="fixed"&&(n=null),(o?!l&&!n:!l&&a.position==="static"&&!!n&&Ua.has(n.position)||zt(i)&&!l&&Us(t,i))?s=s.filter(d=>d!==i):n=a,i=Ke(i)}return e.set(t,s),s}function ja(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const i=[...r==="clippingAncestors"?vr(e)?[]:Wa(e,this._c):[].concat(r),s],a=i[0],l=i.reduce((h,d)=>{const p=Bs(e,d,n);return h.top=tt(p.top,h.top),h.right=bt(p.right,h.right),h.bottom=bt(p.bottom,h.bottom),h.left=tt(p.left,h.left),h},Bs(e,a,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function qa(t){const{width:e,height:r}=Ls(t);return{width:e,height:r}}function Va(t,e,r){const s=Re(e),n=Ie(e),o=r==="fixed",i=nt(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Ae(0);function h(){l.x=kr(n)}if(s||!s&&!o)if((wt(e)!=="body"||zt(n))&&(a=yr(e)),s){const m=nt(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else n&&h();o&&!s&&n&&h();const d=n&&!s&&!o?zs(n,a):Ae(0),p=i.left+a.scrollLeft-l.x-d.x,b=i.top+a.scrollTop-l.y-d.y;return{x:p,y:b,width:i.width,height:i.height}}function hn(t){return we(t).position==="static"}function Hs(t,e){if(!Re(t)||we(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ie(t)===r&&(r=r.ownerDocument.body),r}function Ws(t,e){const r=he(t);if(vr(t))return r;if(!Re(t)){let n=Ke(t);for(;n&&!vt(n);){if(be(n)&&!hn(n))return n;n=Ke(n)}return r}let s=Hs(t,e);for(;s&&Aa(s)&&hn(s);)s=Hs(s,e);return s&&vt(s)&&hn(s)&&!on(s)?r:s||Oa(t)||r}const Ga=async function(t){const e=this.getOffsetParent||Ws,r=this.getDimensions,s=await r(t.floating);return{reference:Va(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ka(t){return we(t).direction==="rtl"}const Ya={convertOffsetParentRelativeRectToViewportRelativeRect:Na,getDocumentElement:Ie,getClippingRect:ja,getOffsetParent:Ws,getElementRects:Ga,getClientRects:za,getDimensions:qa,getScale:yt,isElement:be,isRTL:Ka};function js(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Za(t,e){let r=null,s;const n=Ie(t);function o(){var a;clearTimeout(s),(a=r)==null||a.disconnect(),r=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const h=t.getBoundingClientRect(),{left:d,top:p,width:b,height:m}=h;if(a||e(),!b||!m)return;const w=fr(p),v=fr(n.clientWidth-(d+b)),_=fr(n.clientHeight-(p+m)),S=fr(d),I={rootMargin:-w+"px "+-v+"px "+-_+"px "+-S+"px",threshold:tt(0,bt(1,l))||1};let R=!0;function D(Z){const j=Z[0].intersectionRatio;if(j!==l){if(!R)return i();j?i(!1,j):s=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!js(h,t.getBoundingClientRect())&&i(),R=!1}try{r=new IntersectionObserver(D,{...I,root:n.ownerDocument})}catch{r=new IntersectionObserver(D,I)}r.observe(t)}return i(!0),o}function Xa(t,e,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,h=cn(t),d=n||o?[...h?Ft(h):[],...Ft(e)]:[];d.forEach(S=>{n&&S.addEventListener("scroll",r,{passive:!0}),o&&S.addEventListener("resize",r)});const p=h&&a?Za(h,r):null;let b=-1,m=null;i&&(m=new ResizeObserver(S=>{let[A]=S;A&&A.target===h&&m&&(m.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var I;(I=m)==null||I.observe(e)})),r()}),h&&!l&&m.observe(h),m.observe(e));let w,v=l?nt(t):null;l&&_();function _(){const S=nt(t);v&&!js(v,S)&&r(),v=S,w=requestAnimationFrame(_)}return r(),()=>{var S;d.forEach(A=>{n&&A.removeEventListener("scroll",r),o&&A.removeEventListener("resize",r)}),p?.(),(S=m)==null||S.disconnect(),m=null,l&&cancelAnimationFrame(w)}}const Ja=Sa,Qa=Ta,el=ka,tl=ya,rl=(t,e,r)=>{const s=new Map,n={platform:Ya,...r},o={...n.platform,_c:s};return va(t,e,{...n,platform:o})},nl=y.css`
60
+ :host{display:block;position:relative}.trigger{display:block}::slotted(*){width:100%}.popover{animation:fade-in .15s ease-out forwards;border-radius:4px;box-shadow:
61
+ 0 4px 6px -1px rgb(0 0 0 / 10%),
62
+ 0 2px 4px -1px rgb(0 0 0 / 6%);color:var(--gaia-color-text-on-action);font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);isolation:isolate;left:0;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);max-width:calc(100cqw - 16px);opacity:0;overflow-wrap:break-word;padding:8px;pointer-events:none;top:0;width:-moz-max-content;width:max-content;z-index:9999}.arrow,.popover{background-color:var(--gaia-color-surface-action-hover);position:absolute}.arrow{height:8px;transform:rotate(45deg);width:8px}@keyframes fade-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host([hidden]) .popover{animation:fade-out .1s ease-in forwards}
63
+ `;var sl=Object.defineProperty,ol=Object.getOwnPropertyDescriptor,ve=(t,e,r,s)=>{for(var n=s>1?void 0:s?ol(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&sl(e,r,n),n};let de=class extends U{constructor(){super(...arguments),this.isVisible=!1,this.popoverId=`popover-${Math.random().toString(36).substring(2,9)}`,this.disabled=!1,this.content="",this.placement="top",this.delay=300,this.showTimeout=null,this.hideTimeout=null,this.cleanup=null,this.triggerNode=null,this.mutationObserver=null,this.handleMouseEnter=()=>{this.disabled||this.scheduleShow()},this.handleMouseLeave=()=>{this.disabled||this.scheduleHide()},this.handleFocus=()=>{this.disabled||this.scheduleShow()},this.handleBlur=()=>{this.disabled||this.scheduleHide()}}firstUpdated(){this.handleSlotChange()}disconnectedCallback(){super.disconnectedCallback(),this.clearTimeouts(),this.stopPositionUpdates(),this.disconnectMutationObserver()}clearTimeouts(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}stopPositionUpdates(){this.cleanup&&(this.cleanup(),this.cleanup=null)}disconnectMutationObserver(){this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}checkTriggerDisabled(){if(!this.triggerNode)return;const t=this.triggerNode.hasAttribute("disabled")||this.triggerNode.disabled===!0||this.triggerNode.getAttribute("aria-disabled")==="true";this.disabled=t,this.clearTimeouts(),this.hide()}handleSlotChange(){this.triggerNode&&this.removeTriggerListeners(this.triggerNode),this.disconnectMutationObserver();const t=this.slotElement.assignedElements({flatten:!0});this.triggerNode=t[0]||null,this.triggerNode&&(this.triggerNode.setAttribute("aria-describedby",this.popoverId),this.checkTriggerDisabled(),this.mutationObserver=new MutationObserver(()=>{this.checkTriggerDisabled()}),this.mutationObserver.observe(this.triggerNode,{attributes:!0,attributeFilter:["disabled","aria-disabled"]}),this.addTriggerListeners(this.triggerNode))}addTriggerListeners(t){t.addEventListener("mouseenter",this.handleMouseEnter),t.addEventListener("mouseleave",this.handleMouseLeave),t.addEventListener("focus",this.handleFocus),t.addEventListener("blur",this.handleBlur)}removeTriggerListeners(t){t.removeEventListener("mouseenter",this.handleMouseEnter),t.removeEventListener("mouseleave",this.handleMouseLeave),t.removeEventListener("focus",this.handleFocus),t.removeEventListener("blur",this.handleBlur)}scheduleShow(){this.clearTimeouts(),this.showTimeout=window.setTimeout(()=>{this.show()},this.delay)}scheduleHide(){this.clearTimeouts(),this.hideTimeout=window.setTimeout(()=>{this.hide()},100)}async show(){!this.content||!this.triggerNode||(this.isVisible=!0,await this.updateComplete,this.startPositionUpdates())}hide(){this.isVisible=!1,this.stopPositionUpdates()}startPositionUpdates(){!this.triggerNode||!this.popoverElement||(this.cleanup=Xa(this.triggerNode,this.popoverElement,()=>{this.updatePosition()}))}async updatePosition(){if(!this.triggerNode||!this.popoverElement)return;const{x:t,y:e,placement:r,middlewareData:s}=await rl(this.triggerNode,this.popoverElement,{placement:this.placement,middleware:[Ja(8),el(),Qa({padding:8}),tl({element:this.arrowElement})]});if(Object.assign(this.popoverElement.style,{left:`${t}px`,top:`${e}px`}),s.arrow&&this.arrowElement){const{x:n,y:o}=s.arrow,i={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];Object.assign(this.arrowElement.style,{left:n!=null?`${n}px`:"",top:o!=null?`${o}px`:"",right:"",bottom:"",[i]:"-4px"})}}render(){return y.html`
64
+ <div class="trigger">
65
+ <slot @slotchange=${this.handleSlotChange}></slot>
111
66
  </div>
112
- </div>`}};Ee([w.property({type:Number,attribute:"max-input-length"})],be.prototype,"maxInputLength",2),Ee([w.property({attribute:!1})],be.prototype,"disabled",2),Ee([w.property({attribute:!1})],be.prototype,"loading",2),Ee([w.state()],be.prototype,"text",2),Ee([w.state()],be.prototype,"error",2),Ee([w.query('textarea[name="composer-textarea"]')],be.prototype,"textarea",2),be=Ee([w.customElement("gaia-chat-composer")],be);const fs='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-megaphone-icon lucide-megaphone"><path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/><path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14"/><path d="M8 6v8"/></svg>',Oo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minimize2-icon lucide-minimize-2"><path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/></svg>',ms='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pen-icon lucide-square-pen"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>';var Lo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,vt=(r,e,t,n)=>{for(var s=n>1?void 0:n?No(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Lo(e,t,s),s};let Ye=class extends te{constructor(){super(...arguments),this.hasEmptyMessages=!0,this.disabled=!1,this.closeable=!0}clearConversation(){this.dispatchEvent(new er)}openFeedbackForm(){this.dispatchEvent(new Qt("assistant"))}closeChat(){this.dispatchEvent(new Po)}render(){return g.html` <div class="relative w-full border-b border-solid border-neutral-300 p-4">
113
- <div class="flex items-center justify-between">
114
- <div class="flex">
115
- <h2 class="text-primary-900 text-sm font-bold">GAiA</h2>
116
- </div>
117
- <div class="flex items-center gap-0">
118
- <button
67
+ ${this.isVisible&&this.content?y.html` <div class="popover" role="tooltip" id=${this.popoverId} aria-label=${this.content}>
68
+ <div class="arrow"></div>
69
+ ${this.content}
70
+ </div>`:y.nothing}
71
+ `}};de.styles=[nl],ve([f.query(".trigger")],de.prototype,"triggerElement",2),ve([f.query(".popover")],de.prototype,"popoverElement",2),ve([f.query(".arrow")],de.prototype,"arrowElement",2),ve([f.query("slot")],de.prototype,"slotElement",2),ve([f.state()],de.prototype,"isVisible",2),ve([f.state()],de.prototype,"popoverId",2),ve([f.state()],de.prototype,"disabled",2),ve([f.property()],de.prototype,"content",2),ve([f.property()],de.prototype,"placement",2),ve([f.property({type:Number})],de.prototype,"delay",2),de=ve([f.customElement("gaia-popover")],de);const kt=Symbol("store"),il=Symbol("bootstrap-effect"),dn=Symbol("stream-effect"),xr=Symbol("support-effect"),un=Symbol("conversation-effect"),qs=Symbol("feedback-effect");class Bt extends CustomEvent{constructor(e,r){super(e,{...r,bubbles:!0,composed:!0})}}class Vs extends Bt{constructor(){super("conversation-cleared")}}class Gs extends Bt{constructor(e,r){super("message-sent",{detail:{message:e,channel:r}})}}class al extends Bt{constructor(e,r){super("tool-call-approved",{detail:{turnId:e,messageId:r}})}}class ll extends Bt{constructor(e,r){super("tool-call-declined",{detail:{turnId:e,messageId:r}})}}class cl extends Bt{constructor(){super("close-requested")}}const Ks={initialized:!1,maxInputLength:2e3,welcomeMessages:{}},hl=()=>({type:"config/setInitialized"}),dl=t=>({type:"config/set",payload:t}),ul=()=>({type:"config/clear"});function pl(t=Ks,e){switch(e.type){case"config/setInitialized":return{...t,initialized:!0};case"config/set":return{...t,...e.payload,initialized:!0};case"config/clear":return{...t,initialized:!1,welcomeMessages:{}};default:return t}}const Ys={entities:{},ids:[]},gl=t=>({type:"messages/set",payload:t}),Ye=t=>({type:"messages/add",payload:t}),fl=t=>({type:"messages/delete",payload:t}),Ne=(t,e)=>({type:"messages/patch",payload:{id:t,patch:e}}),ml=(t,e)=>({type:"messages/add-delta",payload:{id:t,delta:e}});function bl(t=Ys,e){switch(e.type){case"messages/set":return{...t,ids:e.payload.map(r=>r.messageId),entities:e.payload.reduce((r,s)=>({...r,[s.messageId]:s}),{})};case"messages/add":{const r=e.payload;return{...t,ids:[...t.ids,r.messageId],entities:{...t.entities,[r.messageId]:r}}}case"messages/delete":{const r={...t.entities};return delete r[e.payload],{...t,ids:t.ids.filter(s=>s!==e.payload),entities:r}}case"messages/patch":{const{id:r,patch:s}=e.payload,n=t.entities[r];return n?{...t,entities:{...t.entities,[r]:{...n,...s}}}:t}case"messages/add-delta":{const{id:r,delta:s}=e.payload,n=t.entities[r];if(!n)return t;const o=("content"in n?n.content:"")+s;return{...t,entities:{...t.entities,[r]:{...n,content:o}}}}default:return t}}const Zs={conversationId:null,cursorId:null,channel:"assistant",isActive:!0,isThinking:!1,isBusy:!1},Ut=t=>({type:"session/set-conversation-id",payload:t}),Ht=t=>({type:"session/set-cursor-id",payload:t}),pn=t=>({type:"session/set-channel",payload:t}),gn=t=>({type:"session/set-thinking",payload:t}),_r=t=>({type:"session/set-busy",payload:t});function wl(t=Zs,e){switch(e.type){case"session/set-conversation-id":return{...t,conversationId:e.payload};case"session/set-cursor-id":return{...t,cursorId:e.payload};case"session/set-channel":return{...t,channel:e.payload};case"session/set-active":return{...t,isActive:e.payload};case"session/set-thinking":return{...t,isThinking:e.payload};case"session/set-busy":return{...t,isBusy:e.payload};default:return t}}class xt extends Error{constructor(e,r,s,n,o,i){super(e),this.status=r,this.url=s,this.innerError=n,this.bodyText=o,this.problem=i,this.name="ApiError"}get isUnauthorized(){return this.status===401}get isForbidden(){return this.status===403}get isNotFound(){return this.status===404}get isServerError(){return this.status>=500}get isNetworkError(){return this.status===0}}class Xs extends Error{constructor(e,r){super(e),this.innerError=r,this.name="SignalRError"}}class fn extends Error{constructor(e,r,s){super(r),this.innerError=e,this.errorType=s}}function Wt(t){if(t instanceof DOMException&&t.name==="AbortError")return{code:"CANCELED",message:E("Request canceled.",{id:"error-request-canceled"}),retryable:!1,source:"ui",cause:t};if(t instanceof me){const e={code:"UNAUTHORIZED",retryable:!1,source:"auth",cause:t};return t instanceof ps?{...e,message:E("Your access token has expired.",{id:"error-token-expired"})}:t instanceof cr?{...e,message:E("Your access token is invalid.",{id:"error-token-invalid"})}:{...e,message:E("Authentication error. Please authenticate again.",{id:"error-auth-generic"})}}return t instanceof xt?t.isNetworkError?{code:"NETWORK",message:E("Network error. Check your connection.",{id:"error-network-error"}),retryable:!0,source:"http",http:{status:0,url:t.url},cause:t}:t.isUnauthorized?{code:"UNAUTHORIZED",message:E("Your session expired. Please sign in again.",{id:"error-session-expired"}),retryable:!1,source:"http",http:{status:401,url:t.url},cause:t}:t.isForbidden?{code:"FORBIDDEN",message:E("You don't have access to this action.",{id:"error-forbidden"}),retryable:!1,source:"http",http:{status:403,url:t.url},cause:t}:t.isNotFound?{code:"NOT_FOUND",message:E("Not found.",{id:"error-not-found"}),retryable:!1,source:"http",http:{status:404,url:t.url},cause:t}:t.status===429?{code:"RATE_LIMIT",message:E("Too many requests. Please slow down.",{id:"error-rate-limit"}),retryable:!0,source:"http",http:{status:429,url:t.url},cause:t}:t.isServerError?{code:"SERVER",message:E("The server had a problem. Please try again.",{id:"error-server-error"}),retryable:!0,source:"http",http:{status:t.status,url:t.url},cause:t}:{code:"UNKNOWN",message:E("Something went wrong.",{id:"error-something-went-wrong"}),retryable:!0,source:"http",http:{status:t.status,url:t.url},cause:t}:t instanceof fn?t.errorType&&t.errorType==="ProfileNotFoundException"?{code:"NOT_FOUND",message:E("Failed to load the current profile. Are you using the correct profile?",{id:"error-profile-not-found"}),retryable:!1}:{code:"SSE",message:E("Live response stream interrupted. Try again.",{id:"error-sse-error"}),retryable:!0,source:"sse",cause:t}:t instanceof Xs?{code:"WS",message:E("Live chat connection error. Reconnecting might help.",{id:"error-ws-error"}),retryable:!0,source:"ws",cause:t}:{code:"UNKNOWN",message:E("Unexpected error. Please try again.",{id:"error-unexpected-error"}),retryable:!0,source:"unknown",cause:t}}const Js={feedbackFormOpen:!1,feedbackFormTarget:"assistant",error:null,errorStack:[]},Qs=t=>({type:"ui/open-feedback-form",payload:{target:t}}),jt=()=>({type:"ui/close-feedback-form"}),Ze=t=>({type:"ui/set-error",payload:t}),vl=t=>({type:"ui/push-error",payload:t});function yl(t=Js,e){switch(e.type){case"ui/open-feedback-form":return{...t,feedbackFormOpen:!0,feedbackFormTarget:e.payload.target};case"ui/close-feedback-form":return{...t,feedbackFormOpen:!1};case"ui/set-error":return{...t,error:e.payload};case"ui/push-error":{const r=t.errorStack??[];return{...t,errorStack:[...r,e.payload],error:e.payload}}default:return t}}const mn={config:Ks,messages:Ys,session:Zs,ui:Js},eo="app/reset",kl=()=>({type:eo});function xl(t,e){if(e.type===eo)return{...mn,config:t.config};const r=t??mn;return{config:pl(r.config,e),messages:bl(r.messages,e),session:wl(r.session,e),ui:yl(r.ui,e)}}class _l{constructor(e=xl,r=mn){this.listeners=new Set,this.pending=!1,this.state=r,this.reducer=e}get snapshot(){return this.state}subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}dispatch(e){this.state=this.reducer(this.state,e),this.pending||(this.pending=!0,queueMicrotask(()=>{this.pending=!1;for(const r of this.listeners)r(this.state)}))}}const Sl=(()=>{let t=[],e={},r=[];return s=>(s.messages.ids===t&&s.messages.entities===e||(t=s.messages.ids,e=s.messages.entities,r=t.map(n=>e[n])),r)})(),Tl=y.css`
72
+ .app-header{display:flex;padding:8px}.menu{display:inline-flex;flex:0 0 auto;gap:4px;margin-left:auto}
73
+ `;var El=Object.defineProperty,Cl=Object.getOwnPropertyDescriptor,st=(t,e,r,s)=>{for(var n=s>1?void 0:s?Cl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&El(e,r,n),n};let ze=class extends U{constructor(){super(...arguments),this.disabled=!0,this.isFeedbackOpen=!1,this.closeable=!0}connectedCallback(){super.connectedCallback(),this.unsubscribe=this.store.subscribe(t=>{this.disabled=t.messages.ids.length===0||!t.session.isActive,this.isFeedbackOpen=t.ui.feedbackFormOpen})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.()}handleClearConversation(){this.conversationEffect?.clear(),this.supportEffect?.stop(),this.dispatchEvent(new Vs)}handleToggleFeedback(){this.isFeedbackOpen?this.store.dispatch(jt()):this.store.dispatch(Qs("assistant"))}handleCloseChat(){this.dispatchEvent(new cl)}render(){return y.html`<div class="app-header">
74
+ <div class="menu">
75
+ <gaia-popover content=${E("Open feedback",{id:"tooltip-open-feedback"})}>
76
+ <gaia-button
119
77
  data-testid="open-feedback-form-btn"
120
- type="button"
121
- aria-label="Open feedback form"
122
- class="btn btn-ghost p-1"
123
- @click=${this.openFeedbackForm}
124
- ?disabled=${this.hasEmptyMessages||this.disabled}
78
+ variant="ghost"
79
+ @click=${this.handleToggleFeedback}
80
+ ?disabled=${this.disabled}
125
81
  >
126
- <div class="flex size-4 items-center justify-center" aria-hidden="true">
127
- ${Kr.unsafeHTML(fs)}
128
- </div>
129
- </button>
130
- <button
82
+ <gaia-icon name="megaphone" label="Open feedback form"></gaia-icon>
83
+ </gaia-button>
84
+ </gaia-popover>
85
+ <gaia-popover content=${E("Clear conversation",{id:"tooltip-clear-conversation"})}>
86
+ <gaia-button
131
87
  data-testid="clear-conversation-btn"
132
- type="button"
133
- aria-label="Clear conversation"
134
- class="btn btn-ghost p-1"
135
- @click=${this.clearConversation}
136
- ?disabled=${this.hasEmptyMessages||this.disabled}
88
+ variant="ghost"
89
+ @click=${this.handleClearConversation}
90
+ ?disabled=${this.disabled}
137
91
  >
138
- <div class="flex size-4 items-center justify-center" aria-hidden="true">
139
- ${P.unsafeSVG(ms)}
140
- </div>
141
- </button>
142
- ${this.closeable?g.html`
143
- <button
144
- data-testid="close-chat-btn"
145
- type="button"
146
- aria-label="Minimize chat"
147
- class="btn btn-ghost p-1"
148
- @click=${this.closeChat}
149
- >
150
- <div class="flex size-4 items-center justify-center" aria-hidden="true">
151
- ${P.unsafeSVG(Oo)}
152
- </div>
153
- </button>
154
- `:g.nothing}
155
- </div>
92
+ <gaia-icon name="square-pen" label="Clear conversation"></gaia-icon>
93
+ </gaia-button>
94
+ </gaia-popover>
95
+ ${le.when(this.closeable,()=>y.html`
96
+ <gaia-popover content=${E("Minimize chat",{id:"tooltip-minimize-chat"})}>
97
+ <gaia-button
98
+ data-testid="close-chat-btn"
99
+ variant="ghost"
100
+ @click=${this.handleCloseChat}
101
+ >
102
+ <gaia-icon name="minimize-2" label="Minimize chat"></gaia-icon>
103
+ </gaia-button>
104
+ </gaia-popover>
105
+ `)}
156
106
  </div>
157
- </div>`}};vt([w.property({attribute:!1})],Ye.prototype,"hasEmptyMessages",2),vt([w.property({attribute:!1})],Ye.prototype,"disabled",2),vt([w.property({attribute:!1})],Ye.prototype,"closeable",2),Ye=vt([w.customElement("gaia-chat-menu")],Ye);const zo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>';var Fo=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,ws=(r,e,t,n)=>{for(var s=n>1?void 0:n?Uo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Fo(e,t,s),s};let tr=class extends te{clearError(){this.dispatchEvent(new $o)}render(){return this.error?g.html` <div
158
- role="alert"
159
- data-testid="error-message"
160
- aria-live="assertive"
161
- class="absolute bottom-0 left-1/2 z-50 flex w-full items-center justify-center"
162
- style="transform: translateX(-50%) translateY(16px)"
163
- >
107
+ </div>`}};ze.styles=[Tl],st([ce({context:kt})],ze.prototype,"store",2),st([ce({context:un})],ze.prototype,"conversationEffect",2),st([ce({context:xr})],ze.prototype,"supportEffect",2),st([f.state()],ze.prototype,"disabled",2),st([f.state()],ze.prototype,"isFeedbackOpen",2),st([f.property({attribute:!1})],ze.prototype,"closeable",2),ze=st([f.customElement("gaia-app-header")],ze);const Al=y.css`
108
+ .error-notification{align-items:start;background-color:var(--gaia-color-surface-error);border:1px solid var(--gaia-color-border-error);border-radius:4px;color:var(--gaia-color-text-error);display:flex;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);gap:16px;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);padding:16px;.icon{color:var(--gaia-color-icon-error)}.close{all:unset;color:var(--gaia-color-icon-primary);cursor:pointer}.icon,
109
+ .close{align-items:center;aspect-ratio:1/1;display:flex;flex:0 0 auto;height:100%;justify-content:center;width:auto}.message{flex:1 1 auto;word-break:break-word}}:host([absolute]){align-self:center;bottom:0;position:sticky;width:90%}
110
+ `;var Il=Object.defineProperty,Rl=Object.getOwnPropertyDescriptor,Sr=(t,e,r,s)=>{for(var n=s>1?void 0:s?Rl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&Il(e,r,n),n};let _t=class extends U{constructor(){super(...arguments),this.absolute=!1}handleClearError(){this.store.dispatch(Ze(null))}render(){return this.error?y.html`
164
111
  <div
165
- class="m-4 grid grid-cols-[auto_1fr_auto] gap-2 rounded-sm border border-solid border-red-600 bg-red-100 p-4 [grid-template-areas:'leading_primary_trailing']"
112
+ class="error-notification"
113
+ role="alert"
114
+ data-testid="error-notification"
115
+ aria-live="assertive"
166
116
  >
167
- <div class="flex [grid-area:primary]">
168
- <p class="text-primary-900 text-sm">${this.error.message}</p>
169
- </div>
170
- <div class="flex [grid-area:leading]">
171
- <div class="flex size-5 items-center justify-center text-red-600">
172
- ${P.unsafeSVG(Jt)}
173
- </div>
117
+ <div class="icon">
118
+ <gaia-icon name="octagon-alert" size="lg"></gaia-icon>
174
119
  </div>
175
- <div class="flex [grid-area:trailing]">
176
- <button class="btn self-start" @click=${this.clearError}>
177
- <div class="text-primary-900 flex size-5 items-center justify-center">
178
- ${P.unsafeSVG(zo)}
179
- </div>
120
+ <p class="message">${this.error.message}</p>
121
+ <button class="close" @click=${this.handleClearError}>
122
+ <gaia-icon name="x" size="lg" label="Close error notification"></gaia-icon>
123
+ </button>
124
+ </div>
125
+ `:y.nothing}};_t.styles=[Al],Sr([ce({context:kt})],_t.prototype,"store",2),Sr([f.property({type:Boolean,reflect:!0})],_t.prototype,"absolute",2),Sr([f.property({attribute:!1})],_t.prototype,"error",2),_t=Sr([f.customElement("gaia-error-notification")],_t);const Pl=y.css`
126
+ .feedback{padding-inline:8px;padding-top:16px}.card{background-color:var(--gaia-color-surface-primary);border:1px solid var(--gaia-color-border-primary);border-radius:4px;padding:16px;position:relative}.close{all:unset;align-items:center;aspect-ratio:1/1;color:var(--gaia-color-text-body);cursor:pointer;display:inline-flex;font-size:var(--gaia-font-size-xl);height:var(--gaia-font-size-xl);justify-content:center;position:absolute;right:8px;top:8px}.title{color:var(--gaia-color-text-headings);font-size:var(--gaia-font-size-lg);font-weight:var(--gaia-font-weight-bold);letter-spacing:var(--gaia-letter-spacing-lg);line-height:var(--gaia-line-height-lg)}.description{color:var(--gaia-color-text-body);font-size:var(--gaia-font-size-sm);font-weight:var(--gaia-font-weight-regular);letter-spacing:var(--gaia-letter-spacing-sm);line-height:var(--gaia-line-height-sm)}.description,.form-group{margin-bottom:16px}.feedback .form-group > label,
127
+ .feedback fieldset > legend{color:var(--gaia-color-text-body);display:inline-block;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-medium);letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);margin-bottom:8px}.form-control,.form-hint{display:block}.form-hint{color:var(--gaia-color-text-body);font-size:var(--gaia-font-size-xs);font-weight:var(--gaia-font-weight-regular);letter-spacing:var(--gaia-letter-spacing-xs);line-height:var(--gaia-line-height-xs);margin-top:4px}fieldset{border:none;padding:0}.rating{display:block}.rating-item{display:inline-block;input{display:none}label{align-items:center;aspect-ratio:1/1;color:var(--gaia-color-icon-on-disabled);cursor:pointer;display:inline-flex;font-size:28px;justify-content:center}&:has(input:checked) label,
128
+ &:hover label{gaia-icon::part(svg){fill:var(--symbol-background-color-active);stroke:var(--symbol-color-active);transform:scale(1.1);transition:transform .2s ease-in-out}}}.rating-item:first-of-type{--symbol-color-active:oklch(40% 0.15 30deg);--symbol-background-color-active:oklch(80% 0.15 30deg)}.rating-item:nth-of-type(2){--symbol-color-active:oklch(40% 0.15 60deg);--symbol-background-color-active:oklch(80% 0.15 60deg)}.rating-item:nth-of-type(3){--symbol-color-active:oklch(40% 0.15 90deg);--symbol-background-color-active:oklch(80% 0.15 90deg)}.rating-item:nth-of-type(4){--symbol-color-active:oklch(40% 0.15 120deg);--symbol-background-color-active:oklch(80% 0.15 120deg)}.rating-item:nth-of-type(5){--symbol-color-active:oklch(40% 0.15 150deg);--symbol-background-color-active:oklch(80% 0.15 150deg)}textarea{background-color:var(--gaia-color-surface-primary);border:1px solid var(--gaia-color-border-primary);border-radius:4px;color:var(--gaia-color-text-body);font-family:var(--gaia-font-family);font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);overflow-y:auto;padding:8px;resize:none;width:100%;&::-moz-placeholder{color:var(--gaia-color-text-disabled)}&::placeholder{color:var(--gaia-color-text-disabled)}&:focus{outline:2px solid var(--gaia-color-border-focus)}}.form-actions{display:flex;flex-wrap:wrap;gap:8px}
129
+ `;var $l=Object.defineProperty,Ol=Object.getOwnPropertyDescriptor,Xe=(t,e,r,s)=>{for(var n=s>1?void 0:s?Ol(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&$l(e,r,n),n};let Pe=class extends U{constructor(){super(...arguments),this.selectedRating=0,this.comment="",this.target="assistant"}connectedCallback(){super.connectedCallback(),this.unsubscribe=this.store?.subscribe(t=>{this.target=t.ui.feedbackFormTarget})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.()}canSubmit(){return this.selectedRating>0&&this.selectedRating<=5}handleRatingChange(t){const e=t.target.value;this.selectedRating=Number(e)}handleCommentChange(t){this.comment=t.target.value}handleSubmit(){this.canSubmit()&&this.feedbackEffect?.submitFeedback(this.target,this.selectedRating,this.comment)}handleReset(){this.comment=this.commentInput.value="",this.ratingInput.querySelectorAll("input").forEach(t=>{t.checked=!1}),this.selectedRating=0}handleClose(){this.store?.dispatch(jt())}render(){return y.html`
130
+ <div class="feedback" data-testid="feedback-form">
131
+ <div class="card">
132
+ <button class="close" @click=${this.handleClose}>
133
+ <gaia-icon name="x" label="Close"></gaia-icon>
180
134
  </button>
135
+ <h2 class="title">${E("Feedback",{id:"feedback-form-title"})}</h2>
136
+ <p class="description">
137
+ ${E("Please share your thoughts and suggestions to help us improve.",{id:"feedback-form-description"})}
138
+ </p>
139
+ <div class="form">
140
+ <div class="form-group">
141
+ <fieldset id="rating" class="rating form-control" @change=${this.handleRatingChange}>
142
+ <legend>
143
+ ${le.when(this.target==="support",()=>E("How satisfied are you with the help you received?",{id:"feedback-form-satisfaction-title--support"}),()=>E("How satisfied are you with the assistant?",{id:"feedback-form-satisfaction-title--assistant"}))}
144
+ </legend>
145
+ <div class="rating-item">
146
+ <input type="radio" id="rating-1" name="rating" value="1" />
147
+ <label for="rating-1">
148
+ <gaia-icon name="angry" size="xl" label="Very dissatisfied"></gaia-icon>
149
+ </label>
150
+ </div>
151
+ <div class="rating-item">
152
+ <input type="radio" id="rating-2" name="rating" value="2" />
153
+ <label for="rating-2">
154
+ <gaia-icon name="frown" size="xl" label="Dissatisfied"></gaia-icon>
155
+ </label>
156
+ </div>
157
+ <div class="rating-item">
158
+ <input type="radio" id="rating-3" name="rating" value="3" />
159
+ <label for="rating-3">
160
+ <gaia-icon name="meh" size="xl" label="Neutral"></gaia-icon>
161
+ </label>
162
+ </div>
163
+ <div class="rating-item">
164
+ <input type="radio" id="rating-4" name="rating" value="4" />
165
+ <label for="rating-4">
166
+ <gaia-icon name="smile" size="xl" label="Satisfied"></gaia-icon>
167
+ </label>
168
+ </div>
169
+ <div class="rating-item">
170
+ <input type="radio" id="rating-5" name="rating" value="5" />
171
+ <label for="rating-5">
172
+ <gaia-icon name="laugh" size="xl" label="Very satisfied"></gaia-icon>
173
+ </label>
174
+ </div>
175
+ </fieldset>
176
+ <small class="form-hint"
177
+ >${E("Very dissatisfied → Very satisfied",{id:"feedback-form-rating-hint"})}</small
178
+ >
179
+ </div>
180
+ <div class="form-group">
181
+ <label for="comment">
182
+ ${E("Any additional comments?",{id:"feedback-form-comments-title"})}
183
+ </label>
184
+ <textarea
185
+ id="comment"
186
+ name="comment"
187
+ class="form-control"
188
+ rows="5"
189
+ spellcheck=${!1}
190
+ placeholder=${E("Enter your comment here",{id:"feedback-form-comment-placeholder"})}
191
+ @input=${this.handleCommentChange}
192
+ ></textarea>
193
+ </div>
194
+
195
+ <div class="form-actions">
196
+ <gaia-button ?disabled=${!this.canSubmit()} @click=${this.handleSubmit}
197
+ >${E("Submit",{id:"feedback-form-submit"})}</gaia-button
198
+ >
199
+ <gaia-button variant="secondary" @click=${this.handleReset}
200
+ >${E("Reset",{id:"feedback-form-reset"})}</gaia-button
201
+ >
202
+ </div>
203
+ </div>
181
204
  </div>
182
205
  </div>
183
- </div>`:g.nothing}};ws([w.property({attribute:!1})],tr.prototype,"error",2),tr=ws([w.customElement("gaia-chat-error")],tr);const Bo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send-icon lucide-send"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/></svg>';var Ho=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,rr=(r,e,t,n)=>{for(var s=n>1?void 0:n?jo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Ho(e,t,s),s};let yt=class extends te{constructor(){super(...arguments),this.ratings=[1,2,3,4,5],this.target="assistant",this.textareaRef=es.createRef(),this.selectedRating=0,this.onSubmit=()=>{const r=this.textareaRef.value?.value??null;this.isValid&&(this.dispatchEvent(new Ao(this.target,this.selectedRating,r)),this.target==="support"&&this.dispatchEvent(new er))},this.onCancel=()=>{this.dispatchEvent(new Qt(null))}}onRatingClick(r){this.selectedRating=r}get isValid(){return this.selectedRating>0&&this.selectedRating<=5}render(){return g.html` <div data-testid="feedback-form" class="relative w-full px-2 py-3">
184
- <div
185
- class="text-primary-900 flex flex-col gap-y-4 rounded-sm border border-solid border-neutral-600 p-4"
186
- >
187
- <div>
188
- <h4 class="pb-2 text-sm font-bold">${y("Feedback",{id:"feedback-form-title"})}</h4>
189
- <p class="text-xs">
190
- ${y("Please share your thoughts and suggestions to help us improve.",{id:"feedback-form-description"})}
191
- </p>
206
+ `}};Pe.styles=[Pl],Xe([ce({context:kt})],Pe.prototype,"store",2),Xe([ce({context:qs})],Pe.prototype,"feedbackEffect",2),Xe([f.query("#rating")],Pe.prototype,"ratingInput",2),Xe([f.query("#comment")],Pe.prototype,"commentInput",2),Xe([f.state()],Pe.prototype,"selectedRating",2),Xe([f.state()],Pe.prototype,"comment",2),Xe([f.state()],Pe.prototype,"target",2),Pe=Xe([f.customElement("gaia-feedback")],Pe);const Dl=y.css`
207
+ :host{--avatar-size:24px}.avatar{color:var(--gaia-color-text-headings);font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-medium);gap:4px;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base)}.avatar,.image{align-items:center;display:flex;justify-content:center}.image{aspect-ratio:1/1;border:1px solid transparent;border-radius:50%;height:var(--avatar-size);-o-object-fit:cover;object-fit:cover;overflow:hidden;width:var(--avatar-size)}.label{align-items:center;display:inline-flex;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-medium);letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base)}:host([bordered]) .image{border-color:var(--gaia-color-border-primary)}
208
+ `;var Ml=Object.defineProperty,Ll=Object.getOwnPropertyDescriptor,St=(t,e,r,s)=>{for(var n=s>1?void 0:s?Ll(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&Ml(e,r,n),n};let Je=class extends U{constructor(){super(...arguments),this.hasError=!1,this.label="GAiA",this.image=void 0,this.icon="user-round",this.bordered=!1,this.handleImageLoadError=()=>{this.hasError=!0}}render(){const t=y.html`<img
209
+ class="image"
210
+ src=${Kr.ifDefined(this.image)}
211
+ alt=${this.label}
212
+ loading="eager"
213
+ @error=${()=>this.handleImageLoadError()}
214
+ />`,e=y.html`<gaia-icon
215
+ name=${this.icon}
216
+ class="image"
217
+ size="base"
218
+ ></gaia-icon>`;return y.html`<div class="avatar">
219
+ ${le.when(this.image&&!this.hasError,()=>t,()=>e)}
220
+ <slot class="label">${this.label}</slot>
221
+ </div>`}};Je.styles=[Dl],St([f.state()],Je.prototype,"hasError",2),St([f.property()],Je.prototype,"label",2),St([f.property()],Je.prototype,"image",2),St([f.property()],Je.prototype,"icon",2),St([f.property({type:Boolean,reflect:!0})],Je.prototype,"bordered",2),Je=St([f.customElement("gaia-avatar")],Je);const Nl=y.css`
222
+ .message{align-items:start;container:message/inline-size;flex-direction:column;padding:0 16px 16px}.header,.message{display:flex;gap:4px;justify-content:flex-start}.header{align-items:center;flex-direction:row}.body{color:var(--gaia-color-text-body);display:flex;flex-direction:column;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);gap:8px;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);max-width:100%;overflow:hidden}:host(:not([from=assistant])) .message .body{border-radius:4px;padding:12px 16px}:host([from=operator]) .message .body{background-color:var(--gaia-color-message-operator)}:host([from=user]) .message{align-items:end;justify-content:flex-end;.body{background-color:var(--gaia-color-message-user)}}:host([from=system]) .message{align-items:center;justify-content:center;.body{background-color:var(--gaia-color-message-system)}}.actions{display:flex;flex-wrap:wrap;gap:4px}
223
+ `;var zl=Object.defineProperty,Fl=Object.getOwnPropertyDescriptor,to=(t,e,r,s)=>{for(var n=s>1?void 0:s?Fl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&zl(e,r,n),n};let Tr=class extends U{constructor(){super(...arguments),this.from="user"}render(){return y.html`
224
+ <div class="message">
225
+ <div class="header">
226
+ <div class="avatar">
227
+ <slot name="avatar"></slot>
228
+ </div>
192
229
  </div>
193
- <div>
194
- <h4 class="pb-2 text-sm font-medium">
195
- ${this.target==="support"?y("How satisfied are you with the help you received?",{id:"feedback-form-satisfaction-title--support"}):y("How satisfied are you with the assistant?",{id:"feedback-form-satisfaction-title--assistant"})}
196
- </h4>
197
- <div class="flex items-center gap-x-2">
198
- ${Qr.map(this.ratings,r=>g.html`
199
- <button
200
- class="btn btn-secondary data-[selected=true]:text-primary-900 data-[selected=true]:bg-secondary-200 size-8"
201
- @click=${()=>this.onRatingClick(r)}
202
- data-selected=${this.selectedRating===r}
203
- >
204
- <div class="flex items-center justify-center">${r}</div>
205
- </button>
206
- `)}
230
+ <div class="body">
231
+ <slot name="pre-content"></slot>
232
+ <div class="content markdown">
233
+ <slot></slot>
207
234
  </div>
208
235
  </div>
209
- <div>
210
- <h4 class="pb-2 text-sm font-medium">
211
- ${y("Any additional comments?",{id:"feedback-form-comments-title"})}
212
- </h4>
213
- <textarea
214
- ${es.ref(this.textareaRef)}
215
- name="feedback-comment"
216
- class="text-primary-900 placeholder:text-utility-gray outline-primary-800 h-24 w-full resize-none rounded-sm border border-solid border-neutral-600 p-2 text-sm active:outline-2"
217
- spellcheck="false"
218
- placeholder=${y("Enter your comment here",{id:"feedback-form-comment-placeholder"})}
219
- ></textarea>
236
+ <div class="footer">
237
+ <div class="actions">
238
+ <slot name="actions"></slot>
239
+ </div>
220
240
  </div>
221
- <div class="flex items-center justify-end gap-x-2">
222
- <button
223
- class="btn btn-primary px-4 py-2"
224
- ?disabled=${!this.isValid}
225
- @click=${this.onSubmit}
226
- >
227
- <div class="flex items-center justify-center gap-x-2">
228
- <div class="flex size-4 items-center justify-center">${P.unsafeSVG(Bo)}</div>
229
- ${y("Submit feedback",{id:"feedback-form-submit"})}
230
- </div>
231
- </button>
232
- <button class="btn btn-secondary px-4 py-2" @click=${this.onCancel}>
233
- <div class="flex items-center justify-center">
234
- ${y("Cancel",{id:"feedback-form-cancel"})}
235
- </div>
241
+ </div>
242
+ `}};Tr.styles=[Nl],to([f.property({reflect:!0})],Tr.prototype,"from",2),Tr=to([f.customElement("gaia-message")],Tr);const Bl=y.css`
243
+ :host{display:block;max-width:100%}.source-list{background-color:var(--gaia-color-surface-primary);border:1px solid var(--gaia-color-border-tertiary);border-radius:4px;overflow:hidden;width:100%}.trigger{color:var(--gaia-color-text-body);font-size:var(--gaia-font-size-sm);font-weight:var(--gaia-font-weight-medium);letter-spacing:var(--gaia-letter-spacing-sm);line-height:var(--gaia-line-height-sm);padding:8px;button{all:unset;align-items:center;cursor:pointer;display:flex;gap:4px;width:100%}.trigger-icon{font-size:16px}}.sources{display:flex;flex-direction:column;height:0;opacity:0;overflow:hidden;transition:
244
+ height 0.2s ease-in-out,
245
+ visibility 0.2s ease-in-out,
246
+ opacity 0.2s ease-in-out;visibility:hidden}:host([open]){.trigger-icon{transform:rotate(90deg)}.sources{height:auto;opacity:1;visibility:visible}}.source{align-items:start;color:var(--gaia-color-text-body);display:flex;flex-direction:row;gap:4px;padding:8px;text-decoration:none;width:100%;&:hover{background-color:var(--gaia-color-surface-page)}}.source-icon{display:flex;flex:0 0 auto;font-size:16px;padding-top:3px}.source-content{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.source-title{font-size:var(--gaia-font-size-sm);font-weight:var(--gaia-font-weight-medium);letter-spacing:var(--gaia-letter-spacing-sm);line-height:var(--gaia-line-height-sm)}.source-url{color:var(--gaia-color-text-on-disabled);font-size:var(--gaia-font-size-xs);font-weight:var(--gaia-font-weight-regular);letter-spacing:var(--gaia-letter-spacing-xs);line-height:var(--gaia-line-height-xs)}.source-title,
247
+ .source-url{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-word}
248
+ `;var Ul=Object.defineProperty,Hl=Object.getOwnPropertyDescriptor,bn=(t,e,r,s)=>{for(var n=s>1?void 0:s?Hl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&Ul(e,r,n),n};let qt=class extends U{constructor(){super(...arguments),this.open=!1,this.sources=[]}handleTriggerClick(){this.open=!this.open}resolveIcon(t){switch(new URL(t.url).hostname){case"vismasoftware.docebosaas.com":return"learning-universe";case"kundeportal.vismasoftware.no":return"vsn";default:return"globe"}}render(){return y.html`
249
+ <div class="source-list">
250
+ <h2 class="trigger">
251
+ <button @click=${this.handleTriggerClick}>
252
+ <gaia-icon name="chevron-right" class="trigger-icon"></gaia-icon>
253
+ ${E(ft`Found ${this.sources.length} sources`,{id:"source-list-found-sources"})}
236
254
  </button>
255
+ </h2>
256
+ <section class="sources">
257
+ ${cs.map(this.sources,t=>y.html`<a class="source" href="${t.url}" target="_blank" rel="noopener noreferrer">
258
+ <div class="source-icon">
259
+ <gaia-icon name=${this.resolveIcon(t)} size="lg"></gaia-icon>
260
+ </div>
261
+ <div class="source-content">
262
+ <span class="source-title">${t.title}</span>
263
+ <span class="source-url">${t.url}</span>
264
+ </div>
265
+ </a>`)}
266
+ </section>
267
+ </div>
268
+ `}};qt.styles=[Bl],bn([f.property({type:Boolean,reflect:!0})],qt.prototype,"open",2),bn([f.property({type:Array,attribute:!1})],qt.prototype,"sources",2),qt=bn([f.customElement("gaia-source-list")],qt);const Wl=y.css`
269
+ :host{--duration:1.5s;--size:8px}.typing-indicator{align-items:center;display:inline-flex;gap:4px;justify-content:center}.typing-dot{animation:typing-dot-animation var(--duration) ease-in-out infinite;background-color:var(--gaia-color-text-body);border-radius:50%;height:var(--size);width:var(--size)}.typing-dot:nth-child(2){animation-delay:calc(var(--duration)*.33333)}.typing-dot:nth-child(3){animation-delay:calc(var(--duration)*2/3)}@keyframes typing-dot-animation{0%,
270
+ 100%{opacity:.5;transform:scale(.8)}50%{opacity:1;transform:scale(1.2)}}
271
+ `;var jl=Object.getOwnPropertyDescriptor,ql=(t,e,r,s)=>{for(var n=s>1?void 0:s?jl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=i(n)||n);return n};let wn=class extends U{render(){return y.html`<div class="typing-indicator">
272
+ <span class="typing-dot"></span>
273
+ <span class="typing-dot"></span>
274
+ <span class="typing-dot"></span>
275
+ </div>`}};wn.styles=[Wl],wn=ql([f.customElement("gaia-typing-indicator")],wn);const Vl=y.css`
276
+ :host{display:block;height:100%}.welcome-message-container{display:flex;flex-direction:column;gap:16px;height:100%;margin:0 auto;max-width:var(--gaia-container-2xl);overflow-y:auto;width:100%}.welcome-message{color:var(--gaia-color-text-body);display:flex;flex-direction:column;font-family:var(--gaia-font-family);font-size:var(--gaia-font-size-base);gap:16px;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);margin:auto 0;padding-inline:16px}.title,.welcome-message{font-weight:var(--gaia-font-weight-regular)}.title{color:var(--gaia-color-text-headings);font-size:var(--gaia-font-size-3xl);letter-spacing:var(--gaia-letter-spacing-3xl);line-height:var(--gaia-line-height-3xl)}.body,.title{text-align:center}.blocks{display:flex;flex-direction:column;gap:32px;margin-block:16px}.block{align-items:flex-start;display:flex;flex-direction:row;gap:16px}.block-icon{color:var(--gaia-color-icon-primary)}.block-headline{color:var(--gaia-color-text-headings);font-weight:var(--gaia-font-weight-medium)}.block-headline,.block-text{font-size:var(--gaia-font-size-base);letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base)}.block-text{font-weight:var(--gaia-font-weight-regular)}.block-content{display:flex;flex-direction:column}.call-to-action{color:var(--gaia-color-text-body);font-weight:var(--gaia-font-weight-medium)}
277
+ `;var Gl=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,vn=(t,e,r,s)=>{for(var n=s>1?void 0:s?Kl(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&Gl(e,r,n),n};const yn={SparklesIcon:"sparkles",LightBulbIcon:"lightbulb",MessageCircleIcon:"message-circle",MegaphoneIcon:"megaphone"};let Vt=class extends U{constructor(){super(...arguments),this.isInitialized=!1}getIcon(t){return t in yn?yn[t]:"lightbulb"}render(){return y.html`
278
+ <div class="welcome-message-container">
279
+ <div class="welcome-message">
280
+ <h1 class="title">${this.welcomeMessage?.title}</h1>
281
+ <p class="body">${this.welcomeMessage?.body}</p>
282
+ <div class="blocks">
283
+ ${cs.map(this.welcomeMessage?.blocks,t=>y.html`
284
+ <div class="block">
285
+ <gaia-icon class="block-icon" size="2xl" name=${yn[t.icon]}></gaia-icon>
286
+ <div class="block-content">
287
+ <h2 class="block-headline">${t.headline}</h2>
288
+ <p class="block-text">${t.text}</p>
289
+ </div>
290
+ </div>
291
+ `)}
292
+ </div>
293
+ <div class="call-to-action">
294
+ <p>${this.welcomeMessage?.callToAction}</p>
295
+ </div>
237
296
  </div>
238
297
  </div>
239
- </div>`}};rr([w.property({type:String,attribute:"target"})],yt.prototype,"target",2),rr([w.state()],yt.prototype,"selectedRating",2),yt=rr([w.customElement("gaia-chat-feedback-form")],yt);const qo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>',Wo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>',Vo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-x-icon lucide-circle-x"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',Go='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',Xe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles-icon lucide-sparkles"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg>';/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:bs,setPrototypeOf:vs,isFrozen:Yo,getPrototypeOf:Xo,getOwnPropertyDescriptor:Zo}=Object;let{freeze:W,seal:J,create:ys}=Object,{apply:sr,construct:nr}=typeof Reflect<"u"&&Reflect;W||(W=function(e){return e}),J||(J=function(e){return e}),sr||(sr=function(e,t,n){return e.apply(t,n)}),nr||(nr=function(e,t){return new e(...t)});const kt=G(Array.prototype.forEach),Ko=G(Array.prototype.lastIndexOf),ks=G(Array.prototype.pop),Ze=G(Array.prototype.push),Jo=G(Array.prototype.splice),_t=G(String.prototype.toLowerCase),or=G(String.prototype.toString),_s=G(String.prototype.match),Ke=G(String.prototype.replace),Qo=G(String.prototype.indexOf),ei=G(String.prototype.trim),re=G(Object.prototype.hasOwnProperty),V=G(RegExp.prototype.test),Je=ti(TypeError);function G(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return sr(r,e,n)}}function ti(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return nr(r,t)}}function k(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_t;vs&&vs(r,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const o=t(s);o!==s&&(Yo(e)||(e[n]=o),s=o)}r[s]=!0}return r}function ri(r){for(let e=0;e<r.length;e++)re(r,e)||(r[e]=null);return r}function he(r){const e=ys(null);for(const[t,n]of bs(r))re(r,t)&&(Array.isArray(n)?e[t]=ri(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=he(n):e[t]=n);return e}function Qe(r,e){for(;r!==null;){const n=Zo(r,e);if(n){if(n.get)return G(n.get);if(typeof n.value=="function")return G(n.value)}r=Xo(r)}function t(){return null}return t}const xs=W(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ir=W(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ar=W(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),si=W(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),lr=W(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ni=W(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ss=W(["#text"]),Es=W(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cr=W(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ts=W(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xt=W(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),oi=J(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ii=J(/<%[\w\W]*|[\w\W]*%>/gm),ai=J(/\$\{[\w\W]*/gm),li=J(/^data-[\-\w.\u00B7-\uFFFF]+$/),ci=J(/^aria-[\-\w]+$/),Cs=J(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hi=J(/^(?:\w+script|data):/i),di=J(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=J(/^html$/i),pi=J(/^[a-z][.\w]*(-[.\w]+)+$/i);var As=Object.freeze({__proto__:null,ARIA_ATTR:ci,ATTR_WHITESPACE:di,CUSTOM_ELEMENT:pi,DATA_ATTR:li,DOCTYPE_NAME:Is,ERB_EXPR:ii,IS_ALLOWED_URI:Cs,IS_SCRIPT_OR_DATA:hi,MUSTACHE_EXPR:oi,TMPLIT_EXPR:ai});const et={element:1,text:3,progressingInstruction:7,comment:8,document:9},ui=function(){return typeof window>"u"?null:window},gi=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},$s=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rs(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ui();const e=m=>Rs(m);if(e.version="3.2.6",e.removed=[],!r||!r.document||r.document.nodeType!==et.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,s=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:c,NodeFilter:d,NamedNodeMap:u=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:v,DOMParser:_,trustedTypes:R}=r,T=c.prototype,x=Qe(T,"cloneNode"),M=Qe(T,"remove"),ee=Qe(T,"nextSibling"),ke=Qe(T,"childNodes"),oe=Qe(T,"parentNode");if(typeof i=="function"){const m=t.createElement("template");m.content&&m.content.ownerDocument&&(t=m.content.ownerDocument)}let z,Re="";const{implementation:Pe,createNodeIterator:Me,createDocumentFragment:sc,getElementsByTagName:nc}=t,{importNode:oc}=n;let X=$s();e.isSupported=typeof bs=="function"&&typeof oe=="function"&&Pe&&Pe.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Or,ERB_EXPR:Lr,TMPLIT_EXPR:Nr,DATA_ATTR:ic,ARIA_ATTR:ac,IS_SCRIPT_OR_DATA:lc,ATTR_WHITESPACE:Sn,CUSTOM_ELEMENT:cc}=As;let{IS_ALLOWED_URI:En}=As,F=null;const Tn=k({},[...xs,...ir,...ar,...lr,...Ss]);let B=null;const Cn=k({},[...Es,...cr,...Ts,...xt]);let D=Object.seal(ys(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),dt=null,zr=null,In=!0,Fr=!0,An=!1,$n=!0,Ne=!1,Nt=!0,De=!1,Ur=!1,Br=!1,ze=!1,zt=!1,Ft=!1,Rn=!0,Pn=!1;const hc="user-content-";let Hr=!0,pt=!1,Fe={},Ue=null;const Mn=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Dn=null;const On=k({},["audio","video","img","source","image","track"]);let jr=null;const Ln=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let Be=fe,qr=!1,Wr=null;const dc=k({},[Ut,Bt,fe],or);let Ht=k({},["mi","mo","mn","ms","mtext"]),jt=k({},["annotation-xml"]);const pc=k({},["title","style","font","a","script"]);let ut=null;const uc=["application/xhtml+xml","text/html"],gc="text/html";let U=null,He=null;const fc=t.createElement("form"),Nn=function(l){return l instanceof RegExp||l instanceof Function},Vr=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(He&&He===l)){if((!l||typeof l!="object")&&(l={}),l=he(l),ut=uc.indexOf(l.PARSER_MEDIA_TYPE)===-1?gc:l.PARSER_MEDIA_TYPE,U=ut==="application/xhtml+xml"?or:_t,F=re(l,"ALLOWED_TAGS")?k({},l.ALLOWED_TAGS,U):Tn,B=re(l,"ALLOWED_ATTR")?k({},l.ALLOWED_ATTR,U):Cn,Wr=re(l,"ALLOWED_NAMESPACES")?k({},l.ALLOWED_NAMESPACES,or):dc,jr=re(l,"ADD_URI_SAFE_ATTR")?k(he(Ln),l.ADD_URI_SAFE_ATTR,U):Ln,Dn=re(l,"ADD_DATA_URI_TAGS")?k(he(On),l.ADD_DATA_URI_TAGS,U):On,Ue=re(l,"FORBID_CONTENTS")?k({},l.FORBID_CONTENTS,U):Mn,dt=re(l,"FORBID_TAGS")?k({},l.FORBID_TAGS,U):he({}),zr=re(l,"FORBID_ATTR")?k({},l.FORBID_ATTR,U):he({}),Fe=re(l,"USE_PROFILES")?l.USE_PROFILES:!1,In=l.ALLOW_ARIA_ATTR!==!1,Fr=l.ALLOW_DATA_ATTR!==!1,An=l.ALLOW_UNKNOWN_PROTOCOLS||!1,$n=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=l.SAFE_FOR_TEMPLATES||!1,Nt=l.SAFE_FOR_XML!==!1,De=l.WHOLE_DOCUMENT||!1,ze=l.RETURN_DOM||!1,zt=l.RETURN_DOM_FRAGMENT||!1,Ft=l.RETURN_TRUSTED_TYPE||!1,Br=l.FORCE_BODY||!1,Rn=l.SANITIZE_DOM!==!1,Pn=l.SANITIZE_NAMED_PROPS||!1,Hr=l.KEEP_CONTENT!==!1,pt=l.IN_PLACE||!1,En=l.ALLOWED_URI_REGEXP||Cs,Be=l.NAMESPACE||fe,Ht=l.MATHML_TEXT_INTEGRATION_POINTS||Ht,jt=l.HTML_INTEGRATION_POINTS||jt,D=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&Nn(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&Nn(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Fr=!1),zt&&(ze=!0),Fe&&(F=k({},Ss),B=[],Fe.html===!0&&(k(F,xs),k(B,Es)),Fe.svg===!0&&(k(F,ir),k(B,cr),k(B,xt)),Fe.svgFilters===!0&&(k(F,ar),k(B,cr),k(B,xt)),Fe.mathMl===!0&&(k(F,lr),k(B,Ts),k(B,xt))),l.ADD_TAGS&&(F===Tn&&(F=he(F)),k(F,l.ADD_TAGS,U)),l.ADD_ATTR&&(B===Cn&&(B=he(B)),k(B,l.ADD_ATTR,U)),l.ADD_URI_SAFE_ATTR&&k(jr,l.ADD_URI_SAFE_ATTR,U),l.FORBID_CONTENTS&&(Ue===Mn&&(Ue=he(Ue)),k(Ue,l.FORBID_CONTENTS,U)),Hr&&(F["#text"]=!0),De&&k(F,["html","head","body"]),F.table&&(k(F,["tbody"]),delete dt.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=l.TRUSTED_TYPES_POLICY,Re=z.createHTML("")}else z===void 0&&(z=gi(R,s)),z!==null&&typeof Re=="string"&&(Re=z.createHTML(""));W&&W(l),He=l}},zn=k({},[...ir,...ar,...si]),Fn=k({},[...lr,...ni]),mc=function(l){let p=oe(l);(!p||!p.tagName)&&(p={namespaceURI:Be,tagName:"template"});const f=_t(l.tagName),A=_t(p.tagName);return Wr[l.namespaceURI]?l.namespaceURI===Bt?p.namespaceURI===fe?f==="svg":p.namespaceURI===Ut?f==="svg"&&(A==="annotation-xml"||Ht[A]):!!zn[f]:l.namespaceURI===Ut?p.namespaceURI===fe?f==="math":p.namespaceURI===Bt?f==="math"&&jt[A]:!!Fn[f]:l.namespaceURI===fe?p.namespaceURI===Bt&&!jt[A]||p.namespaceURI===Ut&&!Ht[A]?!1:!Fn[f]&&(pc[f]||!zn[f]):!!(ut==="application/xhtml+xml"&&Wr[l.namespaceURI]):!1},le=function(l){Ze(e.removed,{element:l});try{oe(l).removeChild(l)}catch{M(l)}},je=function(l,p){try{Ze(e.removed,{attribute:p.getAttributeNode(l),from:p})}catch{Ze(e.removed,{attribute:null,from:p})}if(p.removeAttribute(l),l==="is")if(ze||zt)try{le(p)}catch{}else try{p.setAttribute(l,"")}catch{}},Un=function(l){let p=null,f=null;if(Br)l="<remove></remove>"+l;else{const N=_s(l,/^[\r\n\t ]+/);f=N&&N[0]}ut==="application/xhtml+xml"&&Be===fe&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const A=z?z.createHTML(l):l;if(Be===fe)try{p=new _().parseFromString(A,ut)}catch{}if(!p||!p.documentElement){p=Pe.createDocument(Be,"template",null);try{p.documentElement.innerHTML=qr?Re:A}catch{}}const j=p.body||p.documentElement;return l&&f&&j.insertBefore(t.createTextNode(f),j.childNodes[0]||null),Be===fe?nc.call(p,De?"html":"body")[0]:De?p.documentElement:j},Bn=function(l){return Me.call(l.ownerDocument||l,l,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Gr=function(l){return l instanceof v&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof u)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Hn=function(l){return typeof a=="function"&&l instanceof a};function me(m,l,p){kt(m,f=>{f.call(e,l,p,He)})}const jn=function(l){let p=null;if(me(X.beforeSanitizeElements,l,null),Gr(l))return le(l),!0;const f=U(l.nodeName);if(me(X.uponSanitizeElement,l,{tagName:f,allowedTags:F}),Nt&&l.hasChildNodes()&&!Hn(l.firstElementChild)&&V(/<[/\w!]/g,l.innerHTML)&&V(/<[/\w!]/g,l.textContent)||l.nodeType===et.progressingInstruction||Nt&&l.nodeType===et.comment&&V(/<[/\w]/g,l.data))return le(l),!0;if(!F[f]||dt[f]){if(!dt[f]&&Wn(f)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f)))return!1;if(Hr&&!Ue[f]){const A=oe(l)||l.parentNode,j=ke(l)||l.childNodes;if(j&&A){const N=j.length;for(let Z=N-1;Z>=0;--Z){const we=x(j[Z],!0);we.__removalCount=(l.__removalCount||0)+1,A.insertBefore(we,ee(l))}}}return le(l),!0}return l instanceof c&&!mc(l)||(f==="noscript"||f==="noembed"||f==="noframes")&&V(/<\/no(script|embed|frames)/i,l.innerHTML)?(le(l),!0):(Ne&&l.nodeType===et.text&&(p=l.textContent,kt([Or,Lr,Nr],A=>{p=Ke(p,A," ")}),l.textContent!==p&&(Ze(e.removed,{element:l.cloneNode()}),l.textContent=p)),me(X.afterSanitizeElements,l,null),!1)},qn=function(l,p,f){if(Rn&&(p==="id"||p==="name")&&(f in t||f in fc))return!1;if(!(Fr&&!zr[p]&&V(ic,p))){if(!(In&&V(ac,p))){if(!B[p]||zr[p]){if(!(Wn(l)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,l)||D.tagNameCheck instanceof Function&&D.tagNameCheck(l))&&(D.attributeNameCheck instanceof RegExp&&V(D.attributeNameCheck,p)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(p))||p==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f))))return!1}else if(!jr[p]){if(!V(En,Ke(f,Sn,""))){if(!((p==="src"||p==="xlink:href"||p==="href")&&l!=="script"&&Qo(f,"data:")===0&&Dn[l])){if(!(An&&!V(lc,Ke(f,Sn,"")))){if(f)return!1}}}}}}return!0},Wn=function(l){return l!=="annotation-xml"&&_s(l,cc)},Vn=function(l){me(X.beforeSanitizeAttributes,l,null);const{attributes:p}=l;if(!p||Gr(l))return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let A=p.length;for(;A--;){const j=p[A],{name:N,namespaceURI:Z,value:we}=j,gt=U(N),Yr=we;let q=N==="value"?Yr:ei(Yr);if(f.attrName=gt,f.attrValue=q,f.keepAttr=!0,f.forceKeepAttr=void 0,me(X.uponSanitizeAttribute,l,f),q=f.attrValue,Pn&&(gt==="id"||gt==="name")&&(je(N,l),q=hc+q),Nt&&V(/((--!?|])>)|<\/(style|title)/i,q)){je(N,l);continue}if(f.forceKeepAttr)continue;if(!f.keepAttr){je(N,l);continue}if(!$n&&V(/\/>/i,q)){je(N,l);continue}Ne&&kt([Or,Lr,Nr],Yn=>{q=Ke(q,Yn," ")});const Gn=U(l.nodeName);if(!qn(Gn,gt,q)){je(N,l);continue}if(z&&typeof R=="object"&&typeof R.getAttributeType=="function"&&!Z)switch(R.getAttributeType(Gn,gt)){case"TrustedHTML":{q=z.createHTML(q);break}case"TrustedScriptURL":{q=z.createScriptURL(q);break}}if(q!==Yr)try{Z?l.setAttributeNS(Z,N,q):l.setAttribute(N,q),Gr(l)?le(l):ks(e.removed)}catch{je(N,l)}}me(X.afterSanitizeAttributes,l,null)},wc=function m(l){let p=null;const f=Bn(l);for(me(X.beforeSanitizeShadowDOM,l,null);p=f.nextNode();)me(X.uponSanitizeShadowNode,p,null),jn(p),Vn(p),p.content instanceof o&&m(p.content);me(X.afterSanitizeShadowDOM,l,null)};return e.sanitize=function(m){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=null,f=null,A=null,j=null;if(qr=!m,qr&&(m="<!-->"),typeof m!="string"&&!Hn(m))if(typeof m.toString=="function"){if(m=m.toString(),typeof m!="string")throw Je("dirty is not a string, aborting")}else throw Je("toString is not a function");if(!e.isSupported)return m;if(Ur||Vr(l),e.removed=[],typeof m=="string"&&(pt=!1),pt){if(m.nodeName){const we=U(m.nodeName);if(!F[we]||dt[we])throw Je("root node is forbidden and cannot be sanitized in-place")}}else if(m instanceof a)p=Un("<!---->"),f=p.ownerDocument.importNode(m,!0),f.nodeType===et.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?p=f:p.appendChild(f);else{if(!ze&&!Ne&&!De&&m.indexOf("<")===-1)return z&&Ft?z.createHTML(m):m;if(p=Un(m),!p)return ze?null:Ft?Re:""}p&&Br&&le(p.firstChild);const N=Bn(pt?m:p);for(;A=N.nextNode();)jn(A),Vn(A),A.content instanceof o&&wc(A.content);if(pt)return m;if(ze){if(zt)for(j=sc.call(p.ownerDocument);p.firstChild;)j.appendChild(p.firstChild);else j=p;return(B.shadowroot||B.shadowrootmode)&&(j=oc.call(n,j,!0)),j}let Z=De?p.outerHTML:p.innerHTML;return De&&F["!doctype"]&&p.ownerDocument&&p.ownerDocument.doctype&&p.ownerDocument.doctype.name&&V(Is,p.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+p.ownerDocument.doctype.name+`>
240
- `+Z),Ne&&kt([Or,Lr,Nr],we=>{Z=Ke(Z,we," ")}),z&&Ft?z.createHTML(Z):Z},e.setConfig=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vr(m),Ur=!0},e.clearConfig=function(){He=null,Ur=!1},e.isValidAttribute=function(m,l,p){He||Vr({});const f=U(m),A=U(l);return qn(f,A,p)},e.addHook=function(m,l){typeof l=="function"&&Ze(X[m],l)},e.removeHook=function(m,l){if(l!==void 0){const p=Ko(X[m],l);return p===-1?void 0:Jo(X[m],p,1)[0]}return ks(X[m])},e.removeHooks=function(m){X[m]=[]},e.removeAllHooks=function(){X=$s()},e}var Ps=Rs();function hr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Te=hr();function Ms(r){Te=r}var tt={exec:()=>null};function E(r,e=""){let t=typeof r=="string"?r:r.source,n={replace:(s,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Y.caret,"$1"),t=t.replace(s,i),n},getRegex:()=>new RegExp(t,e)};return n}var Y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i")},fi=/^(?:[ \t]*(?:\n|$))+/,mi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,rt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dr=/(?:[*+-]|\d{1,9}[.)])/,Ds=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Os=E(Ds).replace(/bull/g,dr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),vi=E(Ds).replace(/bull/g,dr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),pr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,yi=/^[^\n]+/,ur=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ki=E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ur).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_i=E(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dr).getRegex(),St="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",gr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xi=E("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gr).replace("tag",St).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ls=E(pr).replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex(),Si=E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ls).getRegex(),fr={blockquote:Si,code:mi,def:ki,fences:wi,heading:bi,hr:rt,html:xi,lheading:Os,list:_i,newline:fi,paragraph:Ls,table:tt,text:yi},Ns=E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex(),Ei={...fr,lheading:vi,table:Ns,paragraph:E(pr).replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ns).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex()},Ti={...fr,html:E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:tt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:E(pr).replace("hr",rt).replace("heading",` *#{1,6} *[^
241
- ]`).replace("lheading",Os).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ci=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ii=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zs=/^( {2,}|\\)\n(?!\s*$)/,Ai=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Et=/[\p{P}\p{S}]/u,mr=/[\s\p{P}\p{S}]/u,Fs=/[^\s\p{P}\p{S}]/u,$i=E(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,mr).getRegex(),Us=/(?!~)[\p{P}\p{S}]/u,Ri=/(?!~)[\s\p{P}\p{S}]/u,Pi=/(?:[^\s\p{P}\p{S}]|~)/u,Mi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,Bs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Di=E(Bs,"u").replace(/punct/g,Et).getRegex(),Oi=E(Bs,"u").replace(/punct/g,Us).getRegex(),Hs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Li=E(Hs,"gu").replace(/notPunctSpace/g,Fs).replace(/punctSpace/g,mr).replace(/punct/g,Et).getRegex(),Ni=E(Hs,"gu").replace(/notPunctSpace/g,Pi).replace(/punctSpace/g,Ri).replace(/punct/g,Us).getRegex(),zi=E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fs).replace(/punctSpace/g,mr).replace(/punct/g,Et).getRegex(),Fi=E(/\\(punct)/,"gu").replace(/punct/g,Et).getRegex(),Ui=E(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Bi=E(gr).replace("(?:-->|$)","-->").getRegex(),Hi=E("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Bi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Tt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ji=E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Tt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),js=E(/^!?\[(label)\]\[(ref)\]/).replace("label",Tt).replace("ref",ur).getRegex(),qs=E(/^!?\[(ref)\](?:\[\])?/).replace("ref",ur).getRegex(),qi=E("reflink|nolink(?!\\()","g").replace("reflink",js).replace("nolink",qs).getRegex(),wr={_backpedal:tt,anyPunctuation:Fi,autolink:Ui,blockSkip:Mi,br:zs,code:Ii,del:tt,emStrongLDelim:Di,emStrongRDelimAst:Li,emStrongRDelimUnd:zi,escape:Ci,link:ji,nolink:qs,punctuation:$i,reflink:js,reflinkSearch:qi,tag:Hi,text:Ai,url:tt},Wi={...wr,link:E(/^!?\[(label)\]\((.*?)\)/).replace("label",Tt).getRegex(),reflink:E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Tt).getRegex()},br={...wr,emStrongRDelimAst:Ni,emStrongLDelim:Oi,url:E(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Vi={...br,br:E(zs).replace("{2,}","*").getRegex(),text:E(br.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ct={normal:fr,gfm:Ei,pedantic:Ti},st={normal:wr,gfm:br,breaks:Vi,pedantic:Wi},Gi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ws=r=>Gi[r];function ie(r,e){if(e){if(Y.escapeTest.test(r))return r.replace(Y.escapeReplace,Ws)}else if(Y.escapeTestNoEncode.test(r))return r.replace(Y.escapeReplaceNoEncode,Ws);return r}function Vs(r){try{r=encodeURI(r).replace(Y.percentDecode,"%")}catch{return null}return r}function Gs(r,e){let t=r.replace(Y.findPipe,(o,i,a)=>{let c=!1,d=i;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),n=t.split(Y.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Y.slashPipe,"|");return n}function nt(r,e,t){let n=r.length;if(n===0)return"";let s=0;for(;s<n&&r.charAt(n-s-1)===e;)s++;return r.slice(0,n-s)}function Yi(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function Ys(r,e,t,n,s){let o=e.href,i=e.title||null,a=r[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:i,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,c}function Xi(r,e,t){let n=r.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
242
- `).map(o=>{let i=o.match(t.other.beginningSpace);if(i===null)return o;let[a]=i;return a.length>=s.length?o.slice(s.length):o}).join(`
243
- `)}var It=class{options;rules;lexer;constructor(r){this.options=r||Te}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:nt(t,`
244
- `)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=Xi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=nt(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:nt(e[0],`
245
- `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=nt(e[0],`
298
+ `}};Vt.styles=[Vl],vn([f.property({attribute:!1})],Vt.prototype,"isInitialized",2),vn([f.property({attribute:!1})],Vt.prototype,"welcomeMessage",2),Vt=vn([f.customElement("gaia-welcome-message")],Vt);const Yl=(t,e,r)=>{const s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},ro="en",Zl=["da","fi","nb","nl","sv"],Xl=["da","en","fi","nb","nl","sv"],{getLocale:Jl,setLocale:no}=Vi({sourceLocale:ro,targetLocales:Zl,loadLocale:t=>Yl(Object.assign({"../generated/locales/da.ts":()=>Promise.resolve().then(()=>Ld),"../generated/locales/fi.ts":()=>Promise.resolve().then(()=>zd),"../generated/locales/nb.ts":()=>Promise.resolve().then(()=>Bd),"../generated/locales/nl.ts":()=>Promise.resolve().then(()=>Hd),"../generated/locales/sv.ts":()=>Promise.resolve().then(()=>jd)}),`../generated/locales/${t}.ts`,4)});function so(t){const[e]=t.split("-"),r=e.toLowerCase();return Ql(r)}function Ql(t){switch(t){case"no":case"nn":return"nb";default:return ec(t)?t:ro}}function ec(t){return Xl.includes(t)}const tc=y.css`
299
+ :host{display:block;height:100%;overflow:hidden;position:relative;width:100%}.conversation{display:block;height:inherit;max-width:100%;overflow-y:auto}.conversation,.scroll-container{flex-direction:column;position:relative}.scroll-container{display:flex;height:100%;margin:0 auto;max-width:var(--gaia-container-2xl);width:100%}.shimmer{animation:animate-background 3s linear infinite;-webkit-background-clip:text;background-clip:text;background-image:linear-gradient(
300
+ to right,
301
+ oklch(30.91% 0.049 233.96deg),
302
+ oklch(50% 0.049 233.96deg) 40%,
303
+ oklch(70% 0.049 233.96deg) 50%,
304
+ oklch(50% 0.049 233.96deg) 60%,
305
+ oklch(30.91% 0.049 233.96deg) 100%
306
+ );background-position:0 50%;background-size:200%;color:transparent;overflow:hidden;position:relative}@keyframes animate-background{0%{background-position:200% 0}to{background-position:-200% 0}}.system-message{align-items:flex-start;color:var(--gaia-color-text-body);display:flex;flex-direction:row;gap:16px}.system-message-content{display:flex;flex-direction:column;font-size:var(--gaia-font-size-base);font-weight:var(--gaia-font-weight-regular);gap:8px;letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base)}.system-message-headline{font:inherit;font-weight:var(--gaia-font-weight-medium)}.system-message-text{color:var(--gaia-color-text-body-secondary);font:inherit}.system-message-actions{display:flex;flex-wrap:wrap;gap:8px}.system-message-actions gaia-button{flex-grow:1}
307
+ `;const{entries:oo,setPrototypeOf:io,isFrozen:rc,getPrototypeOf:nc,getOwnPropertyDescriptor:sc}=Object;let{freeze:re,seal:fe,create:kn}=Object,{apply:xn,construct:_n}=typeof Reflect<"u"&&Reflect;re||(re=function(e){return e}),fe||(fe=function(e){return e}),xn||(xn=function(e,r){for(var s=arguments.length,n=new Array(s>2?s-2:0),o=2;o<s;o++)n[o-2]=arguments[o];return e.apply(r,n)}),_n||(_n=function(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];return new e(...s)});const Er=se(Array.prototype.forEach),oc=se(Array.prototype.lastIndexOf),ao=se(Array.prototype.pop),Gt=se(Array.prototype.push),ic=se(Array.prototype.splice),Cr=se(String.prototype.toLowerCase),Sn=se(String.prototype.toString),Tn=se(String.prototype.match),Kt=se(String.prototype.replace),ac=se(String.prototype.indexOf),lc=se(String.prototype.trim),ye=se(Object.prototype.hasOwnProperty),ne=se(RegExp.prototype.test),Yt=cc(TypeError);function se(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];return xn(t,e,s)}}function cc(t){return function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return _n(t,r)}}function C(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Cr;io&&io(t,null);let s=e.length;for(;s--;){let n=e[s];if(typeof n=="string"){const o=r(n);o!==n&&(rc(e)||(e[s]=o),n=o)}t[n]=!0}return t}function hc(t){for(let e=0;e<t.length;e++)ye(t,e)||(t[e]=null);return t}function Fe(t){const e=kn(null);for(const[r,s]of oo(t))ye(t,r)&&(Array.isArray(s)?e[r]=hc(s):s&&typeof s=="object"&&s.constructor===Object?e[r]=Fe(s):e[r]=s);return e}function Zt(t,e){for(;t!==null;){const s=sc(t,e);if(s){if(s.get)return se(s.get);if(typeof s.value=="function")return se(s.value)}t=nc(t)}function r(){return null}return r}const lo=re(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=re(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cn=re(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),dc=re(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),An=re(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),uc=re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),co=re(["#text"]),ho=re(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),In=re(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),uo=re(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ar=re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pc=fe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),gc=fe(/<%[\w\W]*|[\w\W]*%>/gm),fc=fe(/\$\{[\w\W]*/gm),mc=fe(/^data-[\-\w.\u00B7-\uFFFF]+$/),bc=fe(/^aria-[\-\w]+$/),po=fe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),wc=fe(/^(?:\w+script|data):/i),vc=fe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),go=fe(/^html$/i),yc=fe(/^[a-z][.\w]*(-[.\w]+)+$/i);var fo=Object.freeze({__proto__:null,ARIA_ATTR:bc,ATTR_WHITESPACE:vc,CUSTOM_ELEMENT:yc,DATA_ATTR:mc,DOCTYPE_NAME:go,ERB_EXPR:gc,IS_ALLOWED_URI:po,IS_SCRIPT_OR_DATA:wc,MUSTACHE_EXPR:pc,TMPLIT_EXPR:fc});const Xt={element:1,text:3,progressingInstruction:7,comment:8,document:9},kc=function(){return typeof window>"u"?null:window},xc=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const n="data-tt-policy-suffix";r&&r.hasAttribute(n)&&(s=r.getAttribute(n));const o="dompurify"+(s?"#"+s:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},mo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function bo(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kc();const e=x=>bo(x);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==Xt.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const s=r,n=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:h,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:b,trustedTypes:m}=t,w=l.prototype,v=Zt(w,"cloneNode"),_=Zt(w,"remove"),S=Zt(w,"nextSibling"),A=Zt(w,"childNodes"),I=Zt(w,"parentNode");if(typeof i=="function"){const x=r.createElement("template");x.content&&x.content.ownerDocument&&(r=x.content.ownerDocument)}let R,D="";const{implementation:Z,createNodeIterator:j,createDocumentFragment:ht,getElementsByTagName:Be}=r,{importNode:Te}=s;let F=mo();e.isSupported=typeof oo=="function"&&typeof I=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ee,ERB_EXPR:Ue,TMPLIT_EXPR:G,DATA_ATTR:He,ARIA_ATTR:Ce,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:Oe}=fo;let{IS_ALLOWED_URI:Fr}=fo,K=null;const Xo=C({},[...lo,...En,...Cn,...An,...co]);let X=null;const Jo=C({},[...ho,...In,...uo,...Ar]);let B=Object.seal(kn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ir=null,Zn=null;const Ct=Object.seal(kn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Qo=!0,Xn=!0,ei=!1,ti=!0,At=!1,Br=!0,dt=!1,Jn=!1,Qn=!1,It=!1,Ur=!1,Hr=!1,ri=!0,ni=!1;const qd="user-content-";let es=!0,ar=!1,Rt={},Pt=null;const si=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let oi=null;const ii=C({},["audio","video","img","source","image","track"]);let ts=null;const ai=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Wr="http://www.w3.org/1998/Math/MathML",jr="http://www.w3.org/2000/svg",We="http://www.w3.org/1999/xhtml";let $t=We,rs=!1,ns=null;const Vd=C({},[Wr,jr,We],Sn);let qr=C({},["mi","mo","mn","ms","mtext"]),Vr=C({},["annotation-xml"]);const Gd=C({},["title","style","font","a","script"]);let lr=null;const Kd=["application/xhtml+xml","text/html"],Yd="text/html";let Y=null,Ot=null;const Zd=r.createElement("form"),li=function(c){return c instanceof RegExp||c instanceof Function},ss=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===c)){if((!c||typeof c!="object")&&(c={}),c=Fe(c),lr=Kd.indexOf(c.PARSER_MEDIA_TYPE)===-1?Yd:c.PARSER_MEDIA_TYPE,Y=lr==="application/xhtml+xml"?Sn:Cr,K=ye(c,"ALLOWED_TAGS")?C({},c.ALLOWED_TAGS,Y):Xo,X=ye(c,"ALLOWED_ATTR")?C({},c.ALLOWED_ATTR,Y):Jo,ns=ye(c,"ALLOWED_NAMESPACES")?C({},c.ALLOWED_NAMESPACES,Sn):Vd,ts=ye(c,"ADD_URI_SAFE_ATTR")?C(Fe(ai),c.ADD_URI_SAFE_ATTR,Y):ai,oi=ye(c,"ADD_DATA_URI_TAGS")?C(Fe(ii),c.ADD_DATA_URI_TAGS,Y):ii,Pt=ye(c,"FORBID_CONTENTS")?C({},c.FORBID_CONTENTS,Y):si,ir=ye(c,"FORBID_TAGS")?C({},c.FORBID_TAGS,Y):Fe({}),Zn=ye(c,"FORBID_ATTR")?C({},c.FORBID_ATTR,Y):Fe({}),Rt=ye(c,"USE_PROFILES")?c.USE_PROFILES:!1,Qo=c.ALLOW_ARIA_ATTR!==!1,Xn=c.ALLOW_DATA_ATTR!==!1,ei=c.ALLOW_UNKNOWN_PROTOCOLS||!1,ti=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,At=c.SAFE_FOR_TEMPLATES||!1,Br=c.SAFE_FOR_XML!==!1,dt=c.WHOLE_DOCUMENT||!1,It=c.RETURN_DOM||!1,Ur=c.RETURN_DOM_FRAGMENT||!1,Hr=c.RETURN_TRUSTED_TYPE||!1,Qn=c.FORCE_BODY||!1,ri=c.SANITIZE_DOM!==!1,ni=c.SANITIZE_NAMED_PROPS||!1,es=c.KEEP_CONTENT!==!1,ar=c.IN_PLACE||!1,Fr=c.ALLOWED_URI_REGEXP||po,$t=c.NAMESPACE||We,qr=c.MATHML_TEXT_INTEGRATION_POINTS||qr,Vr=c.HTML_INTEGRATION_POINTS||Vr,B=c.CUSTOM_ELEMENT_HANDLING||{},c.CUSTOM_ELEMENT_HANDLING&&li(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=c.CUSTOM_ELEMENT_HANDLING.tagNameCheck),c.CUSTOM_ELEMENT_HANDLING&&li(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),At&&(Xn=!1),Ur&&(It=!0),Rt&&(K=C({},co),X=[],Rt.html===!0&&(C(K,lo),C(X,ho)),Rt.svg===!0&&(C(K,En),C(X,In),C(X,Ar)),Rt.svgFilters===!0&&(C(K,Cn),C(X,In),C(X,Ar)),Rt.mathMl===!0&&(C(K,An),C(X,uo),C(X,Ar))),c.ADD_TAGS&&(typeof c.ADD_TAGS=="function"?Ct.tagCheck=c.ADD_TAGS:(K===Xo&&(K=Fe(K)),C(K,c.ADD_TAGS,Y))),c.ADD_ATTR&&(typeof c.ADD_ATTR=="function"?Ct.attributeCheck=c.ADD_ATTR:(X===Jo&&(X=Fe(X)),C(X,c.ADD_ATTR,Y))),c.ADD_URI_SAFE_ATTR&&C(ts,c.ADD_URI_SAFE_ATTR,Y),c.FORBID_CONTENTS&&(Pt===si&&(Pt=Fe(Pt)),C(Pt,c.FORBID_CONTENTS,Y)),es&&(K["#text"]=!0),dt&&C(K,["html","head","body"]),K.table&&(C(K,["tbody"]),delete ir.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=c.TRUSTED_TYPES_POLICY,D=R.createHTML("")}else R===void 0&&(R=xc(m,n)),R!==null&&typeof D=="string"&&(D=R.createHTML(""));re&&re(c),Ot=c}},ci=C({},[...En,...Cn,...dc]),hi=C({},[...An,...uc]),Xd=function(c){let g=I(c);(!g||!g.tagName)&&(g={namespaceURI:$t,tagName:"template"});const k=Cr(c.tagName),L=Cr(g.tagName);return ns[c.namespaceURI]?c.namespaceURI===jr?g.namespaceURI===We?k==="svg":g.namespaceURI===Wr?k==="svg"&&(L==="annotation-xml"||qr[L]):!!ci[k]:c.namespaceURI===Wr?g.namespaceURI===We?k==="math":g.namespaceURI===jr?k==="math"&&Vr[L]:!!hi[k]:c.namespaceURI===We?g.namespaceURI===jr&&!Vr[L]||g.namespaceURI===Wr&&!qr[L]?!1:!hi[k]&&(Gd[k]||!ci[k]):!!(lr==="application/xhtml+xml"&&ns[c.namespaceURI]):!1},De=function(c){Gt(e.removed,{element:c});try{I(c).removeChild(c)}catch{_(c)}},ut=function(c,g){try{Gt(e.removed,{attribute:g.getAttributeNode(c),from:g})}catch{Gt(e.removed,{attribute:null,from:g})}if(g.removeAttribute(c),c==="is")if(It||Ur)try{De(g)}catch{}else try{g.setAttribute(c,"")}catch{}},di=function(c){let g=null,k=null;if(Qn)c="<remove></remove>"+c;else{const q=Tn(c,/^[\r\n\t ]+/);k=q&&q[0]}lr==="application/xhtml+xml"&&$t===We&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");const L=R?R.createHTML(c):c;if($t===We)try{g=new b().parseFromString(L,lr)}catch{}if(!g||!g.documentElement){g=Z.createDocument($t,"template",null);try{g.documentElement.innerHTML=rs?D:L}catch{}}const te=g.body||g.documentElement;return c&&k&&te.insertBefore(r.createTextNode(k),te.childNodes[0]||null),$t===We?Be.call(g,dt?"html":"body")[0]:dt?g.documentElement:te},ui=function(c){return j.call(c.ownerDocument||c,c,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},os=function(c){return c instanceof p&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof d)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},pi=function(c){return typeof a=="function"&&c instanceof a};function je(x,c,g){Er(x,k=>{k.call(e,c,g,Ot)})}const gi=function(c){let g=null;if(je(F.beforeSanitizeElements,c,null),os(c))return De(c),!0;const k=Y(c.nodeName);if(je(F.uponSanitizeElement,c,{tagName:k,allowedTags:K}),Br&&c.hasChildNodes()&&!pi(c.firstElementChild)&&ne(/<[/\w!]/g,c.innerHTML)&&ne(/<[/\w!]/g,c.textContent)||c.nodeType===Xt.progressingInstruction||Br&&c.nodeType===Xt.comment&&ne(/<[/\w]/g,c.data))return De(c),!0;if(!(Ct.tagCheck instanceof Function&&Ct.tagCheck(k))&&(!K[k]||ir[k])){if(!ir[k]&&mi(k)&&(B.tagNameCheck instanceof RegExp&&ne(B.tagNameCheck,k)||B.tagNameCheck instanceof Function&&B.tagNameCheck(k)))return!1;if(es&&!Pt[k]){const L=I(c)||c.parentNode,te=A(c)||c.childNodes;if(te&&L){const q=te.length;for(let ae=q-1;ae>=0;--ae){const qe=v(te[ae],!0);qe.__removalCount=(c.__removalCount||0)+1,L.insertBefore(qe,S(c))}}}return De(c),!0}return c instanceof l&&!Xd(c)||(k==="noscript"||k==="noembed"||k==="noframes")&&ne(/<\/no(script|embed|frames)/i,c.innerHTML)?(De(c),!0):(At&&c.nodeType===Xt.text&&(g=c.textContent,Er([Ee,Ue,G],L=>{g=Kt(g,L," ")}),c.textContent!==g&&(Gt(e.removed,{element:c.cloneNode()}),c.textContent=g)),je(F.afterSanitizeElements,c,null),!1)},fi=function(c,g,k){if(ri&&(g==="id"||g==="name")&&(k in r||k in Zd))return!1;if(!(Xn&&!Zn[g]&&ne(He,g))){if(!(Qo&&ne(Ce,g))){if(!(Ct.attributeCheck instanceof Function&&Ct.attributeCheck(g,c))){if(!X[g]||Zn[g]){if(!(mi(c)&&(B.tagNameCheck instanceof RegExp&&ne(B.tagNameCheck,c)||B.tagNameCheck instanceof Function&&B.tagNameCheck(c))&&(B.attributeNameCheck instanceof RegExp&&ne(B.attributeNameCheck,g)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(g,c))||g==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&ne(B.tagNameCheck,k)||B.tagNameCheck instanceof Function&&B.tagNameCheck(k))))return!1}else if(!ts[g]){if(!ne(Fr,Kt(k,ie,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&c!=="script"&&ac(k,"data:")===0&&oi[c])){if(!(ei&&!ne(ge,Kt(k,ie,"")))){if(k)return!1}}}}}}}return!0},mi=function(c){return c!=="annotation-xml"&&Tn(c,Oe)},bi=function(c){je(F.beforeSanitizeAttributes,c,null);const{attributes:g}=c;if(!g||os(c))return;const k={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let L=g.length;for(;L--;){const te=g[L],{name:q,namespaceURI:ae,value:qe}=te,Dt=Y(q),is=qe;let J=q==="value"?is:lc(is);if(k.attrName=Dt,k.attrValue=J,k.keepAttr=!0,k.forceKeepAttr=void 0,je(F.uponSanitizeAttribute,c,k),J=k.attrValue,ni&&(Dt==="id"||Dt==="name")&&(ut(q,c),J=qd+J),Br&&ne(/((--!?|])>)|<\/(style|title|textarea)/i,J)){ut(q,c);continue}if(Dt==="attributename"&&Tn(J,"href")){ut(q,c);continue}if(k.forceKeepAttr)continue;if(!k.keepAttr){ut(q,c);continue}if(!ti&&ne(/\/>/i,J)){ut(q,c);continue}At&&Er([Ee,Ue,G],vi=>{J=Kt(J,vi," ")});const wi=Y(c.nodeName);if(!fi(wi,Dt,J)){ut(q,c);continue}if(R&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!ae)switch(m.getAttributeType(wi,Dt)){case"TrustedHTML":{J=R.createHTML(J);break}case"TrustedScriptURL":{J=R.createScriptURL(J);break}}if(J!==is)try{ae?c.setAttributeNS(ae,q,J):c.setAttribute(q,J),os(c)?De(c):ao(e.removed)}catch{ut(q,c)}}je(F.afterSanitizeAttributes,c,null)},Jd=function x(c){let g=null;const k=ui(c);for(je(F.beforeSanitizeShadowDOM,c,null);g=k.nextNode();)je(F.uponSanitizeShadowNode,g,null),gi(g),bi(g),g.content instanceof o&&x(g.content);je(F.afterSanitizeShadowDOM,c,null)};return e.sanitize=function(x){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,k=null,L=null,te=null;if(rs=!x,rs&&(x="<!-->"),typeof x!="string"&&!pi(x))if(typeof x.toString=="function"){if(x=x.toString(),typeof x!="string")throw Yt("dirty is not a string, aborting")}else throw Yt("toString is not a function");if(!e.isSupported)return x;if(Jn||ss(c),e.removed=[],typeof x=="string"&&(ar=!1),ar){if(x.nodeName){const qe=Y(x.nodeName);if(!K[qe]||ir[qe])throw Yt("root node is forbidden and cannot be sanitized in-place")}}else if(x instanceof a)g=di("<!---->"),k=g.ownerDocument.importNode(x,!0),k.nodeType===Xt.element&&k.nodeName==="BODY"||k.nodeName==="HTML"?g=k:g.appendChild(k);else{if(!It&&!At&&!dt&&x.indexOf("<")===-1)return R&&Hr?R.createHTML(x):x;if(g=di(x),!g)return It?null:Hr?D:""}g&&Qn&&De(g.firstChild);const q=ui(ar?x:g);for(;L=q.nextNode();)gi(L),bi(L),L.content instanceof o&&Jd(L.content);if(ar)return x;if(It){if(Ur)for(te=ht.call(g.ownerDocument);g.firstChild;)te.appendChild(g.firstChild);else te=g;return(X.shadowroot||X.shadowrootmode)&&(te=Te.call(s,te,!0)),te}let ae=dt?g.outerHTML:g.innerHTML;return dt&&K["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&ne(go,g.ownerDocument.doctype.name)&&(ae="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
308
+ `+ae),At&&Er([Ee,Ue,G],qe=>{ae=Kt(ae,qe," ")}),R&&Hr?R.createHTML(ae):ae},e.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ss(x),Jn=!0},e.clearConfig=function(){Ot=null,Jn=!1},e.isValidAttribute=function(x,c,g){Ot||ss({});const k=Y(x),L=Y(c);return fi(k,L,g)},e.addHook=function(x,c){typeof c=="function"&&Gt(F[x],c)},e.removeHook=function(x,c){if(c!==void 0){const g=oc(F[x],c);return g===-1?void 0:ic(F[x],g,1)[0]}return ao(F[x])},e.removeHooks=function(x){F[x]=[]},e.removeAllHooks=function(){F=mo()},e}var wo=bo();function Rn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ot=Rn();function vo(t){ot=t}var Jt={exec:()=>null};function O(t,e=""){let r=typeof t=="string"?t:t.source,s={replace:(n,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(oe.caret,"$1"),r=r.replace(n,i),s},getRegex:()=>new RegExp(r,e)};return s}var oe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},_c=/^(?:[ \t]*(?:\n|$))+/,Sc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Tc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ec=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Pn=/(?:[*+-]|\d{1,9}[.)])/,yo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ko=O(yo).replace(/bull/g,Pn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Cc=O(yo).replace(/bull/g,Pn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$n=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ac=/^[^\n]+/,On=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ic=O(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",On).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Rc=O(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Pn).getRegex(),Ir="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Dn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pc=O("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Dn).replace("tag",Ir).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xo=O($n).replace("hr",Qt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ir).getRegex(),$c=O(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xo).getRegex(),Mn={blockquote:$c,code:Sc,def:Ic,fences:Tc,heading:Ec,hr:Qt,html:Pc,lheading:ko,list:Rc,newline:_c,paragraph:xo,table:Jt,text:Ac},_o=O("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ir).getRegex(),Oc={...Mn,lheading:Cc,table:_o,paragraph:O($n).replace("hr",Qt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ir).getRegex()},Dc={...Mn,html:O(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Dn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Jt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:O($n).replace("hr",Qt).replace("heading",` *#{1,6} *[^
309
+ ]`).replace("lheading",ko).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Mc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Lc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,So=/^( {2,}|\\)\n(?!\s*$)/,Nc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rr=/[\p{P}\p{S}]/u,Ln=/[\s\p{P}\p{S}]/u,To=/[^\s\p{P}\p{S}]/u,zc=O(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ln).getRegex(),Eo=/(?!~)[\p{P}\p{S}]/u,Fc=/(?!~)[\s\p{P}\p{S}]/u,Bc=/(?:[^\s\p{P}\p{S}]|~)/u,Uc=O(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Co=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Hc=O(Co,"u").replace(/punct/g,Rr).getRegex(),Wc=O(Co,"u").replace(/punct/g,Eo).getRegex(),Ao="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",jc=O(Ao,"gu").replace(/notPunctSpace/g,To).replace(/punctSpace/g,Ln).replace(/punct/g,Rr).getRegex(),qc=O(Ao,"gu").replace(/notPunctSpace/g,Bc).replace(/punctSpace/g,Fc).replace(/punct/g,Eo).getRegex(),Vc=O("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,To).replace(/punctSpace/g,Ln).replace(/punct/g,Rr).getRegex(),Gc=O(/\\(punct)/,"gu").replace(/punct/g,Rr).getRegex(),Kc=O(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Yc=O(Dn).replace("(?:-->|$)","-->").getRegex(),Zc=O("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Yc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Xc=O(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Pr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Io=O(/^!?\[(label)\]\[(ref)\]/).replace("label",Pr).replace("ref",On).getRegex(),Ro=O(/^!?\[(ref)\](?:\[\])?/).replace("ref",On).getRegex(),Jc=O("reflink|nolink(?!\\()","g").replace("reflink",Io).replace("nolink",Ro).getRegex(),Po=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Nn={_backpedal:Jt,anyPunctuation:Gc,autolink:Kc,blockSkip:Uc,br:So,code:Lc,del:Jt,emStrongLDelim:Hc,emStrongRDelimAst:jc,emStrongRDelimUnd:Vc,escape:Mc,link:Xc,nolink:Ro,punctuation:zc,reflink:Io,reflinkSearch:Jc,tag:Zc,text:Nc,url:Jt},Qc={...Nn,link:O(/^!?\[(label)\]\((.*?)\)/).replace("label",Pr).getRegex(),reflink:O(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pr).getRegex()},zn={...Nn,emStrongRDelimAst:qc,emStrongLDelim:Wc,url:O(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Po).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:O(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Po).getRegex()},eh={...zn,br:O(So).replace("{2,}","*").getRegex(),text:O(zn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$r={normal:Mn,gfm:Oc,pedantic:Dc},er={normal:Nn,gfm:zn,breaks:eh,pedantic:Qc},th={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$o=t=>th[t];function $e(t,e){if(e){if(oe.escapeTest.test(t))return t.replace(oe.escapeReplace,$o)}else if(oe.escapeTestNoEncode.test(t))return t.replace(oe.escapeReplaceNoEncode,$o);return t}function Oo(t){try{t=encodeURI(t).replace(oe.percentDecode,"%")}catch{return null}return t}function Do(t,e){let r=t.replace(oe.findPipe,(o,i,a)=>{let l=!1,h=i;for(;--h>=0&&a[h]==="\\";)l=!l;return l?"|":" |"}),s=r.split(oe.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(oe.slashPipe,"|");return s}function tr(t,e,r){let s=t.length;if(s===0)return"";let n=0;for(;n<s&&t.charAt(s-n-1)===e;)n++;return t.slice(0,s-n)}function rh(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])r++;else if(t[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function Mo(t,e,r,s,n){let o=e.href,i=e.title||null,a=t[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:o,title:i,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function nh(t,e,r){let s=t.match(r.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
310
+ `).map(o=>{let i=o.match(r.other.beginningSpace);if(i===null)return o;let[a]=i;return a.length>=n.length?o.slice(n.length):o}).join(`
311
+ `)}var Or=class{options;rules;lexer;constructor(t){this.options=t||ot}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:tr(r,`
312
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],s=nh(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let s=tr(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:tr(e[0],`
313
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=tr(e[0],`
246
314
  `).split(`
247
- `),n="",s="",o=[];for(;t.length>0;){let i=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),i=!0;else if(!i)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
248
- `),u=d.replace(this.rules.other.blockquoteSetextReplace,`
249
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
250
- ${d}`:d,s=s?`${s}
251
- ${u}`:u;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=v,t.length===0)break;let _=o.at(-1);if(_?.type==="code")break;if(_?.type==="blockquote"){let R=_,T=R.raw+`
252
- `+t.join(`
253
- `),x=this.blockquote(T);o[o.length-1]=x,n=n.substring(0,n.length-R.raw.length)+x.raw,s=s.substring(0,s.length-R.text.length)+x.text;break}else if(_?.type==="list"){let R=_,T=R.raw+`
254
- `+t.join(`
255
- `),x=this.list(T);o[o.length-1]=x,n=n.substring(0,n.length-_.raw.length)+x.raw,s=s.substring(0,s.length-R.raw.length)+x.raw,t=T.substring(o.at(-1).raw.length).split(`
256
- `);continue}}return{type:"blockquote",raw:n,tokens:o,text:s}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,s={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let o=this.rules.other.listItemRegex(t),i=!1;for(;r;){let c=!1,d="",u="";if(!(e=o.exec(r))||this.rules.block.hr.test(r))break;d=e[0],r=r.substring(d.length);let v=e[2].split(`
257
- `,1)[0].replace(this.rules.other.listReplaceTabs,ee=>" ".repeat(3*ee.length)),_=r.split(`
258
- `,1)[0],R=!v.trim(),T=0;if(this.options.pedantic?(T=2,u=v.trimStart()):R?T=e[1].length+1:(T=e[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,u=v.slice(T),T+=e[1].length),R&&this.rules.other.blankLine.test(_)&&(d+=_+`
259
- `,r=r.substring(_.length+1),c=!0),!c){let ee=this.rules.other.nextBulletRegex(T),ke=this.rules.other.hrRegex(T),oe=this.rules.other.fencesBeginRegex(T),z=this.rules.other.headingBeginRegex(T),Re=this.rules.other.htmlBeginRegex(T);for(;r;){let Pe=r.split(`
260
- `,1)[0],Me;if(_=Pe,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),Me=_):Me=_.replace(this.rules.other.tabCharGlobal," "),oe.test(_)||z.test(_)||Re.test(_)||ee.test(_)||ke.test(_))break;if(Me.search(this.rules.other.nonSpaceChar)>=T||!_.trim())u+=`
261
- `+Me.slice(T);else{if(R||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||oe.test(v)||z.test(v)||ke.test(v))break;u+=`
262
- `+_}!R&&!_.trim()&&(R=!0),d+=Pe+`
263
- `,r=r.substring(Pe.length+1),v=Me.slice(T)}}s.loose||(i?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(i=!0));let x=null,M;this.options.gfm&&(x=this.rules.other.listIsTask.exec(u),x&&(M=x[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!x,checked:M,loose:!1,text:u,tokens:[]}),s.raw+=d}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let d=s.items[c].tokens.filter(v=>v.type==="space"),u=d.length>0&&d.some(v=>this.rules.other.anyLine.test(v.raw));s.loose=u}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:s}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Gs(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
264
- `):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let i of n)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<t.length;i++)o.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:o.align[i]});for(let i of s)o.rows.push(Gs(i,o.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[c]})));return o}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
265
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let o=nt(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{let o=Yi(e[2],"()");if(o===-2)return;if(o>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],s=o[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Ys(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return Ys(t,s,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,o,i,a=s,c=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*r.length+s);(n=d.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(i=[...o].length,n[3]||n[4]){a+=i;continue}else if((n[5]||n[6])&&s%3&&!((s+i)%3)){c+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+c);let u=[...n[0]][0].length,v=r.slice(0,s+n.index+u+i);if(Math.min(s,i)%2){let R=v.slice(1,-1);return{type:"em",raw:v,text:R,tokens:this.lexer.inlineTokens(R)}}let _=v.slice(2,-2);return{type:"strong",raw:v,text:_,tokens:this.lexer.inlineTokens(_)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){let e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},de=class Xr{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Te,this.options.tokenizer=this.options.tokenizer||new It,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Y,block:Ct.normal,inline:st.normal};this.options.pedantic?(t.block=Ct.pedantic,t.inline=st.pedantic):this.options.gfm&&(t.block=Ct.gfm,this.options.breaks?t.inline=st.breaks:t.inline=st.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ct,inline:st}}static lex(e,t){return new Xr(t).lex(e)}static lexInline(e,t){return new Xr(t).inlineTokens(e)}lex(e){e=e.replace(Y.carriageReturn,`
266
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Y.tabCharGlobal," ").replace(Y.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(i=>(s=i.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let i=t.at(-1);s.raw.length===1&&i!==void 0?i.raw+=`
267
- `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
315
+ `),s="",n="",o=[];for(;r.length>0;){let i=!1,a=[],l;for(l=0;l<r.length;l++)if(this.rules.other.blockquoteStart.test(r[l]))a.push(r[l]),i=!0;else if(!i)a.push(r[l]);else break;r=r.slice(l);let h=a.join(`
316
+ `),d=h.replace(this.rules.other.blockquoteSetextReplace,`
317
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
318
+ ${h}`:h,n=n?`${n}
319
+ ${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=p,r.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let m=b,w=m.raw+`
320
+ `+r.join(`
321
+ `),v=this.blockquote(w);o[o.length-1]=v,s=s.substring(0,s.length-m.raw.length)+v.raw,n=n.substring(0,n.length-m.text.length)+v.text;break}else if(b?.type==="list"){let m=b,w=m.raw+`
322
+ `+r.join(`
323
+ `),v=this.list(w);o[o.length-1]=v,s=s.substring(0,s.length-b.raw.length)+v.raw,n=n.substring(0,n.length-m.raw.length)+v.raw,r=w.substring(o.at(-1).raw.length).split(`
324
+ `);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),s=r.length>1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),i=!1;for(;t;){let l=!1,h="",d="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let p=e[2].split(`
325
+ `,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),b=t.split(`
326
+ `,1)[0],m=!p.trim(),w=0;if(this.options.pedantic?(w=2,d=p.trimStart()):m?w=e[1].length+1:(w=e[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,d=p.slice(w),w+=e[1].length),m&&this.rules.other.blankLine.test(b)&&(h+=b+`
327
+ `,t=t.substring(b.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(w),A=this.rules.other.hrRegex(w),I=this.rules.other.fencesBeginRegex(w),R=this.rules.other.headingBeginRegex(w),D=this.rules.other.htmlBeginRegex(w);for(;t;){let Z=t.split(`
328
+ `,1)[0],j;if(b=Z,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),j=b):j=b.replace(this.rules.other.tabCharGlobal," "),I.test(b)||R.test(b)||D.test(b)||S.test(b)||A.test(b))break;if(j.search(this.rules.other.nonSpaceChar)>=w||!b.trim())d+=`
329
+ `+j.slice(w);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(p)||R.test(p)||A.test(p))break;d+=`
330
+ `+b}!m&&!b.trim()&&(m=!0),h+=Z+`
331
+ `,t=t.substring(Z.length+1),p=j.slice(w)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(i=!0));let v=null,_;this.options.gfm&&(v=this.rules.other.listIsTask.exec(d),v&&(_=v[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:h,task:!!v,checked:_,loose:!1,text:d,tokens:[]}),n.raw+=h}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let l=0;l<n.items.length;l++)if(this.lexer.state.top=!1,n.items[l].tokens=this.lexer.blockTokens(n.items[l].text,[]),!n.loose){let h=n.items[l].tokens.filter(p=>p.type==="space"),d=h.length>0&&h.some(p=>this.rules.other.anyLine.test(p.raw));n.loose=d}if(n.loose)for(let l=0;l<n.items.length;l++)n.items[l].loose=!0;return n}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:s,title:n}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=Do(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
332
+ `):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<r.length;i++)o.header.push({text:r[i],tokens:this.lexer.inline(r[i]),header:!0,align:o.align[i]});for(let i of n)o.rows.push(Do(i,o.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[l]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
333
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=tr(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=rh(e[2],"()");if(o===-2)return;if(o>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),Mo(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return Mo(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!r||this.rules.inline.punctuation.exec(r))){let n=[...s[0]].length-1,o,i,a=n,l=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+n);(s=h.exec(e))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(i=[...o].length,s[3]||s[4]){a+=i;continue}else if((s[5]||s[6])&&n%3&&!((n+i)%3)){l+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+l);let d=[...s[0]][0].length,p=t.slice(0,n+s.index+d+i);if(Math.min(n,i)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let b=p.slice(2,-2);return{type:"strong",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},ke=class as{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ot,this.options.tokenizer=this.options.tokenizer||new Or,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:oe,block:$r.normal,inline:er.normal};this.options.pedantic?(r.block=$r.pedantic,r.inline=er.pedantic):this.options.gfm&&(r.block=$r.gfm,this.options.breaks?r.inline=er.breaks:r.inline=er.gfm),this.tokenizer.rules=r}static get rules(){return{block:$r,inline:er}}static lex(e,r){return new as(r).lex(e)}static lexInline(e,r){return new as(r).inlineTokens(e)}lex(e){e=e.replace(oe.carriageReturn,`
334
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],s=!1){for(this.options.pedantic&&(e=e.replace(oe.tabCharGlobal," ").replace(oe.spaceLine,""));e;){let n;if(this.options.extensions?.block?.some(i=>(n=i.call({lexer:this},e,r))?(e=e.substring(n.raw.length),r.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let i=r.at(-1);n.raw.length===1&&i!==void 0?i.raw+=`
335
+ `:r.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
268
336
  `)?"":`
269
- `)+s.raw,i.text+=`
270
- `+s.text,this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
337
+ `)+n.raw,i.text+=`
338
+ `+n.text,this.inlineQueue.at(-1).src=i.text):r.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
271
339
  `)?"":`
272
- `)+s.raw,i.text+=`
273
- `+s.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let o=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),c;this.options.extensions.startBlock.forEach(d=>{c=d.call({lexer:this},a),typeof c=="number"&&c>=0&&(i=Math.min(i,c))}),i<1/0&&i>=0&&(o=e.substring(0,i+1))}if(this.state.top&&(s=this.tokenizer.paragraph(o))){let i=t.at(-1);n&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
340
+ `)+n.raw,i.text+=`
341
+ `+n.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},r.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),r.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},a),typeof l=="number"&&l>=0&&(i=Math.min(i,l))}),i<1/0&&i>=0&&(o=e.substring(0,i+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let i=r.at(-1);s&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
274
342
  `)?"":`
275
- `)+s.raw,i.text+=`
276
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=o.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
343
+ `)+n.raw,i.text+=`
344
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):r.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let i=r.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
277
345
  `)?"":`
278
- `)+s.raw,i.text+=`
279
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,i="";for(;e;){o||(i=""),o=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,n,i)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),v;this.options.extensions.startInline.forEach(_=>{v=_.call({lexer:this},u),typeof v=="number"&&v>=0&&(d=Math.min(d,v))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),o=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},At=class{options;parser;constructor(r){this.options=r||Te}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(Y.notSpaceStart)?.[0],s=r.replace(Y.endingNewline,"")+`
280
- `;return n?'<pre><code class="language-'+ie(n)+'">'+(t?s:ie(s,!0))+`</code></pre>
281
- `:"<pre><code>"+(t?s:ie(s,!0))+`</code></pre>
282
- `}blockquote({tokens:r}){return`<blockquote>
283
- ${this.parser.parse(r)}</blockquote>
284
- `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
285
- `}hr(r){return`<hr>
286
- `}list(r){let e=r.ordered,t=r.start,n="";for(let i=0;i<r.items.length;i++){let a=r.items[i];n+=this.listitem(a)}let s=e?"ol":"ul",o=e&&t!==1?' start="'+t+'"':"";return"<"+s+o+`>
287
- `+n+"</"+s+`>
288
- `}listitem(r){let e="";if(r.task){let t=this.checkbox({checked:!!r.checked});r.loose?r.tokens[0]?.type==="paragraph"?(r.tokens[0].text=t+" "+r.tokens[0].text,r.tokens[0].tokens&&r.tokens[0].tokens.length>0&&r.tokens[0].tokens[0].type==="text"&&(r.tokens[0].tokens[0].text=t+" "+ie(r.tokens[0].tokens[0].text),r.tokens[0].tokens[0].escaped=!0)):r.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):e+=t+" "}return e+=this.parser.parse(r.tokens,!!r.loose),`<li>${e}</li>
289
- `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
290
- `}table(r){let e="",t="";for(let s=0;s<r.header.length;s++)t+=this.tablecell(r.header[s]);e+=this.tablerow({text:t});let n="";for(let s=0;s<r.rows.length;s++){let o=r.rows[s];t="";for(let i=0;i<o.length;i++)t+=this.tablecell(o[i]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
346
+ `)+n.raw,i.text+=`
347
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):r.push(n);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let s=e,n=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,i="";for(;e;){o||(i=""),o=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=r.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,i)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if(this.options.extensions?.startInline){let h=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(b=>{p=b.call({lexer:this},d),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),o=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):r.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},Dr=class{options;parser;constructor(t){this.options=t||ot}space(t){return""}code({text:t,lang:e,escaped:r}){let s=(e||"").match(oe.notSpaceStart)?.[0],n=t.replace(oe.endingNewline,"")+`
348
+ `;return s?'<pre><code class="language-'+$e(s)+'">'+(r?n:$e(n,!0))+`</code></pre>
349
+ `:"<pre><code>"+(r?n:$e(n,!0))+`</code></pre>
350
+ `}blockquote({tokens:t}){return`<blockquote>
351
+ ${this.parser.parse(t)}</blockquote>
352
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
353
+ `}hr(t){return`<hr>
354
+ `}list(t){let e=t.ordered,r=t.start,s="";for(let i=0;i<t.items.length;i++){let a=t.items[i];s+=this.listitem(a)}let n=e?"ol":"ul",o=e&&r!==1?' start="'+r+'"':"";return"<"+n+o+`>
355
+ `+s+"</"+n+`>
356
+ `}listitem(t){let e="";if(t.task){let r=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+$e(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
357
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
358
+ `}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let s="";for(let n=0;n<t.rows.length;n++){let o=t.rows[n];r="";for(let i=0;i<o.length;i++)r+=this.tablecell(o[i]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
291
359
  <thead>
292
360
  `+e+`</thead>
293
- `+n+`</table>
294
- `}tablerow({text:r}){return`<tr>
295
- ${r}</tr>
296
- `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
297
- `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${ie(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Vs(r);if(s===null)return n;r=s;let o='<a href="'+r+'"';return e&&(o+=' title="'+ie(e)+'"'),o+=">"+n+"</a>",o}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let s=Vs(r);if(s===null)return ie(t);r=s;let o=`<img src="${r}" alt="${t}"`;return e&&(o+=` title="${ie(e)}"`),o+=">",o}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:ie(r.text)}},vr=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},pe=class Zr{options;renderer;textRenderer;constructor(e){this.options=e||Te,this.options.renderer=this.options.renderer||new At,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new vr}static parse(e,t){return new Zr(t).parse(e)}static parseInline(e,t){return new Zr(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions?.renderers?.[o.type]){let a=o,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=c||"";continue}}let i=o;switch(i.type){case"space":{n+=this.renderer.space(i);continue}case"hr":{n+=this.renderer.hr(i);continue}case"heading":{n+=this.renderer.heading(i);continue}case"code":{n+=this.renderer.code(i);continue}case"table":{n+=this.renderer.table(i);continue}case"blockquote":{n+=this.renderer.blockquote(i);continue}case"list":{n+=this.renderer.list(i);continue}case"html":{n+=this.renderer.html(i);continue}case"def":{n+=this.renderer.def(i);continue}case"paragraph":{n+=this.renderer.paragraph(i);continue}case"text":{let a=i,c=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],c+=`
298
- `+this.renderer.text(a);t?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions?.renderers?.[o.type]){let a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=a||"";continue}}let i=o;switch(i.type){case"escape":{n+=t.text(i);break}case"html":{n+=t.html(i);break}case"link":{n+=t.link(i);break}case"image":{n+=t.image(i);break}case"strong":{n+=t.strong(i);break}case"em":{n+=t.em(i);break}case"codespan":{n+=t.codespan(i);break}case"br":{n+=t.br(i);break}case"del":{n+=t.del(i);break}case"text":{n+=t.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},$t=class{options;block;constructor(r){this.options=r||Te}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?de.lex:de.lexInline}provideParser(){return this.block?pe.parse:pe.parseInline}},Zi=class{defaults=hr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=pe;Renderer=At;TextRenderer=vr;Lexer=de;Tokenizer=It;Hooks=$t;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let s=n;for(let o of s.header)t=t.concat(this.walkTokens(o.tokens,e));for(let o of s.rows)for(let i of o)t=t.concat(this.walkTokens(i.tokens,e));break}case"list":{let s=n;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{let i=s[o].flat(1/0);t=t.concat(this.walkTokens(i,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=e.renderers[s.name];o?e.renderers[s.name]=function(...i){let a=s.renderer.apply(this,i);return a===!1&&(a=o.apply(this,i)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[s.level];o?o.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),t.renderer){let s=this.defaults.renderer||new At(this.defaults);for(let o in t.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=t.renderer[i],c=s[i];s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u||""}}n.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new It(this.defaults);for(let o in t.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=t.tokenizer[i],c=s[i];s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}n.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new $t;for(let o in t.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=t.hooks[i],c=s[i];$t.passThroughHooks.has(o)?s[i]=d=>{if(this.defaults.async)return Promise.resolve(a.call(s,d)).then(v=>c.call(s,v));let u=a.call(s,d);return c.call(s,u)}:s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}n.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,o=t.walkTokens;n.walkTokens=function(i){let a=[];return a.push(o.call(this,i)),s&&(a=a.concat(s.call(this,i))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return de.lex(r,e??this.defaults)}parser(r,e){return pe.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let n={...t},s={...this.defaults,...n},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=r);let i=s.hooks?s.hooks.provideLexer():r?de.lex:de.lexInline,a=s.hooks?s.hooks.provideParser():r?pe.parse:pe.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>a(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(o);try{s.hooks&&(e=s.hooks.preprocess(e));let c=i(e,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let d=a(c,s);return s.hooks&&(d=s.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(r,e){return t=>{if(t.message+=`
299
- Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+ie(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Ce=new Zi;function S(r,e){return Ce.parse(r,e)}S.options=S.setOptions=function(r){return Ce.setOptions(r),S.defaults=Ce.defaults,Ms(S.defaults),S},S.getDefaults=hr,S.defaults=Te,S.use=function(...r){return Ce.use(...r),S.defaults=Ce.defaults,Ms(S.defaults),S},S.walkTokens=function(r,e){return Ce.walkTokens(r,e)},S.parseInline=Ce.parseInline,S.Parser=pe,S.parser=pe.parse,S.Renderer=At,S.TextRenderer=vr,S.Lexer=de,S.lexer=de.lex,S.Tokenizer=It,S.Hooks=$t,S.parse=S,S.options,S.setOptions,S.use,S.walkTokens,S.parseInline,pe.parse,de.lex;const Oe=new S.Renderer,Xs=r=>`<div class="overflow-x-auto"><div class="flex w-fit flex-col-reverse mr-4">${r}</div></div>`;Oe.code=r=>Xs(S.Renderer.prototype.code.call(Oe,r)),Oe.table=r=>Xs(S.Renderer.prototype.table.call(Oe,r)),Oe.link=r=>`<a href="${r.href}" target="_blank" rel="noopener noreferrer">${r.text}</a>`,S.setOptions({gfm:!0,breaks:!1,renderer:Oe});let Zs=!1;Zs||(Ps.addHook("afterSanitizeAttributes",r=>{r.tagName==="A"&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer"))}),Zs=!0);function Ki(r){const e=S.parse(r,{async:!1});return Ps.sanitize(e,{USE_PROFILES:{html:!0}})}var Ji=Object.defineProperty,Qi=(r,e,t,n)=>{for(var s=void 0,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(e,t,s)||s);return s&&Ji(e,t,s),s};class ot extends te{constructor(){super(...arguments),this.position="left"}connectedCallback(){super.connectedCallback(),this.setAttribute("role","article")}isHidden(){return!1}renderHeader(){return g.nothing}renderBody(){return g.nothing}renderFooter(){return g.nothing}render(){return this.isHidden()?g.nothing:g.html`<div class="relative w-full py-3 text-sm">
300
- <div class="group/message mx-auto my-auto px-3">
301
- <div class="flex max-w-full min-w-0 flex-grow-1 flex-col">
302
- <div
303
- class=${_e("relative flex flex-col empty:hidden",{"items-end":this.position==="right","items-start":this.position==="left","items-center":this.position==="center"})}
361
+ `+s+`</table>
362
+ `}tablerow({text:t}){return`<tr>
363
+ ${t}</tr>
364
+ `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
365
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${$e(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let s=this.parser.parseInline(r),n=Oo(t);if(n===null)return s;t=n;let o='<a href="'+t+'"';return e&&(o+=' title="'+$e(e)+'"'),o+=">"+s+"</a>",o}image({href:t,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let n=Oo(t);if(n===null)return $e(r);t=n;let o=`<img src="${t}" alt="${r}"`;return e&&(o+=` title="${$e(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:$e(t.text)}},Fn=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},xe=class ls{options;renderer;textRenderer;constructor(e){this.options=e||ot,this.options.renderer=this.options.renderer||new Dr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fn}static parse(e,r){return new ls(r).parse(e)}static parseInline(e,r){return new ls(r).parseInline(e)}parse(e,r=!0){let s="";for(let n=0;n<e.length;n++){let o=e[n];if(this.options.extensions?.renderers?.[o.type]){let a=o,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){s+=l||"";continue}}let i=o;switch(i.type){case"space":{s+=this.renderer.space(i);continue}case"hr":{s+=this.renderer.hr(i);continue}case"heading":{s+=this.renderer.heading(i);continue}case"code":{s+=this.renderer.code(i);continue}case"table":{s+=this.renderer.table(i);continue}case"blockquote":{s+=this.renderer.blockquote(i);continue}case"list":{s+=this.renderer.list(i);continue}case"html":{s+=this.renderer.html(i);continue}case"def":{s+=this.renderer.def(i);continue}case"paragraph":{s+=this.renderer.paragraph(i);continue}case"text":{let a=i,l=this.renderer.text(a);for(;n+1<e.length&&e[n+1].type==="text";)a=e[++n],l+=`
366
+ `+this.renderer.text(a);r?s+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):s+=l;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}parseInline(e,r=this.renderer){let s="";for(let n=0;n<e.length;n++){let o=e[n];if(this.options.extensions?.renderers?.[o.type]){let a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=a||"";continue}}let i=o;switch(i.type){case"escape":{s+=r.text(i);break}case"html":{s+=r.html(i);break}case"link":{s+=r.link(i);break}case"image":{s+=r.image(i);break}case"strong":{s+=r.strong(i);break}case"em":{s+=r.em(i);break}case"codespan":{s+=r.codespan(i);break}case"br":{s+=r.br(i);break}case"del":{s+=r.del(i);break}case"text":{s+=r.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},rr=class{options;block;constructor(t){this.options=t||ot}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?ke.lex:ke.lexInline}provideParser(){return this.block?xe.parse:xe.parseInline}},sh=class{defaults=Rn();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=xe;Renderer=Dr;TextRenderer=Fn;Lexer=ke;Tokenizer=Or;Hooks=rr;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let s of t)switch(r=r.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,e));for(let o of n.rows)for(let i of o)r=r.concat(this.walkTokens(i.tokens,e));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let i=n[o].flat(1/0);r=r.concat(this.walkTokens(i,e))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=e.renderers[n.name];o?e.renderers[n.name]=function(...i){let a=n.renderer.apply(this,i);return a===!1&&(a=o.apply(this,i)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[n.level];o?o.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),r.renderer){let n=this.defaults.renderer||new Dr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=r.renderer[i],l=n[i];n[i]=(...h)=>{let d=a.apply(n,h);return d===!1&&(d=l.apply(n,h)),d||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Or(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=r.tokenizer[i],l=n[i];n[i]=(...h)=>{let d=a.apply(n,h);return d===!1&&(d=l.apply(n,h)),d}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new rr;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=r.hooks[i],l=n[i];rr.passThroughHooks.has(o)?n[i]=h=>{if(this.defaults.async&&rr.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await a.call(n,h);return l.call(n,p)})();let d=a.call(n,h);return l.call(n,d)}:n[i]=(...h)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(n,h);return p===!1&&(p=await l.apply(n,h)),p})();let d=a.apply(n,h);return d===!1&&(d=l.apply(n,h)),d}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(i){let a=[];return a.push(o.call(this,i)),n&&(a=a.concat(n.call(this,i))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ke.lex(t,e??this.defaults)}parser(t,e){return xe.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let s={...r},n={...this.defaults,...s},o=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let i=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer():t?ke.lex:ke.lexInline)(i,n),l=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(l,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser():t?xe.parse:xe.parseInline)(l,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(o);try{n.hooks&&(e=n.hooks.preprocess(e));let i=(n.hooks?n.hooks.provideLexer():t?ke.lex:ke.lexInline)(e,n);n.hooks&&(i=n.hooks.processAllTokens(i)),n.walkTokens&&this.walkTokens(i,n.walkTokens);let a=(n.hooks?n.hooks.provideParser():t?xe.parse:xe.parseInline)(i,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(i){return o(i)}}}onError(t,e){return r=>{if(r.message+=`
367
+ Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+$e(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},it=new sh;function $(t,e){return it.parse(t,e)}$.options=$.setOptions=function(t){return it.setOptions(t),$.defaults=it.defaults,vo($.defaults),$},$.getDefaults=Rn,$.defaults=ot,$.use=function(...t){return it.use(...t),$.defaults=it.defaults,vo($.defaults),$},$.walkTokens=function(t,e){return it.walkTokens(t,e)},$.parseInline=it.parseInline,$.Parser=xe,$.parser=xe.parse,$.Renderer=Dr,$.TextRenderer=Fn,$.Lexer=ke,$.lexer=ke.lex,$.Tokenizer=Or,$.Hooks=rr,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,xe.parse,ke.lex;const oh=y.css`
368
+ .markdown{--markdown-color-text:var(--gaia-color-text-body);--markdown-color-surface:var(--gaia-color-surface-page);--markdown-border-radius:4px;--markdown-surface-color:var(--gaia-color-surface-page);--markdown-hr:var(--gaia-color-neutral-20);--markdown-quote-borders:var(--gaia-color-border-primary);--markdown-kbd-shadows:rgb(0 0 0/5%);--markdown-th-borders:var(--gaia-color-neutral-30);--markdown-td-borders:var(--gaia-color-neutral-20);color:var(--markdown-color-text);font:var(--gaia-font-size-base);letter-spacing:var(--gaia-letter-spacing-base);max-width:unset;overflow-wrap:break-word}.markdown :where(p){margin-bottom:1.25em;margin-top:1.25em}.markdown :where([class~=lead]){color:var(--markdown-color-text);font-size:1.25em;line-height:1.6;margin-bottom:1.2em;margin-top:1.2em}.markdown :where(a){color:var(--markdown-color-text);font-weight:400;text-decoration:underline}.markdown :where(strong){color:var(--markdown-color-text);font-weight:700}.markdown :where(a strong),
369
+ .markdown :where(blockquote strong),
370
+ .markdown :where(thead th strong){color:inherit}.markdown :where(ol){list-style-type:decimal;margin-bottom:1.25em;margin-top:1.25em;padding-inline-start:1.625em}.markdown :where(ol[type=A]){list-style-type:upper-alpha}.markdown :where(ol[type=a]){list-style-type:lower-alpha}.markdown :where(ol[type="A s"]){list-style-type:upper-alpha}.markdown :where(ol[type="a s"]){list-style-type:lower-alpha}.markdown :where(ol[type=I]){list-style-type:upper-roman}.markdown :where(ol[type=i]){list-style-type:lower-roman}.markdown :where(ol[type="I s"]){list-style-type:upper-roman}.markdown :where(ol[type="i s"]){list-style-type:lower-roman}.markdown :where(ol[type="1"]){list-style-type:decimal}.markdown :where(ul){list-style-type:disc;margin-bottom:1.25em;margin-top:1.25em;padding-inline-start:1.625em}.markdown :where(ol>li)::marker{color:var(--markdown-color-text);font-weight:400}.markdown :where(ul>li)::marker{color:var(--markdown-color-text)}.markdown :where(dt){color:var(--markdown-color-text);font-weight:600;margin-top:1.25em}.markdown :where(hr){border-color:var(--markdown-hr);border-top-width:1px;margin-bottom:3em;margin-top:3em}.markdown :where(blockquote){border-color:var(--markdown-quote-borders)!important;border-inline-start-width:4px;border-left:solid;color:var(--markdown-color-text);font-style:italic;font-weight:400;margin:0 0 .5em;padding-block:.5em;padding-inline-start:1em;quotes:"“" "”" "‘" "’";>p{margin:0}}.markdown :where(blockquote p:first-of-type):before{content:open-quote}.markdown :where(blockquote p:last-of-type):after{content:close-quote}.markdown :where(h1){color:var(--markdown-color-text);font-size:2.25em;font-weight:400;line-height:1.5555;margin-bottom:8px;margin-top:0}.markdown :where(h1 strong){color:inherit;font-weight:900}.markdown :where(h2){color:var(--markdown-color-text);font-size:1.5em;font-weight:500;line-height:1.5;margin-bottom:4px;margin-top:16px}.markdown :where(h2 strong){color:inherit;font-weight:800}.markdown :where(h3){color:var(--markdown-color-text);font-size:1.25em;font-weight:600;line-height:1.6;margin-bottom:4px;margin-top:16px}.markdown :where(h3 strong){color:inherit;font-weight:700}.markdown :where(h4){color:var(--markdown-color-text);font-size:1em;font-weight:700;line-height:1.5;margin-bottom:0;margin-top:16px}.markdown :where(h4 strong){color:inherit;font-weight:700}.markdown :where(h5){color:var(--markdown-color-text);font-size:1em;font-weight:600;line-height:1.5;margin-bottom:0;margin-top:0}.markdown :where(h5 strong){color:inherit;font-weight:700}.markdown :where(h6){color:var(--markdown-color-text);font-size:1em;font-weight:500;line-height:1.5;margin-bottom:0;margin-top:0}.markdown :where(h6 strong){color:inherit;font-weight:700}.markdown :where(img){margin-bottom:2em;margin-top:2em}.markdown :where(picture){display:block;margin-bottom:2em;margin-top:2em}.markdown :where(video){margin-bottom:2em;margin-top:2em}.markdown :where(kbd){background-color:var(--markdown-color-surface);border-radius:var(--markdown-border-radius);box-shadow:
371
+ 0 0 0 1px var(--markdown-kbd-shadows),
372
+ 0 3px 0 var(--markdown-kbd-shadows);color:var(--markdown-color-text);font-family:inherit;font-size:.875em;font-weight:500;padding-inline:.375em;padding-bottom:.1875em;padding-top:.1875em}.markdown :where(code){background-color:var(--markdown-color-surface);border-radius:var(--markdown-border-radius);color:var(--markdown-color-text);font-size:.875em;font-weight:600;padding:.125em .25em}.markdown :where(code)::before,
373
+ .markdown :where(code)::after{content:none}.markdown :where(a code),
374
+ .markdown :where(h1 code){color:inherit;font-weight:inherit}.markdown :where(h2 code){color:inherit;font-size:.875em;font-weight:inherit}.markdown :where(h3 code){color:inherit;font-size:.9em;font-weight:inherit}.markdown :where(h4 code),
375
+ .markdown :where(h5 code),
376
+ .markdown :where(h6 code),
377
+ .markdown :where(blockquote code),
378
+ .markdown :where(thead th code){color:inherit;font-weight:inherit}.markdown :where(pre){background-color:var(--markdown-color-surface);border-radius:var(--markdown-border-radius);color:var(--markdown-color-text);font-size:.875em;font-weight:400;line-height:1.7143;margin-bottom:1.7143em;margin-top:1.7143em;overflow-x:auto;padding-inline:1.1429em;padding-bottom:.8571em;padding-top:.8571em}.markdown :where(pre code){background-color:#0000;border-radius:0;border-width:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;padding:0}.markdown :where(pre code)::before,
379
+ .markdown :where(pre code)::after{content:none}.markdown :where(table){border-collapse:collapse;font-size:.875em;line-height:1.7143;margin-bottom:2em;margin-top:2em;table-layout:auto;width:100%}.markdown :where(thead){border-bottom:1px solid var(--markdown-th-borders)}.markdown :where(thead th){color:var(--markdown-color-text);font-weight:600;padding-inline:.5714em;padding-bottom:.5714em;vertical-align:bottom}.markdown :where(tbody tr){border-bottom:1px solid var(--markdown-td-borders)}.markdown :where(tbody tr:last-child){border-bottom-width:0}.markdown :where(tbody td){vertical-align:baseline}.markdown :where(tfoot){border-top:1px solid var(--markdown-th-borders)}.markdown :where(tfoot td){vertical-align:top}.markdown :where(th,td){text-align:start}.markdown :where(figure>*){margin-bottom:0;margin-top:0}.markdown :where(figcaption),
380
+ .markdown :where(caption){color:var(--markdown-color-text);font-size:.875em;line-height:1.4286;margin-top:.8571em}.markdown :where(picture>img){margin-bottom:0;margin-top:0}.markdown :where(li){margin-bottom:.5em;margin-top:.5em}.markdown :where(ol > li),
381
+ .markdown :where(ul > li){padding-inline-start:.375em}.markdown :where(.markdown>ul>li p){margin-bottom:.75em;margin-top:.75em}.markdown :where(.markdown>ul>li>p:first-child){margin-top:1.25em}.markdown :where(.markdown>ul>li>p:last-child){margin-bottom:1.25em}.markdown :where(.markdown>ol>li>p:first-child){margin-top:1.25em}.markdown :where(.markdown>ol>li>p:last-child){margin-bottom:1.25em}.markdown :where(ul ul,ul ol,ol ul,ol ol){margin-bottom:.75em;margin-top:.75em}.markdown :where(dl){margin-bottom:1.25em;margin-top:1.25em}.markdown :where(dd){margin-top:.5em;padding-inline-start:1.625em}.markdown :where(hr + *),
382
+ .markdown :where(h2 + *),
383
+ .markdown :where(h3 + *),
384
+ .markdown :where(h4 + *),
385
+ .markdown :where(h5 + *),
386
+ .markdown :where(h6 + *){margin-top:0}.markdown :where(thead th:first-child){padding-inline-start:0}.markdown :where(thead th:last-child){padding-inline-end:0}.markdown :where(tbody td,tfoot td){padding-inline:.5714em;padding-bottom:.5714em;padding-top:.5714em}.markdown :where(tbody td:first-child,tfoot td:first-child){padding-inline-start:0}.markdown :where(tbody td:last-child,tfoot td:last-child){padding-inline-end:0}.markdown :where(figure){margin-bottom:2em;margin-top:2em}.markdown :where(.markdown>:first-child){margin-top:0}.markdown :where(.markdown>:last-child){margin-bottom:0}.overflow-wrap{overflow:auto;width:100cqw;table{margin:0 12px 0 0;width:-moz-fit-content;width:fit-content}}
387
+ `;var ih=Object.defineProperty,ah=Object.getOwnPropertyDescriptor,Lo=(t,e,r,s)=>{for(var n=s>1?void 0:s?ah(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&ih(e,r,n),n};const Tt=new $.Renderer,No=t=>`<div class="overflow-wrap">${t}</div>`;Tt.code=t=>No($.Renderer.prototype.code.call(Tt,t)),Tt.table=t=>No($.Renderer.prototype.table.call(Tt,t)),Tt.link=t=>`<a href="${t.href}" target="_blank" rel="noopener noreferrer">${t.text}</a>`,$.setOptions({gfm:!0,breaks:!1,renderer:Tt});let zo=!1;zo||(wo.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}),zo=!0);let Mr=class extends U{constructor(){super(...arguments),this.value=""}render(){const t=$.parse(this.value||"",{async:!1}),e=wo.sanitize(t);return y.html`<div class="markdown">${ki.unsafeHTML(e)}</div>`}};Mr.styles=[oh],Lo([f.property({attribute:!1,reflect:!1})],Mr.prototype,"value",2),Mr=Lo([f.customElement("gaia-markdown-content")],Mr);function lh(t,e,r){return y.html`<gaia-message from="assistant" ${e}>
388
+ <gaia-avatar icon="sparkles" slot="avatar">GAiA</gaia-avatar>
389
+ ${le.when(t.citations.length>0,()=>y.html`<gaia-source-list .sources=${t.citations} slot="pre-content"></gaia-source-list>`)}
390
+ <gaia-markdown-content .value=${t.content}></gaia-markdown-content>
391
+ ${le.when(t.approvalStatus,()=>y.html`
392
+ <gaia-button
393
+ data-testid="assistant-message-approve-btn"
394
+ variant="secondary"
395
+ slot="actions"
396
+ ?disabled=${t.approvalStatus!=="approvalRequested"}
397
+ @click=${()=>r.onApproveToolCall(t.turnId,t.messageId)}
304
398
  >
305
- ${this.renderHeader()}
306
- </div>
307
- <div
308
- class="relative flex min-h-8 w-full flex-col items-end gap-2 text-start break-words whitespace-normal"
399
+ <gaia-icon name="check" slot="prefix"></gaia-icon>
400
+ ${E("Yes",{id:"assistant-message-approve"})}
401
+ </gaia-button>
402
+ <gaia-button
403
+ data-testid="assistant-message-decline-btn"
404
+ variant="secondary"
405
+ slot="actions"
406
+ ?disabled=${t.approvalStatus!=="approvalRequested"}
407
+ @click=${()=>r.onDeclineToolCall(t.turnId,t.messageId)}
309
408
  >
310
- <div
311
- class=${_e("flex w-full flex-col gap-1 empty:hidden text-message",{"items-end":this.position==="right","items-start":this.position==="left","items-center":this.position==="center"})}
312
- >
313
- ${this.renderBody()}
314
- </div>
409
+ <gaia-icon name="x" slot="prefix"></gaia-icon>
410
+ ${E("No",{id:"assistant-message-decline"})}
411
+ </gaia-button>
412
+ </div>`)}
413
+ </gaia-message>`}function ch(t,e){return y.html`<gaia-message from="operator" ${e}>
414
+ <gaia-avatar image=${Kr.ifDefined(t.operator.pictureUrl)} slot="avatar"
415
+ >${t.operator.name}</gaia-avatar
416
+ >
417
+ ${le.when(t.isTyping,()=>y.html`<gaia-typing-indicator></gaia-typing-indicator>`,()=>t.content)}
418
+ </gaia-message>`}function hh(t,e,r){return y.html`<gaia-message from="system" ${e}>
419
+ ${le.when(t.isSupportStartedMarker,()=>y.html` <div class="system-message">
420
+ <gaia-icon name="headset" label="Headset" size="lg"></gaia-icon>
421
+ <div class="system-message-content">
422
+ <h2 class="system-message-headline">
423
+ ${E("You have been connected to a human support agent.",{id:"system-message-support-started"})}
424
+ </h2>
315
425
  </div>
316
- </div>
317
- <div
318
- class=${_e("flex justify-start empty:hidden",{"justify-end":this.position==="right","justify-start":this.position==="left","justify-center":this.position==="center"})}
319
- >
320
- ${this.renderFooter()}
321
- </div>
322
- </div>
323
- </div>`}}Qi([w.property({attribute:!1})],ot.prototype,"message");var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,Ks=(r,e,t,n)=>{for(var s=n>1?void 0:n?ta(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&ea(e,t,s),s};let yr=class extends ot{constructor(){super(...arguments),this.citationsExpanded=!1}toggleCitations(){this.citationsExpanded=!this.citationsExpanded}approveToolCall(){this.message.role==="assistant"&&this.dispatchEvent(new Co(this.message.turnId,this.message.messageId))}declineToolCall(){this.message.role==="assistant"&&this.dispatchEvent(new Io(this.message.turnId,this.message.messageId))}isHidden(){return!("content"in this.message)||!this.message.content}renderHeader(){return g.html`<div class="text-primary-900 mb-1 flex h-6 items-center gap-x-2">
324
- <div class="flex size-4 items-center justify-center">${P.unsafeSVG(Xe)}</div>
325
- <span class="text-sm font-medium">GAiA</span>
326
- </div>
327
- ${ts.guard([this.message.citations.length,this.citationsExpanded],()=>this.message.citations.length?g.html`<div class="text-primary-800 hover:text-primary-900 text-xs font-semibold">
328
- <a
329
- role="button"
330
- class="group flex items-center gap-2 select-none"
331
- aria-expanded=${this.citationsExpanded}
332
- @click=${this.toggleCitations}
426
+ </div>`)}
427
+ ${le.when(t.isSupportCompletedMarker,()=>y.html`<div class="system-message">
428
+ <gaia-icon name="headset" label="Headset" size="lg"></gaia-icon>
429
+ <div class="system-message-content">
430
+ <h2 class="system-message-headline">
431
+ ${E("You have been disconnected from the human support agent.",{id:"system-message-support-completed"})}
432
+ </h2>
433
+ <p class="system-message-text">
434
+ ${E("To continue, please start a new conversation. We'd also love to hear your feedback on our human support experience!",{id:"system-message-support-feedback"})}
435
+ </p>
436
+ <div class="system-message-actions">
437
+ <gaia-button variant="primary" @click=${r.onNewConversation}
438
+ >${E("New Conversation",{id:"system-message-start-new-conversation"})}</gaia-button
333
439
  >
334
- <div
335
- class="flex size-4 items-center justify-center transition-transform duration-200 ease-in-out not-group-aria-expanded:-rotate-90"
336
- >
337
- ${P.unsafeSVG(Wo)}
338
- </div>
339
- ${y(ft`Used ${this.message.citations.length} sources`,{id:"assistant-message-citations-length"})}
340
- </a>
341
- <section
342
- role="region"
343
- class=${_e("relative grid gap-2 transition-[transform,opacity,height,visibility] duration-200 ease-in-out overflow-hidden",{"h-0 invisible opacity-0":!this.citationsExpanded,"h-auto py-2 visible opacity-100":this.citationsExpanded})}
440
+ <gaia-button variant="secondary" @click=${r.onProvideFeedback}
441
+ >${E("Give Feedback",{id:"system-message-provide-feedback"})}</gaia-button
344
442
  >
345
- ${Jr.repeat(this.message.citations,r=>r.url,r=>g.html`<div class="flex min-w-0 items-center gap-2 overflow-x-clip">
346
- <div class="flex size-4 items-center justify-center">
347
- ${P.unsafeSVG(Go)}
348
- </div>
349
- <a
350
- href=${r.url}
351
- class="truncate hover:underline"
352
- target="_blank"
353
- rel="noopener noreferrer"
354
- title=${r.url}
355
- >
356
- ${r.title}
357
- </a>
358
- </div>`)}
359
- </section>
360
- </div>`:g.nothing)}`}renderBody(){return ts.guard(this.message.content.length,()=>g.html` <div class="prose prose-gaia prose-table:min-w-max">
361
- ${Kr.unsafeHTML(Ki(this.message.content))}
362
- </div>`)}renderFooter(){return this.message.approvalStatus?g.html`
363
- <div
364
- class="mt-2 flex items-center justify-center gap-x-2"
365
- data-status=${this.message.approvalStatus}
366
- >
367
- <button
368
- @click=${this.approveToolCall}
369
- data-testid="assistant-message-approve-btn"
370
- .disabled=${this.message.approvalStatus!=="approvalRequested"}
371
- class=${_e("btn btn-secondary w-fit border border-solid px-4 py-2",{"bg-green-100 border-green-600 text-primary-900 [&_svg]:text-green-600":this.message.approvalStatus==="approved"})}
372
- >
373
- <div class="flex items-center justify-center gap-2">
374
- <div class="flex size-4 items-center justify-center">${P.unsafeSVG(qo)}</div>
375
- <span class="text-sm">${y("Yes",{id:"assistant-message-approve"})}</span>
376
- </div>
377
- </button>
378
- <button
379
- @click=${this.declineToolCall}
380
- data-testid="assistant-message-decline-btn"
381
- .disabled=${this.message.approvalStatus!=="approvalRequested"}
382
- data-selected=${this.message.approvalStatus==="declined"}
383
- class=${_e("btn btn-secondary w-fit border border-solid px-4 py-2",{"bg-red-100 border-red-600 text-primary-900 [&_svg]:text-red-600":this.message.approvalStatus==="declined"})}
384
- >
385
- <div class="flex items-center justify-center gap-2">
386
- <div class="flex size-4 items-center justify-center">${P.unsafeSVG(Vo)}</div>
387
- <span class="text-sm">${y("No",{id:"assistant-message-decline"})}</span>
388
- </div>
389
- </button>
443
+ </div>
390
444
  </div>
391
- `:g.nothing}};Ks([w.state()],yr.prototype,"citationsExpanded",2),yr=Ks([w.customElement("gaia-chat-assistant-message")],yr);const Js='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-headset-icon lucide-headset"><path d="M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z"/><path d="M21 16v2a4 4 0 0 1-4 4h-5"/></svg>';var ra=Object.getOwnPropertyDescriptor,sa=(r,e,t,n)=>{for(var s=n>1?void 0:n?ra(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let Qs=class extends ot{renderHeader(){return g.html`<div class="flex items-center gap-1 pb-1">
392
- <div class="relative size-6 p-0.5">
393
- <div class="aspect-square h-full w-full overflow-hidden rounded-full">
394
- ${this.message.operator.pictureUrl?g.html`<img
395
- src=${this.message.operator.pictureUrl}
396
- alt=${this.message.operator.name}
397
- class="object-cover"
398
- />`:g.html`<div class="text-primary-900 flex h-full w-full items-center justify-center">
399
- <div class="size-4">${P.unsafeSVG(Js)}</div>
400
- </div>`}
445
+ </div>`)}
446
+ </gaia-message>`}function dh(t,e){return y.html`<gaia-message from="user" ${e}> ${t.content} </gaia-message>`}function uh(t,e,r){switch(t.role){case"assistant":return lh(t,e,r);case"operator":return ch(t,e);case"system":return hh(t,e,r);case"user":return dh(t,e);case"tool":return y.nothing;default:{const s=t;throw new Error(`Unknown message role: ${s.role}`)}}}function ph(t){return t.filter(e=>!(e.role==="assistant"&&e.content===""))}class gh{constructor(e,r,s,n){this.host=e,this.container=r,this.scrollView=s,this.lastMessageElement=n,this.host.addController(this),this.container=r,this.scrollView=s}hostConnected(){}hostDisconnected(){}get lastMessageRole(){return this.lastMessageElement.value?.from??"assistant"}async resetScroll(){const{scrollView:e}=this;e.value&&(e.value.style.height="auto")}async scrollToBottom(e="instant"){const{container:r}=this;r.value&&requestAnimationFrame(()=>{r.value.scrollTo({top:r.value.scrollHeight,behavior:e})})}async anchorUserMessage(e="instant"){const{container:r,scrollView:s,lastMessageElement:n}=this;if(!r.value||!s.value||!n.value)return;const o=r.value.getBoundingClientRect().height,i=n.value.offsetTop;s.value.style.height=`${o+i}px`,requestAnimationFrame(()=>{r.value.scrollTo({top:r.value.scrollHeight,behavior:e})})}async handleScrollUpdate(e){const{messageCount:r,previousMessageCount:s,channel:n,isFeedbackOpen:o}=e;if(o){await this.scrollToBottom();return}if(r===0){await this.resetScroll();return}const i=r>0&&s===0,a=r>s;if(i){await this.scrollToBottom();return}a&&(n==="assistant"&&this.lastMessageRole==="user"?await this.anchorUserMessage("smooth"):await this.scrollToBottom("smooth"))}}var fh=Object.defineProperty,mh=Object.getOwnPropertyDescriptor,_e=(t,e,r,s)=>{for(var n=s>1?void 0:s?mh(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&fh(e,r,n),n};let ue=class extends U{constructor(){super(...arguments),this.containerRef=pt.createRef(),this.scrollViewRef=pt.createRef(),this.lastMessageRef=pt.createRef(),this.scrollController=new gh(this,this.containerRef,this.scrollViewRef,this.lastMessageRef),this.isThinking=!1,this.isFeedbackOpen=!1,this.channel="assistant",this.messages=[],this.handleApproveToolCall=(t,e)=>{this.closeFeedbackIfOpen(),this.streamEffect?.approveToolCall(t,e),this.dispatchEvent(new al(t,e))},this.handleDeclineToolCall=(t,e)=>{this.closeFeedbackIfOpen(),this.streamEffect?.declineToolCall(t,e),this.dispatchEvent(new ll(t,e))},this.handleNewConversation=()=>{this.conversationEffect?.clear(),this.supportEffect?.stop(),this.dispatchEvent(new Vs)},this.handleProvideSupportFeedback=()=>{this.store.dispatch(Qs("support"))}}connectedCallback(){super.connectedCallback(),this.unsubscribe=this.store.subscribe(t=>{this.isThinking=t.session.isThinking,this.isFeedbackOpen=t.ui.feedbackFormOpen,this.channel=t.session.channel,this.error=t.ui.error??void 0;const e=Jl();e in t.config.welcomeMessages?this.welcomeMessage=t.config.welcomeMessages[e]:this.welcomeMessage=t.config.welcomeMessages.en,this.messages=Sl(t)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.()}closeFeedbackIfOpen(){this.isFeedbackOpen&&this.store.dispatch(jt())}get messageCallbacks(){return{onApproveToolCall:this.handleApproveToolCall,onDeclineToolCall:this.handleDeclineToolCall,onNewConversation:this.handleNewConversation,onProvideFeedback:this.handleProvideSupportFeedback}}async updated(t){if(super.updated(t),t.has("messages")||t.has("isFeedbackOpen")){await this.updateComplete;const e=t.get("messages");await this.scrollController.handleScrollUpdate({messageCount:this.messages.length,previousMessageCount:e?.length??0,channel:this.channel,isFeedbackOpen:this.isFeedbackOpen})}}render(){if(this.messages.length===0)return y.html`<div class="conversation">
447
+ <gaia-welcome-message .welcomeMessage=${this.welcomeMessage}></gaia-welcome-message>
448
+ </div>`;const t=ph(this.messages);return y.html`
449
+ <div class="conversation" data-testid="conversation" ${pt.ref(this.containerRef)}>
450
+ <div class="scroll-container" ${pt.ref(this.scrollViewRef)}>
451
+ ${yi.repeat(t,e=>e.messageId,(e,r)=>{const s=r===t.length-1?pt.ref(this.lastMessageRef):y.nothing;return uh(e,s,this.messageCallbacks)})}
452
+ ${le.when(this.isThinking,()=>y.html`<gaia-message from="assistant">
453
+ <gaia-avatar icon="sparkles" slot="avatar">
454
+ <span class="shimmer"
455
+ >${E("Thinking...",{id:"thinking-indicator-text"})}</span
456
+ >
457
+ </gaia-avatar>
458
+ </gaia-message>`)}
459
+ ${le.when(this.isFeedbackOpen,()=>y.html`<gaia-feedback></gaia-feedback>`)}
460
+ ${le.when(this.error,()=>y.html`<gaia-error-notification
461
+ ?absolute=${!0}
462
+ .error=${this.error}
463
+ ></gaia-error-notification>`)}
401
464
  </div>
402
465
  </div>
403
- <span class="text-primary-900 text-sm font-medium">${this.message.operator.name}</span>
404
- </div>`}renderBody(){return!("content"in this.message)||!this.message.content?null:g.html` <div
405
- class="relative flex min-h-9 w-fit max-w-[90%] rounded-sm bg-neutral-100 px-4 py-1.5"
406
- >
407
- ${this.message.isTyping?g.html`<div class="flex items-center space-x-1">
408
- <span class="animate-grow h-2 w-2 rounded-full bg-neutral-600"></span>
409
- <span
410
- class="animate-grow h-2 w-2 rounded-full bg-neutral-600 [animation-delay:0.3s]"
411
- ></span>
412
- <span
413
- class="animate-grow h-2 w-2 rounded-full bg-neutral-600 [animation-delay:0.6s]"
414
- ></span>
415
- </div> `:g.html`<div class="text-primary-900 whitespace-pre-wrap">${this.message.content}</div>`}
416
- </div>`}};Qs=sa([w.customElement("gaia-chat-operator-message")],Qs);var na=Object.getOwnPropertyDescriptor,oa=(r,e,t,n)=>{for(var s=n>1?void 0:n?na(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let en=class extends ot{constructor(){super(...arguments),this.position="center"}isHidden(){return this.message.isVisuallyHidden}clearConversation(){this.dispatchEvent(new er)}openFeedbackForm(){this.dispatchEvent(new Qt("support"))}renderBody(){return this.message.isSupportStartedMarker?g.html`<div
417
- class="m-0 grid w-full grid-cols-[auto_1fr_auto] gap-2 rounded-sm border border-solid border-neutral-600 p-4 [grid-template-areas:'leading_primary']"
418
- >
419
- <div class="text-primary-900 flex flex-col gap-2 text-sm [grid-area:primary]">
420
- <span
421
- >${y("You have been connected to a human support agent.",{id:"system-message-support-started"})}</span
422
- >
423
- </div>
424
- <div class="flex [grid-area:leading]">
425
- <div class="text-primary-900 flex size-5 items-center justify-center">
426
- ${P.unsafeSVG(Js)}
427
- </div>
428
- </div>
429
- </div>`:this.message.isSupportCompletedMarker?g.html`<div
430
- class="m-0 grid w-full grid-cols-[auto_1fr_auto] gap-2 rounded-sm border border-solid border-neutral-600 p-4 [grid-template-areas:'leading_primary']"
431
- >
432
- <div class="text-primary-900 flex flex-col gap-2 text-sm [grid-area:primary]">
433
- <span
434
- >${y("You have been disconnected from the human support agent.",{id:"system-message-support-completed"})}</span
466
+ `}};ue.styles=[tc],_e([ce({context:kt})],ue.prototype,"store",2),_e([ce({context:dn})],ue.prototype,"streamEffect",2),_e([ce({context:xr})],ue.prototype,"supportEffect",2),_e([ce({context:un})],ue.prototype,"conversationEffect",2),_e([f.state()],ue.prototype,"welcomeMessage",2),_e([f.state()],ue.prototype,"isThinking",2),_e([f.state()],ue.prototype,"isFeedbackOpen",2),_e([f.state()],ue.prototype,"channel",2),_e([f.state()],ue.prototype,"error",2),_e([f.state()],ue.prototype,"messages",2),ue=_e([f.customElement("gaia-conversation")],ue);const bh=y.css`
467
+ .disclaimer{align-items:center;display:flex;justify-content:center}.disclaimer-text{color:var(--gaia-color-text-on-disabled);font-size:var(--gaia-font-size-xs);font-weight:var(--gaia-font-weight-regular);letter-spacing:var(--gaia-letter-spacing-xs);line-height:var(--gaia-line-height-xs);text-align:center;a{color:var(--gaia-color-text-on-disabled);font-weight:var(--gaia-font-weight-medium);text-decoration:underline}}
468
+ `;var wh=Object.getOwnPropertyDescriptor,vh=(t,e,r,s)=>{for(var n=s>1?void 0:s?wh(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=i(n)||n);return n};let Bn=class extends U{render(){return y.html`
469
+ <div class="disclaimer">
470
+ <span class="disclaimer-text">
471
+ ${E("Answers are generated by AI and may contain errors, read more",{id:"disclaimer-text"})}
472
+ <a
473
+ target="_blank"
474
+ href="https://kundeportal.vismasoftware.no/s/article/Vilkår-for-bruk-av-Visma-Software-AI-chat"
435
475
  >
436
- <span class="text-neutral-700">
437
- ${y("To continue, please start a new conversation. We'd also love to hear your feedback on our human support experience!",{id:"system-message-support-feedback"})}
438
- </span>
439
-
440
- <div class="mt-3 flex flex-col gap-4 @md:flex-row">
441
- <button class="btn btn-primary px-4 py-2" @click=${this.clearConversation}>
442
- <div class="flex items-center justify-center gap-x-2">
443
- <div class="flex size-4 items-center justify-center">
444
- ${P.unsafeSVG(ms)}
445
- </div>
446
- ${y("Start New Conversation",{id:"system-message-start-new-conversation"})}
447
- </div>
448
- </button>
449
- <button class="btn btn-secondary px-4 py-2" @click=${this.openFeedbackForm}>
450
- <div class="flex items-center justify-center gap-x-2">
451
- <div class="flex size-4 items-center justify-center">
452
- ${P.unsafeSVG(fs)}
453
- </div>
454
- ${y("Provide Feedback",{id:"system-message-provide-feedback"})}
455
- </div>
456
- </button>
457
- </div>
458
- </div>
459
- <div class="flex [grid-area:leading]">
460
- <div class="text-primary-900 flex size-5 items-center justify-center">
461
- ${P.unsafeSVG(Jt)}
462
- </div>
463
- </div>
464
- </div>`:g.nothing}};en=oa([w.customElement("gaia-chat-system-message")],en);var ia=Object.getOwnPropertyDescriptor,aa=(r,e,t,n)=>{for(var s=n>1?void 0:n?ia(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let tn=class extends ot{constructor(){super(...arguments),this.position="right"}renderBody(){return!("content"in this.message)||!this.message.content?null:g.html` <div class="relative max-w-[90%] rounded-sm bg-blue-100 px-4 py-1.5">
465
- <div class="whitespace-pre-wrap">${this.message.content}</div>
466
- </div>`}};tn=aa([w.customElement("gaia-chat-user-message")],tn);var la=Object.getOwnPropertyDescriptor,ca=(r,e,t,n)=>{for(var s=n>1?void 0:n?la(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let rn=class extends te{render(){return g.html`
467
- <div class="relative w-full py-3">
468
- <div class="mx-auto my-auto px-3 text-sm">
469
- <div class="text-primary-900 mb-1 flex h-6 items-center gap-x-2">
470
- <div class="flex size-4 items-center justify-center">${P.unsafeSVG(Xe)}</div>
471
- <span class="text-shimmer text-shimmer-primary"
472
- >${y("Thinking...",{id:"thinking-indicator-text"})}</span
473
- >
474
- </div>
475
- </div>
476
- </div>
477
- `}};rn=ca([w.customElement("gaia-chat-thinking-indicator")],rn);const ha='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-lightbulb-icon lucide-lightbulb"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',da='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-icon lucide-message-circle"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/></svg>';var pa=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,kr=(r,e,t,n)=>{for(var s=n>1?void 0:n?ua(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&pa(e,t,s),s};const ga={SparklesIcon:Xe,LightBulbIcon:ha,MessageCircleIcon:da};let Rt=class extends te{constructor(){super(...arguments),this.isInitialized=!1}renderSkeleton(){return g.html`
478
- <div>
479
- <div class="skeleton my-1 h-6 w-full @md:w-36"></div>
480
- <div class="flex flex-col gap-y-1">
481
- <p class="skeleton h-4 w-full @md:w-[90%]"></p>
482
- <p class="skeleton h-4 w-full"></p>
483
- <p class="skeleton h-4 w-full @md:w-1/2"></p>
484
- </div>
485
- </div>
486
- <div class="hidden flex-col gap-2 @xs:flex @xl:grid @xl:grid-cols-2">
487
- <div class="skeleton h-14 w-full"></div>
488
- <div class="skeleton h-14 w-full"></div>
489
- </div>
490
-
491
- <div class="skeleton my-1 h-5 w-full @md:w-1/2"></div>
492
- `}renderWelcomeMessage(r){return!r&&!this.isInitialized?this.renderSkeleton():r?g.html`
493
- <div>
494
- <div class="flex items-center gap-x-2">
495
- <div class="flex size-5 items-center justify-center">${P.unsafeSVG(Xe)}</div>
496
- <p class="text-shimmer text-shimmer-primary text-lg font-semibold">
497
- ${r.title}
498
- </p>
499
- </div>
500
- <p>${r.body}</p>
501
- </div>
502
- <div class="hidden flex-col gap-2 @xs:flex @xl:grid @xl:grid-cols-2">
503
- ${Qr.map(r.blocks,e=>this.renderMessageBlock(e))}
504
- </div>
505
-
506
- <p class="font-semibold">${r.callToAction}</p>
507
- `:g.html`
508
- <div class="flex items-center gap-x-2">
509
- <div class="flex size-5 items-center justify-center">${P.unsafeSVG(Xe)}</div>
510
- <p class="text-shimmer text-shimmer-primary text-lg font-semibold">Hello!</p>
511
- </div>
512
- `}renderMessageBlock(r){const e=ga[r.icon];return g.html`
513
- <div class="flex items-center gap-x-2 rounded-sm border border-solid border-neutral-300 p-2">
514
- <div class="text-primary-800 flex size-6 items-center justify-center">
515
- ${P.unsafeSVG(e)}
516
- </div>
517
- <p>${r.text}</p>
476
+ ${E("here",{id:"disclaimer-link"})}</a
477
+ >.
478
+ </span>
518
479
  </div>
519
- `}render(){return g.html`
520
- <div class="relative flex h-full w-full flex-col gap-y-8 overflow-x-hidden overflow-y-auto">
521
- <div class="flex w-full items-center justify-center pt-2 text-center">
522
- <span class="text-xs text-neutral-600">
523
- ${y("Answers are generated by AI and may contain errors, read more",{id:"disclaimer-text"})}
524
- <a
525
- class="font-medium hover:underline"
526
- target="_blank"
527
- href="https://kundeportal.vismasoftware.no/s/article/Vilkår-for-bruk-av-Visma-Software-AI-chat"
528
- >${y("here",{id:"disclaimer-link"})}</a
529
- >.
530
- </span>
531
- </div>
532
- <div class="flex w-full flex-col">
533
- <div class="text-primary-900 flex w-full flex-col gap-y-8 text-sm text-wrap">
534
- ${this.renderWelcomeMessage(this.welcomeMessage)}
535
- </div>
536
- </div>
480
+ `}};Bn.styles=[bh],Bn=vh([f.customElement("gaia-disclaimer")],Bn);const yh=y.css`
481
+ :host{display:block;--textarea-height:32px;--border-width:1px}.message-composer{display:flex;flex-direction:column;gap:4px;margin:0 auto;max-width:var(--gaia-container-2xl);padding:8px 16px;width:100%}.header{align-items:center;display:flex;font-size:var(--gaia-font-size-xs);font-weight:var(--gaia-font-weight-regular);gap:8px;letter-spacing:var(--gaia-letter-spacing-xs);line-height:var(--gaia-line-height-xs);width:100%}.count{display:inline-block;margin-left:auto}.hint{align-items:center;display:flex;gap:4px;overflow:hidden;white-space:nowrap;.hint-icon{display:inline-flex;font-size:var(--gaia-font-size-base)}.hint-text{overflow:hidden;overflow:inherit;text-overflow:ellipsis;white-space:nowrap}}.body{align-items:flex-end;background-color:var(--gaia-color-surface-primary);border:var(--border-width) solid var(--gaia-color-border-primary);border-radius:4px;display:flex;flex:1;gap:8px;padding:8px;&:focus-within{outline:2px solid var(--gaia-color-border-focus)}}.textarea-wrap{align-items:center;color:var(--gaia-color-text-body);cursor:inherit;display:grid;flex:1;font-size:var(--gaia-font-size-base);letter-spacing:var(--gaia-letter-spacing-base);line-height:var(--gaia-line-height-base);margin:0;min-height:var(--textarea-height);outline:none;overflow:hidden;vertical-align:middle}textarea{background:transparent;border:none;box-shadow:none;color:inherit;display:block;font:inherit;height:auto;margin:0;min-height:calc(var(--textarea-height) - var(--border-width)*2);min-width:0;overflow-y:hidden;resize:none;width:100%;&::-moz-placeholder{color:var(--gaia-color-text-disabled);-moz-user-select:none;user-select:none}&::placeholder{color:var(--gaia-color-text-disabled);-webkit-user-select:none;-moz-user-select:none;user-select:none}&:focus{outline:none}}.textarea,
482
+ .autosize{grid-area:1/1/2/2}.autosize{opacity:0;padding:0;pointer-events:none;visibility:hidden}.invalid{.body{background-color:var(--gaia-color-surface-error);border-color:var(--gaia-color-border-error)}.hint-icon{color:var(--gaia-color-icon-error)}}.disabled{.body{background-color:var(--gaia-color-surface-disabled);border-color:var(--gaia-color-border-disabled);color:var(--gaia-color-text-on-disabled)}}
483
+ `;class kh{constructor(e){(this.host=e).addController(this)}hostConnected(){this.resizeObserver=new ResizeObserver(()=>this.setTextareaDimensions()),this.host.updateComplete.then(()=>{this.setTextareaDimensions(),this.resizeObserver.observe(this.host.textarea)})}hostDisconnected(){this.host.textarea&&this.resizeObserver?.unobserve(this.host.textarea)}getTextareaBounds(){const e=getComputedStyle(this.host.textareaWrap),r=getComputedStyle(this.host.textarea),s=h=>parseFloat(h)||0,n=s(r.paddingTop)+s(r.paddingBottom),o=s(r.lineHeight),i=s(e.borderWidth)*2,a=Math.max(1,this.host.rows??1),l=Math.max(a,this.host.maxRows??1);return{minHeight:a*o+n+i,maxHeight:l*o+n+i}}setTextareaDimensions(){this.host.autosize.style.height=`${this.host.textarea.clientHeight}px`,this.host.textarea.style.height="auto";const e=this.host.textarea.scrollHeight,{minHeight:r,maxHeight:s}=this.getTextareaBounds(),n=Math.max(r,Math.min(e,s));this.host.textarea.style.height=`${n}px`,this.host.textarea.style.overflowY=e>s?"auto":"hidden",this.host.textarea.style.minHeight=`${r}px`,this.host.textarea.style.maxHeight=`${s}px`,this.host.textarea.style.height=`${this.host.textarea.scrollHeight}px`,this.host.textareaWrap.style.width="",this.host.textareaWrap.style.height=""}}var xh=Object.defineProperty,_h=Object.getOwnPropertyDescriptor,H=(t,e,r,s)=>{for(var n=s>1?void 0:s?_h(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&xh(e,r,n),n};let z=class extends U{constructor(){super(...arguments),this.resizeController=new kh(this),this.value="",this.invalid=!1,this.maxInputLength=100,this.disabled=!1,this.loading=!1,this.isConnectedToSupport=!1,this.profileId="default",this.rows=1,this.maxRows=5}connectedCallback(){super.connectedCallback(),this.unsubscribe=this.store.subscribe(t=>{this.disabled=!t.session.isActive,this.loading=t.session.isBusy,this.maxInputLength=t.config.maxInputLength,this.isConnectedToSupport=t.session.channel==="support"})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),clearTimeout(this.debounceTimer)}get notAllowedToSendMessage(){return this.disabled||this.invalid||this.loading||this.value.trim().length===0}validateInput(){this.value.length>this.maxInputLength?this.invalid=!0:this.invalid=!1}handleChange(){this.value=this.textarea.value,this.validateInput()}handleInput(){this.value=this.textarea.value,this.maybeEmitTyping()}closeFeedbackIfOpen(){this.store.snapshot.ui.feedbackFormOpen&&this.store.dispatch(jt())}async handleSendMessage(){if(!this.notAllowedToSendMessage){if(this.closeFeedbackIfOpen(),this.isConnectedToSupport)this.supportEffect.sendMessage(this.value),this.dispatchEvent(new Gs(this.value,"support"));else{let t=null;if(this.hostContextProvider)try{const e=await this.hostContextProvider();e===null?t=null:typeof e=="object"&&!Array.isArray(e)?t=e:(console.warn("hostContextProvider returned invalid value. Expected object or null, got:",typeof e),t=null)}catch(e){console.warn("Failed to get app context from provider:",e)}this.streamEffect?.sendMessage(this.value,this.profileId,this.supportPartnerId,t),this.dispatchEvent(new Gs(this.value,"assistant"))}this.value=this.textarea.value=""}}handleKeyDown(t){t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.handleSendMessage())}maybeEmitTyping(){this.disabled||!this.isConnectedToSupport||(clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.supportEffect?.sendTyping()},500))}handleRowsChange(){this.resizeController.setTextareaDimensions()}async handleValueChange(){await this.updateComplete,this.resizeController.setTextareaDimensions(),this.validateInput()}focus(t){this.textarea.focus(t)}blur(){this.textarea.blur()}select(){this.textarea.select()}render(){return y.html`<div
484
+ class=${Gr.classMap({"message-composer":!0,disabled:this.disabled,invalid:this.invalid})}
485
+ >
486
+ <div class="header">
487
+ ${le.when(this.invalid,()=>y.html`
488
+ <div class="hint">
489
+ <gaia-icon name="octagon-alert" label="Info" class="hint-icon"></gaia-icon>
490
+ <span class="hint-text"
491
+ >${E("Character limit exceeded.",{id:"composer-error-character-limit"})}</span
492
+ >
493
+ </div>
494
+ `)}
495
+ <span class="count">${this.value.length}/${this.maxInputLength}</span>
537
496
  </div>
538
- `}};kr([w.property({attribute:!1})],Rt.prototype,"isInitialized",2),kr([w.property({attribute:!1})],Rt.prototype,"welcomeMessage",2),Rt=kr([w.customElement("gaia-chat-welcome-message")],Rt);var fa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ae=(r,e,t,n)=>{for(var s=n>1?void 0:n?ma(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&fa(e,t,s),s};let se=class extends te{constructor(){super(...arguments),this.isInitialized=!1,this.isThinking=!1,this.feedbackFormOpen=!1,this.feedbackFormTarget="assistant",this.error=null,this.isConnectedToSupport=!1,this.messages=[]}get latestMessage(){return this.messages.length===0?null:this.messages[this.messages.length-1]}updated(r){super.updated(r),r.has("messages")&&requestAnimationFrame(()=>this.handleScrollMessages(r.get("messages"))),r.has("feedbackFormOpen")&&this.feedbackFormOpen&&requestAnimationFrame(()=>this.scrollFeedbackFormIntoView())}handleScrollMessages(r){const e=r?.length??0,t=this.messages.length===e;if(!r&&!t)return;const n=this.messages.length>e;if(this.messages.length===0)return this.resetScroll();if(n&&this.latestMessage?.role==="system")return this.latestMessage.isSupportStartedMarker?this.scrollLatestMessageToTop():this.scrollLatestMessageIntoView();if(this.isConnectedToSupport)return this.scrollLatestMessageIntoView();if(n&&this.latestMessage?.role==="user")return this.scrollLatestMessageToTop();if(e===0&&n)return this.scrollLatestMessageIntoView()}resetScroll(){const r=this.$scrollView.parentElement;r&&(r.scrollTop=0,this.$scrollView.style.height=`${r.getBoundingClientRect().height}px`)}scrollLatestMessageToTop(){const r=this.$scrollView.parentElement;if(!r)return;const e=this.renderRoot.querySelectorAll('[role="article"]');if(e.length<1)return;const t=e[e.length-1];this.$scrollView.style.height=`${r.getBoundingClientRect().height+t.offsetTop}px`,t.scrollIntoView({behavior:"smooth",block:"start"})}scrollLatestMessageIntoView(){const r=this.renderRoot.querySelectorAll('[role="article"]');if(r.length<1)return;r[r.length-1].scrollIntoView({behavior:"smooth",block:"start"})}scrollFeedbackFormIntoView(){const r=this.$scrollView.parentElement;r&&r.scrollTo({top:this.$scrollView.scrollHeight,behavior:"smooth"})}render(){return g.html` <div class="relative flex h-full">
539
- <div class="relative flex min-w-0 flex-grow-1 basis-auto flex-col">
540
- <div class="relative h-full overflow-y-auto">
541
- <div
542
- data-testid="message-list"
543
- class="mx-auto flex h-full min-h-full max-w-2xl min-w-0 flex-col @lg/main:px-4"
544
- id="scroll-view"
545
- >
546
- ${this.messages.length===0?g.html`<gaia-chat-welcome-message
547
- class="h-full"
548
- .isInitialized=${this.isInitialized}
549
- .welcomeMessage=${this.welcomeMessage}
550
- ></gaia-chat-welcome-message>`:g.nothing}
551
- ${Jr.repeat(this.messages,r=>r.messageId,r=>{switch(r.role){case"assistant":return g.html`<gaia-chat-assistant-message
552
- .message=${r}
553
- ></gaia-chat-assistant-message>`;case"user":return g.html`<gaia-chat-user-message
554
- .message=${r}
555
- ></gaia-chat-user-message>`;case"operator":return g.html`<gaia-chat-operator-message
556
- .message=${r}
557
- ></gaia-chat-operator-message>`;case"system":return g.html`<gaia-chat-system-message
558
- .message=${r}
559
- ></gaia-chat-system-message>`;default:return g.nothing}})}
560
- ${this.isThinking?g.html`<gaia-chat-thinking-indicator></gaia-chat-thinking-indicator>`:g.nothing}
561
- ${this.feedbackFormOpen?g.html`<gaia-chat-feedback-form
562
- .target=${this.feedbackFormTarget}
563
- ></gaia-chat-feedback-form>`:g.nothing}
564
- </div>
497
+ <div class="body">
498
+ <div class="textarea-wrap">
499
+ <textarea
500
+ class="textarea"
501
+ data-testid="composer-textarea"
502
+ name="message"
503
+ rows=${this.rows}
504
+ .value=${this.value}
505
+ placeholder=${E("Type your question here...",{id:"composer-placeholder"})}
506
+ ?disabled=${this.disabled}
507
+ spellcheck=${!1}
508
+ @change=${this.handleChange}
509
+ @input=${this.handleInput}
510
+ @keydown=${this.handleKeyDown}
511
+ ></textarea>
512
+ <div part="textarea-adjuster" class="autosize"></div>
565
513
  </div>
514
+ <gaia-button
515
+ class="send"
516
+ data-testid="send-message-btn"
517
+ ?disabled=${this.notAllowedToSendMessage}
518
+ ?loading=${this.loading}
519
+ @click=${this.handleSendMessage}
520
+ >
521
+ <gaia-icon name="arrow-up" label="Send Message"></gaia-icon>
522
+ </gaia-button>
566
523
  </div>
567
- ${this.error?g.html`<gaia-chat-error .error=${this.error}></gaia-chat-error>`:g.nothing}
568
- </div>`}};ae([w.query("#scroll-view")],se.prototype,"$scrollView",2),ae([w.property({attribute:!1})],se.prototype,"isInitialized",2),ae([w.property({attribute:!1})],se.prototype,"welcomeMessage",2),ae([w.property({attribute:!1})],se.prototype,"isThinking",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormOpen",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormTarget",2),ae([w.property({attribute:!1})],se.prototype,"error",2),ae([w.property({attribute:!1})],se.prototype,"isConnectedToSupport",2),ae([w.property({attribute:!1})],se.prototype,"messages",2),se=ae([w.customElement("gaia-chat-message-list")],se);class sn extends Error{constructor(e,t){super(e),this.innerError=t,this.name="SignalRError"}}class _r extends Error{constructor(e,t,n){super(t),this.innerError=e,this.errorType=n}}function it(r){if(r instanceof DOMException&&r.name==="AbortError")return{code:"CANCELED",message:y("Request canceled.",{id:"error-request-canceled"}),retryable:!1,source:"ui",cause:r};if(r instanceof qe){const e={code:"UNAUTHORIZED",retryable:!1,source:"auth",cause:r};return r instanceof ns?{...e,message:y("Your access token has expired.",{id:"error-token-expired"})}:r instanceof We?{...e,message:y("Your access token is invalid.",{id:"error-token-invalid"})}:r instanceof Ve?{...e,message:y("You need to provide an access token to continue.",{id:"error-token-required"})}:{...e,message:y("Authentication error. Please authenticate again.",{id:"error-auth-generic"})}}return r instanceof xe?r.isNetworkError?{code:"NETWORK",message:y("Network error. Check your connection.",{id:"error-network-error"}),retryable:!0,source:"http",http:{status:0,url:r.url},cause:r}:r.isUnauthorized?{code:"UNAUTHORIZED",message:y("Your session expired. Please sign in again.",{id:"error-session-expired"}),retryable:!1,source:"http",http:{status:401,url:r.url},cause:r}:r.isForbidden?{code:"FORBIDDEN",message:y("You don't have access to this action.",{id:"error-forbidden"}),retryable:!1,source:"http",http:{status:403,url:r.url},cause:r}:r.isNotFound?{code:"NOT_FOUND",message:y("Not found.",{id:"error-not-found"}),retryable:!1,source:"http",http:{status:404,url:r.url},cause:r}:r.status===429?{code:"RATE_LIMIT",message:y("Too many requests. Please slow down.",{id:"error-rate-limit"}),retryable:!0,source:"http",http:{status:429,url:r.url},cause:r}:r.isServerError?{code:"SERVER",message:y("The server had a problem. Please try again.",{id:"error-server-error"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:{code:"UNKNOWN",message:y("Something went wrong.",{id:"error-something-went-wrong"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:r instanceof _r?r.errorType&&r.errorType==="ProfileNotFoundException"?{code:"NOT_FOUND",message:y("Failed to load the current profile. Are you using the correct profile?",{id:"error-profile-not-found"}),retryable:!1}:{code:"SSE",message:y("Live response stream interrupted. Try again.",{id:"error-sse-error"}),retryable:!0,source:"sse",cause:r}:r instanceof sn?{code:"WS",message:y("Live chat connection error. Reconnecting might help.",{id:"error-ws-error"}),retryable:!0,source:"ws",cause:r}:{code:"UNKNOWN",message:y("Unexpected error. Please try again.",{id:"error-unexpected-error"}),retryable:!0,source:"unknown",cause:r}}const nn={initialized:!1,maxInputLength:2e3,welcomeMessages:{}},wa=()=>({type:"config/setInitialized"}),ba=r=>({type:"config/set",payload:r}),va=()=>({type:"config/clear"});function ya(r=nn,e){switch(e.type){case"config/setInitialized":return{...r,initialized:!0};case"config/set":return{...r,...e.payload,initialized:!0};case"config/clear":return{...r,initialized:!1,welcomeMessages:{}};default:return r}}const on={entities:{},ids:[]},ka=r=>({type:"messages/set",payload:r}),ve=r=>({type:"messages/add",payload:r}),_a=r=>({type:"messages/delete",payload:r}),ue=(r,e)=>({type:"messages/patch",payload:{id:r,patch:e}}),xa=(r,e)=>({type:"messages/add-delta",payload:{id:r,delta:e}});function Sa(r=on,e){switch(e.type){case"messages/set":return{...r,ids:e.payload.map(t=>t.messageId),entities:e.payload.reduce((t,n)=>({...t,[n.messageId]:n}),{})};case"messages/add":{const t=e.payload;return{...r,ids:[...r.ids,t.messageId],entities:{...r.entities,[t.messageId]:t}}}case"messages/delete":{const t={...r.entities};return delete t[e.payload],{...r,ids:r.ids.filter(n=>n!==e.payload),entities:t}}case"messages/patch":{const{id:t,patch:n}=e.payload,s=r.entities[t];return s?{...r,entities:{...r.entities,[t]:{...s,...n}}}:r}case"messages/add-delta":{const{id:t,delta:n}=e.payload,s=r.entities[t];if(!s)return r;const o=("content"in s?s.content:"")+n;return{...r,entities:{...r.entities,[t]:{...s,content:o}}}}default:return r}}const an={conversationId:null,cursorId:null,channel:"assistant",isActive:!0,isThinking:!1,isBusy:!1},Pt=r=>({type:"session/set-conversation-id",payload:r}),at=r=>({type:"session/set-cursor-id",payload:r}),xr=r=>({type:"session/set-channel",payload:r}),Sr=r=>({type:"session/set-thinking",payload:r}),Mt=r=>({type:"session/set-busy",payload:r});function Ea(r=an,e){switch(e.type){case"session/set-conversation-id":return{...r,conversationId:e.payload};case"session/set-cursor-id":return{...r,cursorId:e.payload};case"session/set-channel":return{...r,channel:e.payload};case"session/set-active":return{...r,isActive:e.payload};case"session/set-thinking":return{...r,isThinking:e.payload};case"session/set-busy":return{...r,isBusy:e.payload};default:return r}}const ln={feedbackFormOpen:!1,feedbackFormTarget:"assistant",error:null,errorStack:[]},Ta=r=>({type:"ui/open-feedback-form",payload:{target:r}}),Er=()=>({type:"ui/close-feedback-form"}),ye=r=>({type:"ui/set-error",payload:r}),Ca=r=>({type:"ui/push-error",payload:r});function Ia(r=ln,e){switch(e.type){case"ui/open-feedback-form":return{...r,feedbackFormOpen:!0,feedbackFormTarget:e.payload.target};case"ui/close-feedback-form":return{...r,feedbackFormOpen:!1};case"ui/set-error":return{...r,error:e.payload};case"ui/push-error":{const t=r.errorStack??[];return{...r,errorStack:[...t,e.payload],error:e.payload}}default:return r}}const Tr={config:nn,messages:on,session:an,ui:ln},cn="app/reset",Aa=()=>({type:cn});function $a(r,e){if(e.type===cn)return{...Tr,config:r.config};const t=r??Tr;return{config:ya(t.config,e),messages:Sa(t.messages,e),session:Ea(t.session,e),ui:Ia(t.ui,e)}}class Ra{constructor(e=$a,t=Tr){this.listeners=new Set,this.pending=!1,this.state=t,this.reducer=e}get snapshot(){return this.state}subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}dispatch(e){this.state=this.reducer(this.state,e),this.pending||(this.pending=!0,queueMicrotask(()=>{this.pending=!1;for(const t of this.listeners)t(this.state)}))}}const Pa=(()=>{let r=[],e={},t=[];return n=>(n.messages.ids===r&&n.messages.entities===e||(r=n.messages.ids,e=n.messages.entities,t=r.map(s=>e[s])),t)})();class Ma{constructor(e,t){this.store=e,this.svc=t}async initialize(){try{const e=await this.svc.getBootstrapConfig();this.store.dispatch(ba(e))}catch(e){this.store.dispatch(ye(it(e))),console.error("Failed to load bootstrap configuration:",e)}finally{this.store.dispatch(wa())}}async clear(){this.svc.clearBootstrapConfig(),this.store.dispatch(va())}}class Cr{constructor(){this.key="gaia-chat:conversation-id"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class Da{constructor(e,t){this.store=e,this.svc=t,this.storage=new Cr}async getHistory(){const e=this.storage.load();if(e){this.store.dispatch(Pt(e));try{const t=await this.svc.getConversationHistory(e);this.store.dispatch(ka(t.messages)),this.store.dispatch(xr(t.channel))}catch{this.store.dispatch(Pt(null)),this.storage.clear()}}}clear(){this.storage.clear(),this.store.dispatch(Aa())}}class Oa{constructor(e,t){this.store=e,this.svc=t}async submitFeedback(e,t,n){const s=this.store.snapshot.session.conversationId;if(s){this.store.dispatch(Pt(s));try{await this.svc.submitFeedback({conversationId:s,target:e,score:t,comment:n}),this.store.dispatch(Er())}catch(o){this.store.dispatch(ye(it(o)))}}}}const lt=()=>crypto.randomUUID(),Ir=()=>new Date().toISOString();function hn(r,e){const t=e?.now?.()??Ir();return{messageId:e?.idGen?.()??lt(),turnId:lt(),role:"user",status:e?.status??"completed",content:r,createdAt:t,updatedAt:t}}function La(r){const e=Ir();return{messageId:lt(),turnId:lt(),role:"system",status:"completed",content:"",createdAt:e,updatedAt:e,isSupportCompletedMarker:!0,isSupportStartedMarker:!1,isVisuallyHidden:!1}}function dn(r,e,t){const n=t?.now?.()??Ir();return{messageId:t?.idGen?.()??lt(),role:"operator",status:t?.status??"pending",operator:r,content:e,createdAt:n,updatedAt:n,isTyping:t?.isTyping??!1}}const Na=r=>({"conversation.start":e=>{r.dispatch(Pt(e.data))},"turn.start":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,e.data.message))},"assistant.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"assistant.delta":e=>{const t=r.snapshot.session.cursorId;t&&(r.dispatch(xa(t,e.data)),r.dispatch(Sr(!1)))},"assistant.tool":e=>{const t=r.snapshot.session.cursorId;if(!t)return;const n=r.snapshot.messages.entities[t];n&&r.dispatch(ue(t,{toolCalls:[...n.toolCalls??[],e.data]}))},"assistant.complete":e=>{r.dispatch(ue(e.data.messageId,e.data))},"tool.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"tool.complete":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"tool.failed":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"turn.toolcalls.approved":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"approved"}))},"turn.toolcalls.declined":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"declined"}))},"support.handoff.start":e=>{r.dispatch(ve(e.data.message)),r.dispatch(at(e.data.message.messageId)),r.dispatch(xr("support"))},error:e=>{r.dispatch(ye(it(new _r(null,e.data.message??"Stream error",e.data.errorType))))}});class za{async run(e){return this.abort?.abort(),this.abort=new AbortController,e(this.abort.signal).finally(()=>{this.abort?.signal.aborted===!1&&(this.abort=void 0)})}cancel(){this.abort?.abort()}}class Fa{constructor(e,t){this.store=e,this.svc=t,this.tasks=new za,this.storage=new Cr,this.handlers=Na(this.store),this.storage=new Cr}async sendMessage(e,t,n){const s=crypto.randomUUID();this.store.dispatch(ve(hn(e,{idGen:()=>s}))),this.store.dispatch(at(s));const o=await this.tasks.run(async i=>this.consume(this.svc.sendMessage({message:e,profileId:t,conversationId:this.store.snapshot.session.conversationId,partnerId:n??null},i)));return this.store.snapshot.session.conversationId&&this.storage.save(this.store.snapshot.session.conversationId),o}async approveToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.approveToolCall({conversationId:n,turnId:e,messageId:t},s)))}async declineToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.declineToolCall({conversationId:n,turnId:e,messageId:t},s)))}abortCurrentTask(){this.tasks.cancel()}async consume(e){this.store.dispatch(Mt(!0)),this.store.dispatch(Sr(!0));try{for await(const t of e)this.handlers[t.event]?.(t)}catch(t){console.error("[SSE] stream error",t),this.store.dispatch(Ca(it(t)))}finally{this.store.dispatch(Sr(!1)),this.store.dispatch(Mt(!1))}}requireConversation(){const e=this.store.snapshot.session.conversationId;if(!e)throw new Error("No conversation id");return e}}class Ie extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Ar extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ne extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Ua extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Ba extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class Ha extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class pn extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class ja extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class un{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Dt{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var h;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None"})(h||(h={}));class ct{constructor(){}log(e,t){}}ct.instance=new ct;const qa="9.0.6";class O{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class ${static get isBrowser(){return!$.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!$.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!$.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function ht(r,e){let t="";return Ae(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Wa(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Wa(r){const e=new Uint8Array(r);let t="";return e.forEach(n=>{const s=n<16?"0":"";t+=`0x${s}${n.toString(16)} `}),t.substr(0,t.length-1)}function Ae(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}async function gn(r,e,t,n,s,o){const i={},[a,c]=Le();i[a]=c,r.log(h.Trace,`(${e} transport) sending data. ${ht(s,o.logMessageContent)}.`);const d=Ae(s)?"arraybuffer":"text",u=await t.post(n,{content:s,headers:{...i,...o.headers},responseType:d,timeout:o.timeout,withCredentials:o.withCredentials});r.log(h.Trace,`(${e} transport) request complete. Response status: ${u.statusCode}.`)}function Va(r){return r===void 0?new Ot(h.Information):r===null?ct.instance:r.log!==void 0?r:new Ot(r)}class Ga{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class Ot{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${h[e]}: ${t}`;switch(e){case h.Critical:case h.Error:this.out.error(n);break;case h.Warning:this.out.warn(n);break;case h.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Le(){let r="X-SignalR-User-Agent";return $.isNode&&(r="User-Agent"),[r,Ya(qa,Xa(),Ka(),Za())]}function Ya(r,e,t,n){let s="Microsoft SignalR/";const o=r.split(".");return s+=`${o[0]}.${o[1]}`,s+=` (${r}; `,e&&e!==""?s+=`${e}; `:s+="Unknown OS; ",s+=`${t}`,n?s+=`; ${n}`:s+="; Unknown Runtime Version",s+=")",s}function Xa(){if($.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Za(){if($.isNode)return process.versions.node}function Ka(){return $.isNode?"NodeJS":"Browser"}function $r(r){return r.stack?r.stack:r.message?r.message:`${r}`}function Ja(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Qa extends Dt{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||$.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Ja());if(typeof AbortController>"u"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new ne;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new ne});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{t.abort(),this._logger.log(h.Warning,"Timeout from HTTP request."),n=new Ar},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ae(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(c){throw n||(this._logger.log(h.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await fn(o,"text");throw new Ie(c||o.statusText,o.status)}const a=await fn(o,e.responseType);return new un(o.status,o.statusText,a)}getCookieString(e){let t="";return $.isNode&&this._jar&&this._jar.getCookies(e,(n,s)=>t=s.join("; ")),t}}function fn(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}class el extends Dt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?new Promise((t,n)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(Ae(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{s.setRequestHeader(i,o[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),n(new ne)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?t(new un(s.status,s.statusText,s.response||s.responseText)):n(new Ie(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(h.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),n(new Ie(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(h.Warning,"Timeout from HTTP request."),n(new Ar)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class tl extends Dt{constructor(e){if(super(),typeof fetch<"u"||$.isNode)this._httpClient=new Qa(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new el(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class K{static write(e){return`${e}${K.RecordSeparator}`}static parse(e){if(e[e.length-1]!==K.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(K.RecordSeparator);return t.pop(),t}}K.RecordSeparatorCode=30,K.RecordSeparator=String.fromCharCode(K.RecordSeparatorCode);class rl{writeHandshakeRequest(e){return K.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ae(e)){const a=new Uint8Array(e),c=a.indexOf(K.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const d=c+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,d))),n=a.byteLength>d?a.slice(d).buffer:null}else{const a=e,c=a.indexOf(K.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const d=c+1;t=a.substring(0,d),n=a.length>d?a.substring(d):null}const s=K.parse(t),o=JSON.parse(s[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}var b;(function(r){r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence"})(b||(b={}));class sl{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Ga(this,e)}}class nl{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let s=()=>{},o=()=>{};Ae(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{s=i,o=a})),this._messages.push(new ol(t,this._totalMessageCount,s,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const s=this._messages[n];if(s._id<=e.sequenceId)t=n,Ae(s._message)?this._bufferedByteCount-=s._message.byteLength:this._bufferedByteCount-=s._message.length,s._resolver();else if(this._bufferedByteCount<this._bufferSize)s._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==b.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:b.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case b.Invocation:case b.StreamItem:case b.Completion:case b.StreamInvocation:case b.CancelInvocation:return!0;case b.Close:case b.Sequence:case b.Ping:case b.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:b.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class ol{constructor(e,t,n,s){this._message=e,this._id=t,this._resolver=n,this._rejector=s}}const il=30*1e3,al=15*1e3,ll=1e5;var I;(function(r){r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting"})(I||(I={}));class Rr{static create(e,t,n,s,o,i,a){return new Rr(e,t,n,s,o,i,a)}constructor(e,t,n,s,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(h.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},O.isRequired(e,"connection"),O.isRequired(t,"logger"),O.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??il,this.keepAliveIntervalInMilliseconds=i??al,this._statefulReconnectBufferSize=a??ll,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=s,this._handshakeProtocol=new rl,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=I.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:b.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==I.Disconnected&&this._connectionState!==I.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==I.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=I.Connecting,this._logger.log(h.Debug,"Starting HubConnection.");try{await this._startInternal(),$.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=I.Connected,this._connectionStarted=!0,this._logger.log(h.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=I.Disconnected,this._logger.log(h.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(h.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(h.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new nl(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(h.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===I.Disconnected)return this._logger.log(h.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===I.Disconnecting)return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=I.Disconnecting,this._logger.log(h.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(h.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===I.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new ne("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,s);let i;const a=new sl;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,d)=>{if(d){a.error(d);return}else c&&(c.type===b.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,s));return this._launchStreams(n,o),o}invoke(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,s);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(u,v)=>{if(v){c(v);return}else u&&(u.type===b.Completion?u.error?c(new Error(u.error)):a(u.result):c(new Error(`Unexpected message type: ${u.type}`)))};const d=this._sendWithProtocol(o).catch(u=>{c(u),delete this._callbacks[o.invocationId]});this._launchStreams(n,d)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const s=n.indexOf(t);s!==-1&&(n.splice(s,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case b.Invocation:this._invokeClientMethod(n).catch(s=>{this._logger.log(h.Error,`Invoke client method threw error: ${$r(s)}`)});break;case b.StreamItem:case b.Completion:{const s=this._callbacks[n.invocationId];if(s){n.type===b.Completion&&delete this._callbacks[n.invocationId];try{s(n)}catch(o){this._logger.log(h.Error,`Stream callback threw error: ${$r(o)}`)}}break}case b.Ping:break;case b.Close:{this._logger.log(h.Information,"Close message received from server.");const s=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(s):this._stopPromise=this._stopInternal(s);break}case b.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case b.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(h.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(s){const o="Error parsing handshake response: "+s;this._logger.log(h.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(t.error){const s="Server returned handshake error: "+t.error;this._logger.log(h.Error,s);const o=new Error(s);throw this._handshakeRejecter(o),o}else this._logger.log(h.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===I.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(h.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const s=n.slice(),o=!!e.invocationId;let i,a,c;for(const d of s)try{const u=i;i=await d.apply(this,e.arguments),o&&i&&u&&(this._logger.log(h.Error,`Multiple results provided for '${t}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(u){a=u,this._logger.log(h.Error,`A callback for the method '${t}' threw error '${u}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(h.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(h.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ne("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===I.Disconnecting?this._completeClose(e):this._connectionState===I.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===I.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=I.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),$.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(h.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,s=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,s);if(o===null){this._logger.log(h.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=I.Reconnecting,e?this._logger.log(h.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(h.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(h.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(h.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=I.Connected,this._logger.log(h.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(h.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(h.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===I.Disconnecting&&this._completeClose();return}s=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,s)}}this._logger.log(h.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(s){return this._logger.log(h.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const s=t[n];try{s(null,e)}catch(o){this._logger.log(h.Error,`Stream 'error' callback called with '${e}' threw error: ${$r(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,s){if(n)return s.length!==0?{target:e,arguments:t,streamIds:s,type:b.Invocation}:{target:e,arguments:t,type:b.Invocation};{const o=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:s,type:b.Invocation}:{target:e,arguments:t,invocationId:o.toString(),type:b.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:s=>{let o;s instanceof Error?o=s.message:s&&s.toString?o=s.toString():o="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:s=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,s)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let s=0;s<e.length;s++){const o=e[s];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(s,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:b.StreamInvocation}:{target:e,arguments:t,invocationId:s.toString(),type:b.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:b.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:b.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:b.Completion}:{invocationId:e,result:n,type:b.Completion}}_createCloseMessage(){return{type:b.Close}}}const cl=[0,2e3,1e4,3e4,null];class mn{constructor(e){this._retryDelays=e!==void 0?[...e,null]:cl}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class $e{}$e.Authorization="Authorization",$e.Cookie="Cookie";class hl extends Dt{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[$e.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[$e.Authorization]&&delete e.headers[$e.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var L;(function(r){r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling"})(L||(L={}));var H;(function(r){r[r.Text=1]="Text",r[r.Binary=2]="Binary"})(H||(H={}));let dl=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class wn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new dl,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._url=e,this._logger.log(h.Trace,"(LongPolling transport) Connecting."),t===H.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,s]=Le(),o={[n]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===H.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Ie(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${n}.`);const s=await this._httpClient.get(n,t);s.statusCode===204?(this._logger.log(h.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new Ie(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(h.Trace,`(LongPolling transport) data received. ${ht(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Ar?this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(h.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(h.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?gn(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(h.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(h.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Le();e[t]=n;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,s)}catch(i){o=i}o?o instanceof Ie&&(o.statusCode===404?this._logger.log(h.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(h.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(h.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(h.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(h.Trace,e),this.onclose(this._closeError)}}}class pl{constructor(e,t,n,s){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,t){return O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,s)=>{let o=!1;if(t!==H.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if($.isBrowser||$.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[d,u]=Le();c[d]=u,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(h.Trace,`(SSE transport) data received. ${ht(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{o?this._close():s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(h.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,n()}}catch(a){s(a);return}})}async send(e){return this._eventSource?gn(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class ul{constructor(e,t,n,s,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=s,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((s,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let c=!1;if($.isNode||$.isReactNative){const d={},[u,v]=Le();d[u]=v,n&&(d[$e.Authorization]=`Bearer ${n}`),a&&(d[$e.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...d,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===H.Binary&&(i.binaryType="arraybuffer"),i.onopen=d=>{this._logger.log(h.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=d=>{let u=null;typeof ErrorEvent<"u"&&d instanceof ErrorEvent?u=d.error:u="There was an error with the transport",this._logger.log(h.Information,`(WebSockets transport) ${u}.`)},i.onmessage=d=>{if(this._logger.log(h.Trace,`(WebSockets transport) data received. ${ht(d.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(d.data)}catch(u){this._close(u);return}},i.onclose=d=>{if(c)this._close(d);else{let u=null;typeof ErrorEvent<"u"&&d instanceof ErrorEvent?u=d.error:u="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(u))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(h.Trace,`(WebSockets transport) sending data. ${ht(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(h.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const bn=100;class gl{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,O.isRequired(e,"url"),this._logger=Va(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,s=null;if($.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),s=o("eventsource")}!$.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:$.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!$.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:$.isNode&&!t.EventSource&&typeof s<"u"&&(t.EventSource=s),this._httpClient=new hl(t.httpClient||new tl(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||H.Binary,O.isIn(e,H,"transferFormat"),this._logger.log(h.Debug,`Starting connection with transfer format '${H[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(h.Error,t),await this._stopPromise,Promise.reject(new ne(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(h.Error,t),Promise.reject(new ne(t))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Pr(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(h.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(h.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===L.WebSockets)this.transport=this._constructTransport(L.WebSockets),await this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,s=0;do{if(n=await this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ne("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}s++}while(n.url&&s<bn);if(s===bn&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof wn&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(h.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(h.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(e){const t={},[n,s]=Le();t[n]=s;const o=this._resolveNegotiateUrl(e);this._logger.log(h.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new pn("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof Ie&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(h.Error,a),Promise.reject(new pn(a))}}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,s){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(h.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,s),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const d of a){const u=this._resolveTransportOrError(d,t,s,c?.useStatefulReconnect===!0);if(u instanceof Error)i.push(`${d.transport} failed:`),i.push(u);else if(this._isITransport(u)){if(this.transport=u,!c){try{c=await this._getNegotiationResponse(e)}catch(v){return Promise.reject(v)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,s),this.connectionId=c.connectionId;return}catch(v){if(this._logger.log(h.Error,`Failed to start the transport '${d.transport}': ${v}`),c=void 0,i.push(new Ha(`${d.transport} failed: ${v}`,L[d.transport])),this._connectionState!=="Connecting"){const _="Failed to select transport before stop() was called.";return this._logger.log(h.Debug,_),Promise.reject(new ne(_))}}}}return i.length>0?Promise.reject(new ja(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case L.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new ul(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case L.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new pl(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case L.LongPolling:return new wn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{s=!0}else{this._stopConnection(n);return}s&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,s){const o=L[e.transport];if(o==null)return this._logger.log(h.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(fl(t,o))if(e.transferFormats.map(a=>H[a]).indexOf(n)>=0){if(o===L.WebSockets&&!this._options.WebSocket||o===L.ServerSentEvents&&!this._options.EventSource)return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it is not supported in your environment.'`),new Ua(`'${L[o]}' is not supported in your environment.`,o);this._logger.log(h.Debug,`Selecting transport '${L[o]}'.`);try{return this.features.reconnect=o===L.WebSockets?s:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it does not support the requested transfer format '${H[n]}'.`),new Error(`'${L[o]}' does not support ${H[n]}.`);else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it was disabled by the client.`),new Ba(`'${L[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(h.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(h.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(h.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(h.Error,`Connection disconnected with error '${e}'.`):this._logger.log(h.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(h.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(h.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!$.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(h.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}function fl(r,e){return!r||(e&r)!==0}class Pr{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Lt,this._transportResult=new Lt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Lt),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Lt;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Pr._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}}static _concatBuffers(e){const t=e.map(o=>o.byteLength).reduce((o,i)=>o+i),n=new Uint8Array(t);let s=0;for(const o of e)n.set(new Uint8Array(o),s),s+=o.byteLength;return n.buffer}}class Lt{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const ml="json";class wl{constructor(){this.name=ml,this.version=2,this.transferFormat=H.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=ct.instance);const n=K.parse(e),s=[];for(const o of n){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case b.Invocation:this._isInvocationMessage(i);break;case b.StreamItem:this._isStreamItemMessage(i);break;case b.Completion:this._isCompletionMessage(i);break;case b.Ping:break;case b.Close:break;case b.Ack:this._isAckMessage(i);break;case b.Sequence:this._isSequenceMessage(i);break;default:t.log(h.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return K.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const bl={trace:h.Trace,debug:h.Debug,info:h.Information,information:h.Information,warn:h.Warning,warning:h.Warning,error:h.Error,critical:h.Critical,none:h.None};function vl(r){const e=bl[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}class yl{configureLogging(e){if(O.isRequired(e,"logging"),kl(e))this.logger=e;else if(typeof e=="string"){const t=vl(e);this.logger=new Ot(t)}else this.logger=new Ot(e);return this}withUrl(e,t){return O.isRequired(e,"url"),O.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...t}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return O.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new mn(e):this.reconnectPolicy=e:this.reconnectPolicy=new mn,this}withServerTimeout(e){return O.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return O.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new gl(this.url,e);return Rr.create(t,this.logger||ct.instance,this.protocol||new wl,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function kl(r){return r.log!==void 0}class _l{constructor(e,t){this.store=e,this.accessTokenProvider=t,this.typingTimeoutMs=1e4,this.operatorMsgIdByOp=new Map,this.typingTimeoutByOp=new Map}async start(e,t){this.connection&&await this.stop();const s=`${new URL(e).origin}/ws/support`;this.connection=new yl().withUrl(s,{accessTokenFactory:()=>this.accessTokenProvider.getAccessToken()}).withAutomaticReconnect().configureLogging(h.Information).build(),this.connection.on("Typing",o=>this.onTyping(o)),this.connection.on("Text",o=>this.onText(o)),this.connection.on("Close",o=>this.onClose(o)),this.connection.onclose(o=>{console.error("Support Hub connection closed.",o),o&&this.onError(o),this.onSupportEnded()});try{await this.connection.start(),await this.connection.invoke("JoinConversation",t)}catch(o){console.error("Failed to connect to support hub:",o),this.onError(o)}}async stop(){await this.connection?.stop(),this.connection=void 0;for(const e of this.typingTimeoutByOp.values())clearTimeout(e);this.typingTimeoutByOp.clear(),this.operatorMsgIdByOp.clear()}async sendMessage(e){if(this.connection){this.store.dispatch(ve(hn(e)));try{await this.connection.invoke("SendMessage",e)}catch(t){console.error("Failed to send message via SignalR:",t),this.onError(t)}}}async sendTyping(){if(this.connection)try{await this.connection.invoke("SendTyping")}catch(e){console.error("Failed to send typing message via SignalR:",e),this.onError(e)}}async sendSeenMessage(e,t){if(this.connection)try{await this.connection.invoke("SendSeen",e,t)}catch(n){console.error("Failed to send seen message via SignalR:",n),this.onError(n)}}async close(){if(this.connection)try{await this.connection.invoke("SendClose")}catch(e){console.error("Failed to close support connection via SignalR:",e),this.onError(e)}}onError(e){this.store.dispatch(ye(it(new sn("Support connection error",e))))}clearTyping(e){const t=this.typingTimeoutByOp.get(e);t&&clearTimeout(t),this.typingTimeoutByOp.delete(e)}scheduleTypingRemoval(e){this.clearTyping(e);const t=window.setTimeout(()=>{const n=this.operatorMsgIdByOp.get(e);n&&this.store.dispatch(_a(n)),this.operatorMsgIdByOp.delete(e),this.typingTimeoutByOp.delete(e)},this.typingTimeoutMs);this.typingTimeoutByOp.set(e,t)}async onTyping(e){const t=e.operator;if(t){if(this.operatorMsgIdByOp.has(t.id))this.store.dispatch(ue(this.operatorMsgIdByOp.get(t.id),{isTyping:!0}));else{const n=crypto.randomUUID();this.operatorMsgIdByOp.set(t.id,n),this.store.dispatch(ve(dn(t,"...",{idGen:()=>n,isTyping:!0})))}this.scheduleTypingRemoval(t.id)}}async onText(e){const t=e.operator;if(!t)return;this.clearTyping(t.id);const n=this.operatorMsgIdByOp.get(t.id);n?(this.store.dispatch(ue(n,{content:e.content,isTyping:!1,status:"completed"})),this.operatorMsgIdByOp.delete(t.id)):this.store.dispatch(ve(dn(t,e.content,{status:"completed"})))}async onClose(e){this.stop()}onSupportEnded(){const e=La();this.store.dispatch(ve(e)),this.store.dispatch(at(e.messageId)),this.store.dispatch(xr("assistant"))}}class ge extends CustomEvent{constructor(e,t){super(e,{...t,bubbles:!0})}}class xl extends ge{constructor(){super("conversation-cleared")}}class vn extends ge{constructor(e,t){super("message-sent",{detail:{message:e,channel:t}})}}class Sl extends ge{constructor(e,t){super("tool-call-approved",{detail:{turnId:e,messageId:t}})}}class El extends ge{constructor(e,t){super("tool-call-declined",{detail:{turnId:e,messageId:t}})}}class Tl extends ge{constructor(e,t){super("feedback-submitted",{detail:{rating:e,comment:t}})}}class Cl extends ge{constructor(e,t){super("token-updated",{detail:{expiresAt:e,token:t}})}}class Il extends ge{constructor(e,t){super("token-expiring",{detail:{expiresAt:e,remainingMs:t}})}}class Al extends ge{constructor(e){super("token-expired",{detail:{expiredAt:e}})}}class $l extends ge{constructor(){super("close-requested")}}const Rl={version:"2.1.3"};class Pl{constructor(e,t){this.authProvider=e,this.config=t,this.version=Rl.version}set baseUrl(e){this.config.baseUrl=e}async request(e,t={}){const n=async()=>{let o;try{o=await this.authProvider.getAccessToken()}catch(a){throw a instanceof qe?a:new xe("Network error",0,this.formatUrl(e),a)}const i=new Headers(t.headers||{});this.authProvider.strategyKind==="visitor"?i.set("VSN-Assistant-Visitor",o):i.set("Authorization",`Bearer ${o}`),i.set("App-Version",this.version),i.set("App-Origin",window.location.href||"");try{return await(this.config.fetchImpl??fetch)(this.formatUrl(e),{...t,headers:i})}catch(a){throw new xe("Network error",0,this.formatUrl(e),a)}};let s=await n();if(s.status===401&&(await this.authProvider.clear(),s=await n(),s.status===401))throw new xe("Unauthorized",s.status,s.url);return await ss(s),s}formatUrl(e){const t=String(e);return/^https?:\/\//i.test(t)?t:`${this.config.baseUrl}${t.startsWith("/")?"":"/"}${t}`}}class Ml{constructor(){this.key="gaia-chat:bootstrap-config",this.ttlMs=3600*1e3}load(){const e=localStorage.getItem(this.key);if(!e)return null;try{const t=JSON.parse(e);return Date.now()-t.timestamp>this.ttlMs?(localStorage.removeItem(this.key),null):t.data}catch{return localStorage.removeItem(this.key),null}}save(e){const t={timestamp:Date.now(),data:e};localStorage.setItem(this.key,JSON.stringify(t))}clear(){localStorage.removeItem(this.key)}}class Dl{constructor(e){this.apiClient=e,this.storage=new Ml}async getBootstrapConfig(){const e=this.storage.load();if(e)return e;const t=await this.apiClient.request("/api/v1/bootstrap",{method:"GET"}),n=await Vt(t);return this.storage.save(n),n}clearBootstrapConfig(){this.storage.clear()}}class yn extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function Mr(r){}function Ol(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Mr,onError:t=Mr,onRetry:n=Mr,onComment:s}=r;let o="",i=!0,a,c="",d="";function u(x){const M=i?x.replace(/^\xEF\xBB\xBF/,""):x,[ee,ke]=Ll(`${o}${M}`);for(const oe of ee)v(oe);o=ke,i=!1}function v(x){if(x===""){R();return}if(x.startsWith(":")){s&&s(x.slice(x.startsWith(": ")?2:1));return}const M=x.indexOf(":");if(M!==-1){const ee=x.slice(0,M),ke=x[M+1]===" "?2:1,oe=x.slice(M+ke);_(ee,oe,x);return}_(x,"",x)}function _(x,M,ee){switch(x){case"event":d=M;break;case"data":c=`${c}${M}
569
- `;break;case"id":a=M.includes("\0")?void 0:M;break;case"retry":/^\d+$/.test(M)?n(parseInt(M,10)):t(new yn(`Invalid \`retry\` value: "${M}"`,{type:"invalid-retry",value:M,line:ee}));break;default:t(new yn(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:M,line:ee}));break}}function R(){c.length>0&&e({id:a,event:d||void 0,data:c.endsWith(`
570
- `)?c.slice(0,-1):c}),a=void 0,c="",d=""}function T(x={}){o&&x.consume&&v(o),i=!0,a=void 0,c="",d="",o=""}return{feed:u,reset:T}}function Ll(r){const e=[];let t="",n=0;for(;n<r.length;){const s=r.indexOf("\r",n),o=r.indexOf(`
571
- `,n);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===r.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){t=r.slice(n);break}else{const a=r.slice(n,i);e.push(a),n=i+1,r[n-1]==="\r"&&r[n]===`
572
- `&&n++}}return[e,t]}class Nl extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let s;super({start(o){s=Ol({onEvent:i=>{o.enqueue(i)},onError(i){e==="terminate"?o.error(i):typeof e=="function"&&e(i)},onRetry:t,onComment:n})},transform(o){s.feed(o)}})}}async function*Dr(r,e){const t=zl()?new TextDecoderStream:Fl(),n=r.pipeThrough(t).pipeThrough(new Nl),s=n.getReader();try{for(;!e?.aborted;){const{value:o,done:i}=await s.read();if(i)break;yield o}}catch(o){throw new _r(o)}finally{try{s.releaseLock()}catch{}try{await n.cancel()}catch{}}}function zl(){return typeof TextDecoderStream<"u"}function Fl(){const r=new TextDecoder;return new TransformStream({transform(e,t){t.enqueue(r.decode(e,{stream:!0}))},flush(e){e.enqueue(r.decode())}})}class Ul{constructor(e){this.apiClient=e}async*sendMessage(e,t){const n=await this.apiClient.request("/api/v1/conversations",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:t}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async*approveToolCall(e,t){const n=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:approve-pending`,{method:"POST"}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async*declineToolCall(e,t){const n=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:decline-pending`,{method:"POST"}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async getConversationHistory(e){const t=await this.apiClient.request(`/api/v1/conversations/${encodeURIComponent(e)}/history`,{method:"GET"});return Vt(t)}parseSseEvent(e){try{return{event:e.event,data:JSON.parse(e.data)}}catch{return{event:"error",data:{message:"Malformed server event"}}}}}class Bl{constructor(e){this.apiClient=e}async submitFeedback(e){await this.apiClient.request("/api/v1/feedback",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}}class Hl{constructor(e,t){this.onOffline=()=>{this.store.dispatch(ye({code:"NETWORK",message:y("You're offline. Check your connection.",{id:"error-offline"}),retryable:!1,source:"ui"}))},this.onOnline=()=>{this.store.snapshot.ui.error?.code==="NETWORK"&&this.store.dispatch(ye(null))},e.addController(this),this.store=t}hostConnected(){window.addEventListener("offline",this.onOffline),window.addEventListener("online",this.onOnline)}hostDisconnected(){window.removeEventListener("offline",this.onOffline),window.removeEventListener("online",this.onOnline)}}const jl=(r,e,t)=>{const n=r[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},kn="en",ql=["da","nb","sv"],Wl=["da","en","nb","sv"],{getLocale:Vl,setLocale:_n}=vo({sourceLocale:kn,targetLocales:ql,loadLocale:r=>jl(Object.assign({"../generated/locales/da.ts":()=>Promise.resolve().then(()=>Jl),"../generated/locales/nb.ts":()=>Promise.resolve().then(()=>ec),"../generated/locales/sv.ts":()=>Promise.resolve().then(()=>rc)}),`../generated/locales/${r}.ts`,4)});function xn(r){const[e]=r.split("-"),t=e.toLowerCase();return Gl(t)}function Gl(r){switch(r){case"no":case"nn":return"nb";default:return Yl(r)?r:kn}}function Yl(r){return Wl.includes(r)}var Xl=Object.defineProperty,Zl=Object.getOwnPropertyDescriptor,Q=(r,e,t,n)=>{for(var s=n>1?void 0:n?Zl(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Xl(e,t,s),s};C.ChatApp=class extends te{constructor(){super(...arguments),this.baseUrl="https://api.assistant.stag.vsn.dev",this.profileId="default",this.isVisitor=!1,this.tokenExpiringLeadSeconds=10,this.closeable=!0,this.state=null,this.messages=[],this.isConnectedToSupport=!1,this.store=new Ra}connectedCallback(){super.connectedCallback(),_n(xn(this.lang||this.ownerDocument.documentElement.lang||"en")),this.langObserver=new MutationObserver(s=>{for(const o of s)if(o.type==="attributes"&&o.attributeName==="lang"){const i=this.lang||this.ownerDocument.documentElement.lang||"en";_n(xn(i)),this.requestUpdate()}}),this.langObserver.observe(this,{attributes:!0,attributeFilter:["lang"]}),new Hl(this,this.store),this.checkPlatform(),this.accessTokenProvider=new Qn({onUpdated:(s,o)=>{this.dispatchEvent(new Cl(s,o))},onExpiring:(s,o)=>{this.dispatchEvent(new Il(s,o))},onExpired:s=>{this.dispatchEvent(new Al(s))}}),this.accessTokenProvider.setExpiringLeadMs(this.tokenExpiringLeadSeconds*1e3);const{kind:e,strategy:t}=Gt(this.baseUrl,this.vismaAccessToken);this.accessTokenProvider.setStrategy(e,t),this.apiClient=new Pl(this.accessTokenProvider,{baseUrl:this.baseUrl,fetchImpl:fetch});const n=new Ul(this.apiClient);this.bootstrapEffect=new Ma(this.store,new Dl(this.apiClient)),this.streamEffect=new Fa(this.store,n),this.supportEffect=new _l(this.store,this.accessTokenProvider),this.conversationEffect=new Da(this.store,n),this.feedbackEffect=new Oa(this.store,new Bl(this.apiClient)),this.unsubscribe=this.store.subscribe(s=>{const o=this.state;this.state=s,this.messages=Pa(s),this.isConnectedToSupport=s.session.channel==="support",this.welcomeMessages=s.config.welcomeMessages,this.isConnectedToSupport&&o?.session.channel!=="support"&&this.supportEffect?.start(this.baseUrl,this.store.snapshot.session.conversationId)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.supportEffect?.stop(),this.langObserver?.disconnect()}async onPrincipalChanged(e,t,n,s){if(!(e===t&&n===s)){this.store.dispatch(ye(null)),this.store.dispatch(Mt(!0));try{const o=await this.accessTokenProvider.getIdentifier(),{kind:i,strategy:a}=Gt(this.baseUrl,t);this.accessTokenProvider.setStrategy(i,a);const c=await this.accessTokenProvider.getIdentifier();(!e&&!!t||!n&&!!s||c!==o)&&(this.bootstrapEffect.clear(),this.streamEffect.abortCurrentTask?.(),this.supportEffect.close(),this.supportEffect.stop()),this.bootstrapEffect.initialize(),this.conversationEffect.getHistory()}finally{this.store.dispatch(Mt(!1))}}}updated(e){if(super.updated(e),e.has("vismaAccessToken")||e.has("isVisitor")){if(!this.vismaAccessToken&&!this.isVisitor)throw new Error("Visma token is required when not in visitor mode");if(this.vismaAccessToken&&this.isVisitor)throw new Error("Visma token is not allowed in visitor mode");requestAnimationFrame(()=>{this.onPrincipalChanged(e.get("vismaAccessToken"),this.vismaAccessToken,e.get("isVisitor"),this.isVisitor)})}if(e.has("tokenExpiringLeadSeconds")){const t=this.tokenExpiringLeadSeconds;this.accessTokenProvider?.setExpiringLeadMs(t*1e3)}if(e.has("baseUrl")){this.apiClient.baseUrl=this.baseUrl;const{kind:t,strategy:n}=Gt(this.baseUrl,this.vismaAccessToken);this.accessTokenProvider.setStrategy(t,n)}}checkPlatform(){const e=window.navigator.userAgent;let t="unknown";e.indexOf("Win")!==-1?t="windows":e.indexOf("Mac")!==-1?t="macos":t="unknown",this.setAttribute("data-platform",t)}async onSendMessage(e){e.stopPropagation();const t=e.detail.message;!t||!this.streamEffect||(this.closeFeedbackIfOpen(),this.isConnectedToSupport?(this.supportEffect.sendMessage(t),this.dispatchEvent(new vn(t,"support"))):(this.streamEffect?.sendMessage(t,this.profileId,this.supportPartnerId),this.dispatchEvent(new vn(t,"assistant"))))}onApproveToolCall(e){e.stopPropagation(),this.closeFeedbackIfOpen(),this.streamEffect?.approveToolCall(e.detail.turnId,e.detail.messageId),this.dispatchEvent(new Sl(e.detail.turnId,e.detail.messageId))}onDeclineToolCall(e){e.stopPropagation(),this.closeFeedbackIfOpen(),this.streamEffect?.declineToolCall(e.detail.turnId,e.detail.messageId),this.dispatchEvent(new El(e.detail.turnId,e.detail.messageId))}onSubmitFeedback(e){e.stopPropagation(),this.feedbackEffect?.submitFeedback(e.detail.target,e.detail.rating,e.detail.comment),this.dispatchEvent(new Tl(e.detail.rating,e.detail.comment))}onToggleFeedbackForm(e){e.stopPropagation(),e.detail.target?this.store.dispatch(Ta(e.detail.target)):this.store.dispatch(Er())}onClearConversation(e){e.stopPropagation(),this.conversationEffect?.clear(),this.supportEffect?.stop(),this.dispatchEvent(new xl)}onClearError(){this.store.dispatch(ye(null))}closeFeedbackIfOpen(){this.state?.ui.feedbackFormOpen&&this.store.dispatch(Er())}onSendTyping(e){e.stopPropagation(),this.isConnectedToSupport&&this.supportEffect?.sendTyping()}onMarkSeen(e){if(e.stopPropagation(),this.isConnectedToSupport){const{messageId:t,seenAt:n}=e.detail;this.supportEffect?.sendSeenMessage(t,n)}}onCloseChat(e){e.stopPropagation(),this.dispatchEvent(new $l)}render(){return g.html`
524
+ <gaia-disclaimer></gaia-disclaimer>
525
+ </div>`}};z.styles=[yh],H([ce({context:kt})],z.prototype,"store",2),H([ce({context:dn})],z.prototype,"streamEffect",2),H([ce({context:xr})],z.prototype,"supportEffect",2),H([f.query(".textarea-wrap")],z.prototype,"textareaWrap",2),H([f.query(".textarea")],z.prototype,"textarea",2),H([f.query(".autosize")],z.prototype,"autosize",2),H([f.state()],z.prototype,"value",2),H([f.state()],z.prototype,"invalid",2),H([f.state()],z.prototype,"maxInputLength",2),H([f.state()],z.prototype,"disabled",2),H([f.state()],z.prototype,"loading",2),H([f.state()],z.prototype,"isConnectedToSupport",2),H([f.property({type:String,attribute:"profile-id"})],z.prototype,"profileId",2),H([f.property({type:String,attribute:"partner-id"})],z.prototype,"supportPartnerId",2),H([f.property({attribute:!1})],z.prototype,"hostContextProvider",2),H([f.property({type:Number,attribute:"rows"})],z.prototype,"rows",2),H([f.property({type:Number,attribute:"max-rows"})],z.prototype,"maxRows",2),H([pr("rows",{waitUntilFirstUpdate:!0})],z.prototype,"handleRowsChange",1),H([pr("value",{waitUntilFirstUpdate:!0})],z.prototype,"handleValueChange",1),z=H([f.customElement("gaia-message-composer")],z);async function Sh(t){let e,r;try{e=await t.clone().text()}catch{e=void 0}try{const n=t.headers.get("content-type")||"";(n.includes("application/problem+json")||n.includes("application/json"))&&(r=JSON.parse(e||"{}"))}catch{r=void 0}const s=r?.detail||r?.title||e&&e.slice(0,200)||`HTTP ${t.status} ${t.statusText}`;return new xt(s,t.status,t.url,void 0,e,r)}async function Fo(t){if(!t.ok)throw await Sh(t)}function Un(t){if(!t.body)throw new xt("No response body",t.status,t.url);return t.body}async function Bo(t){try{return await t.json()}catch(e){throw new xt("Failed to parse response body as JSON",t.status,t.url,e)}}class Th{constructor(){this.key="gaia-chat:bootstrap-config",this.ttlMs=3600*1e3}load(){const e=localStorage.getItem(this.key);if(!e)return null;try{const r=JSON.parse(e);return Date.now()-r.timestamp>this.ttlMs?(localStorage.removeItem(this.key),null):r.data}catch{return localStorage.removeItem(this.key),null}}save(e){const r={timestamp:Date.now(),data:e};localStorage.setItem(this.key,JSON.stringify(r))}clear(){localStorage.removeItem(this.key)}}class Eh{constructor(e){this.apiClient=e,this.storage=new Th}async getBootstrapConfig(){const e=this.storage.load();if(e)return e;const r=await this.apiClient.request("/api/v1/bootstrap",{method:"GET"}),s=await Bo(r);return this.storage.save(s),s}clearBootstrapConfig(){this.storage.clear()}}class Ch{constructor(e,r){this.store=e,this.svc=r}async initialize(){try{const e=await this.svc.getBootstrapConfig();this.store.dispatch(dl(e))}catch(e){this.store.dispatch(Ze(Wt(e))),console.error("Failed to load bootstrap configuration:",e)}finally{this.store.dispatch(hl())}}async clear(){this.svc.clearBootstrapConfig(),this.store.dispatch(ul())}}class Hn{constructor(){this.key="gaia-chat:conversation-id"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class Uo extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Wn(t){}function Ah(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Wn,onError:r=Wn,onRetry:s=Wn,onComment:n}=t;let o="",i=!0,a,l="",h="";function d(v){const _=i?v.replace(/^\xEF\xBB\xBF/,""):v,[S,A]=Ih(`${o}${_}`);for(const I of S)p(I);o=A,i=!1}function p(v){if(v===""){m();return}if(v.startsWith(":")){n&&n(v.slice(v.startsWith(": ")?2:1));return}const _=v.indexOf(":");if(_!==-1){const S=v.slice(0,_),A=v[_+1]===" "?2:1,I=v.slice(_+A);b(S,I,v);return}b(v,"",v)}function b(v,_,S){switch(v){case"event":h=_;break;case"data":l=`${l}${_}
526
+ `;break;case"id":a=_.includes("\0")?void 0:_;break;case"retry":/^\d+$/.test(_)?s(parseInt(_,10)):r(new Uo(`Invalid \`retry\` value: "${_}"`,{type:"invalid-retry",value:_,line:S}));break;default:r(new Uo(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:_,line:S}));break}}function m(){l.length>0&&e({id:a,event:h||void 0,data:l.endsWith(`
527
+ `)?l.slice(0,-1):l}),a=void 0,l="",h=""}function w(v={}){o&&v.consume&&p(o),i=!0,a=void 0,l="",h="",o=""}return{feed:d,reset:w}}function Ih(t){const e=[];let r="",s=0;for(;s<t.length;){const n=t.indexOf("\r",s),o=t.indexOf(`
528
+ `,s);let i=-1;if(n!==-1&&o!==-1?i=Math.min(n,o):n!==-1?n===t.length-1?i=-1:i=n:o!==-1&&(i=o),i===-1){r=t.slice(s);break}else{const a=t.slice(s,i);e.push(a),s=i+1,t[s-1]==="\r"&&t[s]===`
529
+ `&&s++}}return[e,r]}class Rh extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let n;super({start(o){n=Ah({onEvent:i=>{o.enqueue(i)},onError(i){e==="terminate"?o.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:s})},transform(o){n.feed(o)}})}}async function*jn(t,e){const r=Ph()?new TextDecoderStream:$h(),s=t.pipeThrough(r).pipeThrough(new Rh),n=s.getReader();try{for(;!e?.aborted;){const{value:o,done:i}=await n.read();if(i)break;yield o}}catch(o){throw new fn(o)}finally{try{n.releaseLock()}catch{}try{await s.cancel()}catch{}}}function Ph(){return typeof TextDecoderStream<"u"}function $h(){const t=new TextDecoder;return new TransformStream({transform(e,r){r.enqueue(t.decode(e,{stream:!0}))},flush(e){e.enqueue(t.decode())}})}class Oh{constructor(e){this.apiClient=e}async*sendMessage(e,r){let s=e.hostContext;e.partnerId&&!e.hostContext?.partnerId&&(s={...e.hostContext??{},partnerId:e.partnerId});const n=await this.apiClient.request("/api/v1/conversations",{method:"POST",body:JSON.stringify({...e,hostContext:s}),headers:{"Content-Type":"application/json"},signal:r}),o=Un(n);for await(const i of jn(o,r))yield this.parseSseEvent(i)}async*approveToolCall(e,r){const s=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:approve-pending`,{method:"POST"}),n=Un(s);for await(const o of jn(n,r))yield this.parseSseEvent(o)}async*declineToolCall(e,r){const s=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:decline-pending`,{method:"POST"}),n=Un(s);for await(const o of jn(n,r))yield this.parseSseEvent(o)}async getConversationHistory(e){const r=await this.apiClient.request(`/api/v1/conversations/${encodeURIComponent(e)}/history`,{method:"GET"});return Bo(r)}parseSseEvent(e){try{return{event:e.event,data:JSON.parse(e.data)}}catch{return{event:"error",data:{message:"Malformed server event"}}}}}class Dh{constructor(e,r){this.store=e,this.svc=r,this.storage=new Hn}async getHistory(){const e=this.storage.load();if(e){this.store.dispatch(Ut(e));try{const r=await this.svc.getConversationHistory(e);this.store.dispatch(gl(r.messages)),this.store.dispatch(pn(r.channel))}catch{this.store.dispatch(Ut(null)),this.storage.clear()}}}clear(){this.storage.clear(),this.store.dispatch(kl())}}class Mh{constructor(e){this.apiClient=e}async submitFeedback(e){await this.apiClient.request("/api/v1/feedback",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}}class Lh{constructor(e,r){this.store=e,this.svc=r}async submitFeedback(e,r,s){const n=this.store.snapshot.session.conversationId;if(n){this.store.dispatch(Ut(n));try{await this.svc.submitFeedback({conversationId:n,target:e,score:r,comment:s}),this.store.dispatch(jt())}catch(o){this.store.dispatch(Ze(Wt(o)))}}}}const nr=()=>crypto.randomUUID(),qn=()=>new Date().toISOString();function Ho(t,e){const r=e?.now?.()??qn();return{messageId:e?.idGen?.()??nr(),turnId:nr(),role:"user",status:e?.status??"completed",content:t,createdAt:r,updatedAt:r}}function Nh(t){const e=qn();return{messageId:nr(),turnId:nr(),role:"system",status:"completed",content:"",createdAt:e,updatedAt:e,isSupportCompletedMarker:!0,isSupportStartedMarker:!1,isVisuallyHidden:!1}}function Wo(t,e,r){const s=r?.now?.()??qn();return{messageId:r?.idGen?.()??nr(),role:"operator",status:r?.status??"pending",operator:t,content:e,createdAt:s,updatedAt:s,isTyping:r?.isTyping??!1}}const zh=t=>({"conversation.start":e=>{t.dispatch(Ut(e.data))},"turn.start":e=>{const r=t.snapshot.session.cursorId;r&&t.dispatch(Ne(r,e.data.message))},"assistant.start":e=>{t.dispatch(Ye(e.data)),t.dispatch(Ht(e.data.messageId))},"assistant.delta":e=>{const r=t.snapshot.session.cursorId;r&&(t.dispatch(ml(r,e.data)),t.dispatch(gn(!1)))},"assistant.tool":e=>{const r=t.snapshot.session.cursorId;if(!r)return;const s=t.snapshot.messages.entities[r];s&&t.dispatch(Ne(r,{toolCalls:[...s.toolCalls??[],e.data]}))},"assistant.complete":e=>{t.dispatch(Ne(e.data.messageId,e.data))},"tool.start":e=>{t.dispatch(Ye(e.data)),t.dispatch(Ht(e.data.messageId))},"tool.complete":e=>{const r=t.snapshot.session.cursorId;r&&t.dispatch(Ne(r,{toolCallResult:e.data}))},"tool.failed":e=>{const r=t.snapshot.session.cursorId;r&&t.dispatch(Ne(r,{toolCallResult:e.data}))},"turn.toolcalls.approved":e=>{t.dispatch(Ne(e.data.messageId,{approvalStatus:"approved"}))},"turn.toolcalls.declined":e=>{t.dispatch(Ne(e.data.messageId,{approvalStatus:"declined"}))},"support.handoff.start":e=>{t.dispatch(Ut(e.data.conversationId)),t.dispatch(Ye(e.data.message)),t.dispatch(Ht(e.data.message.messageId)),t.dispatch(pn("support"))},error:e=>{t.dispatch(Ze(Wt(new fn(null,e.data.message??"Stream error",e.data.errorType))))}});class Fh{async run(e){return this.abort?.abort(),this.abort=new AbortController,e(this.abort.signal).finally(()=>{this.abort?.signal.aborted===!1&&(this.abort=void 0)})}cancel(){this.abort?.abort()}}class Bh{constructor(e,r){this.store=e,this.svc=r,this.tasks=new Fh,this.storage=new Hn,this.handlers=zh(this.store),this.storage=new Hn}async sendMessage(e,r,s,n){const o=crypto.randomUUID();this.store.dispatch(Ye(Ho(e,{idGen:()=>o}))),this.store.dispatch(Ht(o));const i=await this.tasks.run(async a=>this.consume(this.svc.sendMessage({message:e,profileId:r,conversationId:this.store.snapshot.session.conversationId,partnerId:s??null,hostContext:n??null},a)));return this.store.snapshot.session.conversationId&&this.storage.save(this.store.snapshot.session.conversationId),i}async approveToolCall(e,r){const s=this.requireConversation();return this.tasks.run(async n=>this.consume(this.svc.approveToolCall({conversationId:s,turnId:e,messageId:r},n)))}async declineToolCall(e,r){const s=this.requireConversation();return this.tasks.run(async n=>this.consume(this.svc.declineToolCall({conversationId:s,turnId:e,messageId:r},n)))}abortCurrentTask(){this.tasks.cancel()}async consume(e){this.store.dispatch(_r(!0)),this.store.dispatch(gn(!0));try{for await(const r of e)this.handlers[r.event]?.(r)}catch(r){console.error("[SSE] stream error",r),this.store.dispatch(vl(Wt(r)))}finally{this.store.dispatch(gn(!1)),this.store.dispatch(_r(!1))}}requireConversation(){const e=this.store.snapshot.session.conversationId;if(!e)throw new Error("No conversation id");return e}}class at extends Error{constructor(e,r){const s=new.target.prototype;super(`${e}: Status code '${r}'`),this.statusCode=r,this.__proto__=s}}class Vn extends Error{constructor(e="A timeout occurred."){const r=new.target.prototype;super(e),this.__proto__=r}}class Se extends Error{constructor(e="An abort occurred."){const r=new.target.prototype;super(e),this.__proto__=r}}class Uh extends Error{constructor(e,r){const s=new.target.prototype;super(e),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=s}}class Hh extends Error{constructor(e,r){const s=new.target.prototype;super(e),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=s}}class Wh extends Error{constructor(e,r){const s=new.target.prototype;super(e),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=s}}class jo extends Error{constructor(e){const r=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}}class jh extends Error{constructor(e,r){const s=new.target.prototype;super(e),this.innerErrors=r,this.__proto__=s}}class qo{constructor(e,r,s){this.statusCode=e,this.statusText=r,this.content=s}}class Lr{get(e,r){return this.send({...r,method:"GET",url:e})}post(e,r){return this.send({...r,method:"POST",url:e})}delete(e,r){return this.send({...r,method:"DELETE",url:e})}getCookieString(e){return""}}var u;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"})(u||(u={}));class sr{constructor(){}log(e,r){}}sr.instance=new sr;const qh="9.0.6";class W{static isRequired(e,r){if(e==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(e,r){if(!e||e.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(e,r,s){if(!(e in r))throw new Error(`Unknown ${s} value: ${e}.`)}}class N{static get isBrowser(){return!N.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!N.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!N.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function or(t,e){let r="";return lt(t)?(r=`Binary data of length ${t.byteLength}`,e&&(r+=`. Content: '${Vh(t)}'`)):typeof t=="string"&&(r=`String data of length ${t.length}`,e&&(r+=`. Content: '${t}'`)),r}function Vh(t){const e=new Uint8Array(t);let r="";return e.forEach(s=>{const n=s<16?"0":"";r+=`0x${n}${s.toString(16)} `}),r.substr(0,r.length-1)}function lt(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}async function Vo(t,e,r,s,n,o){const i={},[a,l]=Et();i[a]=l,t.log(u.Trace,`(${e} transport) sending data. ${or(n,o.logMessageContent)}.`);const h=lt(n)?"arraybuffer":"text",d=await r.post(s,{content:n,headers:{...i,...o.headers},responseType:h,timeout:o.timeout,withCredentials:o.withCredentials});t.log(u.Trace,`(${e} transport) request complete. Response status: ${d.statusCode}.`)}function Gh(t){return t===void 0?new Nr(u.Information):t===null?sr.instance:t.log!==void 0?t:new Nr(t)}class Kh{constructor(e,r){this._subject=e,this._observer=r}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}}class Nr{constructor(e){this._minLevel=e,this.out=console}log(e,r){if(e>=this._minLevel){const s=`[${new Date().toISOString()}] ${u[e]}: ${r}`;switch(e){case u.Critical:case u.Error:this.out.error(s);break;case u.Warning:this.out.warn(s);break;case u.Information:this.out.info(s);break;default:this.out.log(s);break}}}}function Et(){let t="X-SignalR-User-Agent";return N.isNode&&(t="User-Agent"),[t,Yh(qh,Zh(),Jh(),Xh())]}function Yh(t,e,r,s){let n="Microsoft SignalR/";const o=t.split(".");return n+=`${o[0]}.${o[1]}`,n+=` (${t}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${r}`,s?n+=`; ${s}`:n+="; Unknown Runtime Version",n+=")",n}function Zh(){if(N.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Xh(){if(N.isNode)return process.versions.node}function Jh(){return N.isNode?"NodeJS":"Browser"}function Gn(t){return t.stack?t.stack:t.message?t.message:`${t}`}function Qh(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class ed extends Lr{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||N.isNode){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Qh());if(typeof AbortController>"u"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new Se;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const r=new this._abortControllerType;let s;e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),s=new Se});let n=null;if(e.timeout){const l=e.timeout;n=setTimeout(()=>{r.abort(),this._logger.log(u.Warning,"Timeout from HTTP request."),s=new Vn},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},lt(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(l){throw s||(this._logger.log(u.Warning,`Error from HTTP request. ${l}.`),l)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const l=await Go(o,"text");throw new at(l||o.statusText,o.status)}const a=await Go(o,e.responseType);return new qo(o.status,o.statusText,a)}getCookieString(e){let r="";return N.isNode&&this._jar&&this._jar.getCookies(e,(s,n)=>r=n.join("; ")),r}}function Go(t,e){let r;switch(e){case"arraybuffer":r=t.arrayBuffer();break;case"text":r=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:r=t.text();break}return r}class td extends Lr{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Se):e.method?e.url?new Promise((r,s)=>{const n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(lt(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{n.setRequestHeader(i,o[i])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),s(new Se)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?r(new qo(n.status,n.statusText,n.response||n.responseText)):s(new at(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(u.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),s(new at(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(u.Warning,"Timeout from HTTP request."),s(new Vn)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class rd extends Lr{constructor(e){if(super(),typeof fetch<"u"||N.isNode)this._httpClient=new ed(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new td(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Se):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class pe{static write(e){return`${e}${pe.RecordSeparator}`}static parse(e){if(e[e.length-1]!==pe.RecordSeparator)throw new Error("Message is incomplete.");const r=e.split(pe.RecordSeparator);return r.pop(),r}}pe.RecordSeparatorCode=30,pe.RecordSeparator=String.fromCharCode(pe.RecordSeparatorCode);class nd{writeHandshakeRequest(e){return pe.write(JSON.stringify(e))}parseHandshakeResponse(e){let r,s;if(lt(e)){const a=new Uint8Array(e),l=a.indexOf(pe.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");const h=l+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,h))),s=a.byteLength>h?a.slice(h).buffer:null}else{const a=e,l=a.indexOf(pe.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");const h=l+1;r=a.substring(0,h),s=a.length>h?a.substring(h):null}const n=pe.parse(r),o=JSON.parse(n[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[s,o]}}var T;(function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"})(T||(T={}));class sd{constructor(){this.observers=[]}next(e){for(const r of this.observers)r.next(e)}error(e){for(const r of this.observers)r.error&&r.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Kh(this,e)}}class od{constructor(e,r,s){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=r,this._bufferSize=s}async _send(e){const r=this._protocol.writeMessage(e);let s=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let n=()=>{},o=()=>{};lt(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(s=new Promise((i,a)=>{n=i,o=a})),this._messages.push(new id(r,this._totalMessageCount,n,o))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await s}_ack(e){let r=-1;for(let s=0;s<this._messages.length;s++){const n=this._messages[s];if(n._id<=e.sequenceId)r=s,lt(n._message)?this._bufferedByteCount-=n._message.byteLength:this._bufferedByteCount-=n._message.length,n._resolver();else if(this._bufferedByteCount<this._bufferSize)n._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==T.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:T.Sequence,sequenceId:e}));const r=this._messages;for(const s of r)await this._connection.send(s._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const r of this._messages)r._rejector(e)}_isInvocationMessage(e){switch(e.type){case T.Invocation:case T.StreamItem:case T.Completion:case T.StreamInvocation:case T.CancelInvocation:return!0;case T.Close:case T.Sequence:case T.Ping:case T.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:T.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class id{constructor(e,r,s,n){this._message=e,this._id=r,this._resolver=s,this._rejector=n}}const ad=30*1e3,ld=15*1e3,cd=1e5;var M;(function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"})(M||(M={}));class Kn{static create(e,r,s,n,o,i,a){return new Kn(e,r,s,n,o,i,a)}constructor(e,r,s,n,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(u.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},W.isRequired(e,"connection"),W.isRequired(r,"logger"),W.isRequired(s,"protocol"),this.serverTimeoutInMilliseconds=o??ad,this.keepAliveIntervalInMilliseconds=i??ld,this._statefulReconnectBufferSize=a??cd,this._logger=r,this._protocol=s,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new nd,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=M.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:T.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==M.Disconnected&&this._connectionState!==M.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==M.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=M.Connecting,this._logger.log(u.Debug,"Starting HubConnection.");try{await this._startInternal(),N.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=M.Connected,this._connectionStarted=!0,this._logger.log(u.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=M.Disconnected,this._logger.log(u.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((r,s)=>{this._handshakeResolver=r,this._handshakeRejecter=s});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);const s={protocol:this._protocol.name,version:r};if(this._logger.log(u.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(s)),this._logger.log(u.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new od(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(u.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===M.Disconnected)return this._logger.log(u.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===M.Disconnecting)return this._logger.log(u.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const r=this._connectionState;return this._connectionState=M.Disconnecting,this._logger.log(u.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(u.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===M.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Se("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...r){const[s,n]=this._replaceStreamingParams(r),o=this._createStreamInvocation(e,r,n);let i;const a=new sd;return a.cancelCallback=()=>{const l=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(l))},this._callbacks[o.invocationId]=(l,h)=>{if(h){a.error(h);return}else l&&(l.type===T.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},i=this._sendWithProtocol(o).catch(l=>{a.error(l),delete this._callbacks[o.invocationId]}),this._launchStreams(s,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...r){const[s,n]=this._replaceStreamingParams(r),o=this._sendWithProtocol(this._createInvocation(e,r,!0,n));return this._launchStreams(s,o),o}invoke(e,...r){const[s,n]=this._replaceStreamingParams(r),o=this._createInvocation(e,r,!1,n);return new Promise((a,l)=>{this._callbacks[o.invocationId]=(d,p)=>{if(p){l(p);return}else d&&(d.type===T.Completion?d.error?l(new Error(d.error)):a(d.result):l(new Error(`Unexpected message type: ${d.type}`)))};const h=this._sendWithProtocol(o).catch(d=>{l(d),delete this._callbacks[o.invocationId]});this._launchStreams(s,h)})}on(e,r){!e||!r||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(r)===-1&&this._methods[e].push(r))}off(e,r){if(!e)return;e=e.toLowerCase();const s=this._methods[e];if(s)if(r){const n=s.indexOf(r);n!==-1&&(s.splice(n,1),s.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const r=this._protocol.parseMessages(e,this._logger);for(const s of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(s)))switch(s.type){case T.Invocation:this._invokeClientMethod(s).catch(n=>{this._logger.log(u.Error,`Invoke client method threw error: ${Gn(n)}`)});break;case T.StreamItem:case T.Completion:{const n=this._callbacks[s.invocationId];if(n){s.type===T.Completion&&delete this._callbacks[s.invocationId];try{n(s)}catch(o){this._logger.log(u.Error,`Stream callback threw error: ${Gn(o)}`)}}break}case T.Ping:break;case T.Close:{this._logger.log(u.Information,"Close message received from server.");const n=s.error?new Error("Server returned an error on close: "+s.error):void 0;s.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}case T.Ack:this._messageBuffer&&this._messageBuffer._ack(s);break;case T.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(s);break;default:this._logger.log(u.Warning,`Invalid message type: ${s.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let r,s;try{[s,r]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){const o="Error parsing handshake response: "+n;this._logger.log(u.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(r.error){const n="Server returned handshake error: "+r.error;this._logger.log(u.Error,n);const o=new Error(n);throw this._handshakeRejecter(o),o}else this._logger.log(u.Debug,"Server handshake complete.");return this._handshakeResolver(),s}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===M.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const r=e.target.toLowerCase(),s=this._methods[r];if(!s){this._logger.log(u.Warning,`No client method with the name '${r}' found.`),e.invocationId&&(this._logger.log(u.Warning,`No result given for '${r}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const n=s.slice(),o=!!e.invocationId;let i,a,l;for(const h of n)try{const d=i;i=await h.apply(this,e.arguments),o&&i&&d&&(this._logger.log(u.Error,`Multiple results provided for '${r}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(u.Error,`A callback for the method '${r}' threw error '${d}'.`)}l?await this._sendWithProtocol(l):o?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?l=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(u.Warning,`No result given for '${r}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(l)):i&&this._logger.log(u.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(u.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Se("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===M.Disconnecting?this._completeClose(e):this._connectionState===M.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===M.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=M.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),N.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[e]))}catch(r){this._logger.log(u.Error,`An onclose callback called with error '${e}' threw error '${r}'.`)}}}async _reconnect(e){const r=Date.now();let s=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(s++,0,n);if(o===null){this._logger.log(u.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=M.Reconnecting,e?this._logger.log(u.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(u.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(u.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==M.Reconnecting){this._logger.log(u.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(u.Information,`Reconnect attempt number ${s} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==M.Reconnecting){this._logger.log(u.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=M.Connected,this._logger.log(u.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(u.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(u.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==M.Reconnecting){this._logger.log(u.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===M.Disconnecting&&this._completeClose();return}n=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(s++,Date.now()-r,n)}}this._logger.log(u.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${s} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,r,s){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:e,retryReason:s})}catch(n){return this._logger.log(u.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${r}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const r=this._callbacks;this._callbacks={},Object.keys(r).forEach(s=>{const n=r[s];try{n(null,e)}catch(o){this._logger.log(u.Error,`Stream 'error' callback called with '${e}' threw error: ${Gn(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,r,s,n){if(s)return n.length!==0?{target:e,arguments:r,streamIds:n,type:T.Invocation}:{target:e,arguments:r,type:T.Invocation};{const o=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:r,invocationId:o.toString(),streamIds:n,type:T.Invocation}:{target:e,arguments:r,invocationId:o.toString(),type:T.Invocation}}}_launchStreams(e,r){if(e.length!==0){r||(r=Promise.resolve());for(const s in e)e[s].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(s)))},error:n=>{let o;n instanceof Error?o=n.message:n&&n.toString?o=n.toString():o="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(s,o)))},next:n=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(s,n)))}})}}_replaceStreamingParams(e){const r=[],s=[];for(let n=0;n<e.length;n++){const o=e[n];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,r[i]=o,s.push(i.toString()),e.splice(n,1)}}return[r,s]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,r,s){const n=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:r,invocationId:n.toString(),streamIds:s,type:T.StreamInvocation}:{target:e,arguments:r,invocationId:n.toString(),type:T.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:T.CancelInvocation}}_createStreamItemMessage(e,r){return{invocationId:e,item:r,type:T.StreamItem}}_createCompletionMessage(e,r,s){return r?{error:r,invocationId:e,type:T.Completion}:{invocationId:e,result:s,type:T.Completion}}_createCloseMessage(){return{type:T.Close}}}const hd=[0,2e3,1e4,3e4,null];class Ko{constructor(e){this._retryDelays=e!==void 0?[...e,null]:hd}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class ct{}ct.Authorization="Authorization",ct.Cookie="Cookie";class dd extends Lr{constructor(e,r){super(),this._innerClient=e,this._accessTokenFactory=r}async send(e){let r=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const s=await this._innerClient.send(e);return r&&s.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):s}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[ct.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[ct.Authorization]&&delete e.headers[ct.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var V;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(V||(V={}));var Q;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(Q||(Q={}));let ud=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Yo{get pollAborted(){return this._pollAbort.aborted}constructor(e,r,s){this._httpClient=e,this._logger=r,this._pollAbort=new ud,this._options=s,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,r){if(W.isRequired(e,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,Q,"transferFormat"),this._url=e,this._logger.log(u.Trace,"(LongPolling transport) Connecting."),r===Q.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[s,n]=Et(),o={[s]:n,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};r===Q.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(u.Trace,`(LongPolling transport) polling: ${a}.`);const l=await this._httpClient.get(a,i);l.statusCode!==200?(this._logger.log(u.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new at(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,r){try{for(;this._running;)try{const s=`${e}&_=${Date.now()}`;this._logger.log(u.Trace,`(LongPolling transport) polling: ${s}.`);const n=await this._httpClient.get(s,r);n.statusCode===204?(this._logger.log(u.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(u.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new at(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(u.Trace,`(LongPolling transport) data received. ${or(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(u.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(s){this._running?s instanceof Vn?this._logger.log(u.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=s,this._running=!1):this._logger.log(u.Trace,`(LongPolling transport) Poll errored after shutdown: ${s.message}`)}}finally{this._logger.log(u.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Vo(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(u.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(u.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[r,s]=Et();e[r]=s;const n={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,n)}catch(i){o=i}o?o instanceof at&&(o.statusCode===404?this._logger.log(u.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(u.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(u.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(u.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(u.Trace,e),this.onclose(this._closeError)}}}class pd{constructor(e,r,s,n){this._httpClient=e,this._accessToken=r,this._logger=s,this._options=n,this.onreceive=null,this.onclose=null}async connect(e,r){return W.isRequired(e,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,Q,"transferFormat"),this._logger.log(u.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((s,n)=>{let o=!1;if(r!==Q.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(N.isBrowser||N.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),l={};l.Cookie=a;const[h,d]=Et();l[h]=d,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...l,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(u.Trace,`(SSE transport) data received. ${or(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},i.onerror=a=>{o?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(u.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,s()}}catch(a){n(a);return}})}async send(e){return this._eventSource?Vo(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class gd{constructor(e,r,s,n,o,i){this._logger=s,this._accessTokenFactory=r,this._logMessageContent=n,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,r){W.isRequired(e,"url"),W.isRequired(r,"transferFormat"),W.isIn(r,Q,"transferFormat"),this._logger.log(u.Trace,"(WebSockets transport) Connecting.");let s;return this._accessTokenFactory&&(s=await this._accessTokenFactory()),new Promise((n,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let l=!1;if(N.isNode||N.isReactNative){const h={},[d,p]=Et();h[d]=p,s&&(h[ct.Authorization]=`Bearer ${s}`),a&&(h[ct.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...h,...this._headers}})}else s&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(s)}`);i||(i=new this._webSocketConstructor(e)),r===Q.Binary&&(i.binaryType="arraybuffer"),i.onopen=h=>{this._logger.log(u.Information,`WebSocket connected to ${e}.`),this._webSocket=i,l=!0,n()},i.onerror=h=>{let d=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?d=h.error:d="There was an error with the transport",this._logger.log(u.Information,`(WebSockets transport) ${d}.`)},i.onmessage=h=>{if(this._logger.log(u.Trace,`(WebSockets transport) data received. ${or(h.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(h.data)}catch(d){this._close(d);return}},i.onclose=h=>{if(l)this._close(h);else{let d=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?d=h.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(d))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(u.Trace,`(WebSockets transport) sending data. ${or(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(u.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const Zo=100;class fd{constructor(e,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,W.isRequired(e,"url"),this._logger=Gh(r.logger),this.baseUrl=this._resolveUrl(e),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let s=null,n=null;if(N.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;s=o("ws"),n=o("eventsource")}!N.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:N.isNode&&!r.WebSocket&&s&&(r.WebSocket=s),!N.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:N.isNode&&!r.EventSource&&typeof n<"u"&&(r.EventSource=n),this._httpClient=new dd(r.httpClient||new rd(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Q.Binary,W.isIn(e,Q,"transferFormat"),this._logger.log(u.Debug,`Starting connection with transfer format '${Q[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(u.Error,r),await this._stopPromise,Promise.reject(new Se(r))}else if(this._connectionState!=="Connected"){const r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(u.Error,r),Promise.reject(new Se(r))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Yn(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(u.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(u.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(u.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(u.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===V.WebSockets)this.transport=this._constructTransport(V.WebSockets),await this._startTransport(r,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let s=null,n=0;do{if(s=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Se("The connection was stopped during negotiation.");if(s.error)throw new Error(s.error);if(s.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(s.url&&(r=s.url),s.accessToken){const o=s.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}n++}while(s.url&&n<Zo);if(n===Zo&&s.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,s,e)}this.transport instanceof Yo&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(u.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(s){return this._logger.log(u.Error,"Failed to start the connection: "+s),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(s)}}async _getNegotiationResponse(e){const r={},[s,n]=Et();r[s]=n;const o=this._resolveNegotiateUrl(e);this._logger.log(u.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new jo("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof at&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(u.Error,a),Promise.reject(new jo(a))}}_createConnectUrl(e,r){return r?e+(e.indexOf("?")===-1?"?":"&")+`id=${r}`:e}async _createTransport(e,r,s,n){let o=this._createConnectUrl(e,s.connectionToken);if(this._isITransport(r)){this._logger.log(u.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(o,n),this.connectionId=s.connectionId;return}const i=[],a=s.availableTransports||[];let l=s;for(const h of a){const d=this._resolveTransportOrError(h,r,n,l?.useStatefulReconnect===!0);if(d instanceof Error)i.push(`${h.transport} failed:`),i.push(d);else if(this._isITransport(d)){if(this.transport=d,!l){try{l=await this._getNegotiationResponse(e)}catch(p){return Promise.reject(p)}o=this._createConnectUrl(e,l.connectionToken)}try{await this._startTransport(o,n),this.connectionId=l.connectionId;return}catch(p){if(this._logger.log(u.Error,`Failed to start the transport '${h.transport}': ${p}`),l=void 0,i.push(new Wh(`${h.transport} failed: ${p}`,V[h.transport])),this._connectionState!=="Connecting"){const b="Failed to select transport before stop() was called.";return this._logger.log(u.Debug,b),Promise.reject(new Se(b))}}}}return i.length>0?Promise.reject(new jh(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case V.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new gd(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case V.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new pd(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case V.LongPolling:return new Yo(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async s=>{let n=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,r),await this.features.resend()}catch{n=!0}else{this._stopConnection(s);return}n&&this._stopConnection(s)}:this.transport.onclose=s=>this._stopConnection(s),this.transport.connect(e,r)}_resolveTransportOrError(e,r,s,n){const o=V[e.transport];if(o==null)return this._logger.log(u.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(md(r,o))if(e.transferFormats.map(a=>Q[a]).indexOf(s)>=0){if(o===V.WebSockets&&!this._options.WebSocket||o===V.ServerSentEvents&&!this._options.EventSource)return this._logger.log(u.Debug,`Skipping transport '${V[o]}' because it is not supported in your environment.'`),new Uh(`'${V[o]}' is not supported in your environment.`,o);this._logger.log(u.Debug,`Selecting transport '${V[o]}'.`);try{return this.features.reconnect=o===V.WebSockets?n:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(u.Debug,`Skipping transport '${V[o]}' because it does not support the requested transfer format '${Q[s]}'.`),new Error(`'${V[o]}' does not support ${Q[s]}.`);else return this._logger.log(u.Debug,`Skipping transport '${V[o]}' because it was disabled by the client.`),new Hh(`'${V[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(u.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(u.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(u.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(u.Error,`Connection disconnected with error '${e}'.`):this._logger.log(u.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(u.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(r){this._logger.log(u.Error,`HttpConnection.onclose(${e}) threw error '${r}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!N.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const r=window.document.createElement("a");return r.href=e,this._logger.log(u.Information,`Normalizing '${e}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(e){const r=new URL(e);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";const s=new URLSearchParams(r.searchParams);return s.has("negotiateVersion")||s.append("negotiateVersion",this._negotiateVersion.toString()),s.has("useStatefulReconnect")?s.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&s.append("useStatefulReconnect","true"),r.search=s.toString(),r.toString()}}function md(t,e){return!t||(e&t)!==0}class Yn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new zr,this._transportResult=new zr,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new zr),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new zr;const e=this._transportResult;this._transportResult=void 0;const r=typeof this._buffer[0]=="string"?this._buffer.join(""):Yn._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),e.resolve()}catch(s){e.reject(s)}}}static _concatBuffers(e){const r=e.map(o=>o.byteLength).reduce((o,i)=>o+i),s=new Uint8Array(r);let n=0;for(const o of e)s.set(new Uint8Array(o),n),n+=o.byteLength;return s.buffer}}class zr{constructor(){this.promise=new Promise((e,r)=>[this._resolver,this._rejecter]=[e,r])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const bd="json";class wd{constructor(){this.name=bd,this.version=2,this.transferFormat=Q.Text}parseMessages(e,r){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];r===null&&(r=sr.instance);const s=pe.parse(e),n=[];for(const o of s){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case T.Invocation:this._isInvocationMessage(i);break;case T.StreamItem:this._isStreamItemMessage(i);break;case T.Completion:this._isCompletionMessage(i);break;case T.Ping:break;case T.Close:break;case T.Ack:this._isAckMessage(i);break;case T.Sequence:this._isSequenceMessage(i);break;default:r.log(u.Information,"Unknown message type '"+i.type+"' ignored.");continue}n.push(i)}return n}writeMessage(e){return pe.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,r){if(typeof e!="string"||e==="")throw new Error(r)}}const vd={trace:u.Trace,debug:u.Debug,info:u.Information,information:u.Information,warn:u.Warning,warning:u.Warning,error:u.Error,critical:u.Critical,none:u.None};function yd(t){const e=vd[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class kd{configureLogging(e){if(W.isRequired(e,"logging"),xd(e))this.logger=e;else if(typeof e=="string"){const r=yd(e);this.logger=new Nr(r)}else this.logger=new Nr(e);return this}withUrl(e,r){return W.isRequired(e,"url"),W.isNotEmpty(e,"url"),this.url=e,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(e){return W.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new Ko(e):this.reconnectPolicy=e:this.reconnectPolicy=new Ko,this}withServerTimeout(e){return W.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return W.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const r=new fd(this.url,e);return Kn.create(r,this.logger||sr.instance,this.protocol||new wd,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function xd(t){return t.log!==void 0}class _d{constructor(e){this.apiClient=e}async sendMessage(e,r){await this.apiClient.request(`/api/v1/conversations/${e}/support/messages`,{method:"POST",body:JSON.stringify({content:r}),headers:{"Content-Type":"application/json"}})}async sendTyping(e){await this.apiClient.request(`/api/v1/conversations/${e}/support/typing`,{method:"POST"})}}class Sd{constructor(e,r,s){this.store=e,this.authProvider=r,this.supportService=s,this.typingTimeoutMs=1e4,this.operatorMsgIdByOp=new Map,this.typingTimeoutByOp=new Map}async start(e,r){this.connection&&await this.stop(),this.baseUrl=e,this.conversationId=r;const n=`${new URL(e).origin}/ws/support?conversationId=${r}`;this.connection=new kd().withUrl(n,{accessTokenFactory:()=>this.authProvider.getAccessToken()}).withAutomaticReconnect().configureLogging(u.Information).build(),this.connection.on("Typing",o=>this.onTyping(o)),this.connection.on("Text",o=>this.onText(o)),this.connection.on("Close",o=>this.onClose(o)),this.connection.onclose(o=>{console.error("Support Hub connection closed.",o),o&&this.onError(o),this.onSupportEnded()});try{await this.connection.start()}catch(o){console.error("Failed to connect to support hub:",o),this.onError(o)}}async stop(){await this.connection?.stop(),this.connection=void 0;for(const e of this.typingTimeoutByOp.values())clearTimeout(e);this.typingTimeoutByOp.clear(),this.operatorMsgIdByOp.clear()}async sendMessage(e){if(this.conversationId){this.store.dispatch(Ye(Ho(e)));try{await this.supportService.sendMessage(this.conversationId,e)}catch(r){console.error("Failed to send message via REST:",r),this.onError(r)}}}async sendTyping(){if(this.conversationId)try{await this.supportService.sendTyping(this.conversationId)}catch(e){console.error("Failed to send typing via REST:",e),this.onError(e)}}resolveUrl(e){return!e||!this.baseUrl||/^https?:\/\//i.test(e)?e:e.startsWith("/")?`${this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl}${e}`:e}onError(e){this.store.dispatch(Ze(Wt(new Xs("Support connection error",e))))}clearTyping(e){const r=this.typingTimeoutByOp.get(e);r&&clearTimeout(r),this.typingTimeoutByOp.delete(e)}scheduleTypingRemoval(e){this.clearTyping(e);const r=window.setTimeout(()=>{const s=this.operatorMsgIdByOp.get(e);s&&this.store.dispatch(fl(s)),this.operatorMsgIdByOp.delete(e),this.typingTimeoutByOp.delete(e)},this.typingTimeoutMs);this.typingTimeoutByOp.set(e,r)}async onTyping(e){const r=e.operator;if(!r)return;const s={...r,pictureUrl:this.resolveUrl(r.pictureUrl)};if(this.operatorMsgIdByOp.has(r.id))this.store.dispatch(Ne(this.operatorMsgIdByOp.get(r.id),{isTyping:!0}));else{const n=crypto.randomUUID();this.operatorMsgIdByOp.set(r.id,n),this.store.dispatch(Ye(Wo(s,"...",{idGen:()=>n,isTyping:!0})))}this.scheduleTypingRemoval(r.id)}async onText(e){const r=e.operator;if(!r)return;const s={...r,pictureUrl:this.resolveUrl(r.pictureUrl)};this.clearTyping(r.id);const n=this.operatorMsgIdByOp.get(r.id);n?(this.store.dispatch(Ne(n,{content:e.content,isTyping:!1,status:"completed"})),this.operatorMsgIdByOp.delete(r.id)):this.store.dispatch(Ye(Wo(s,e.content,{status:"completed"})))}async onClose(e){this.stop()}onSupportEnded(){const e=Nh();this.store.dispatch(Ye(e)),this.store.dispatch(Ht(e.messageId)),this.store.dispatch(pn("assistant"))}}const Td={version:"4.0.0"};class Ed{constructor(){this.headerName="Authorization"}headerValue(e){return`Bearer ${e}`}}class Cd{constructor(){this.headerName="VSN-Assistant-Visitor"}headerValue(e){return e}}function Ad(t){return t.getName()==="visma"?new Ed:new Cd}class Id{constructor(e,r){this.authProvider=e,this.version=Td.version,this._baseUrl=r}set baseUrl(e){this._baseUrl=e}async request(e,r={}){const s=async()=>this.sendRequestOnce(e,r),n=await s();return n.status!==401?(await Fo(n),n):this.handleAuthRetry(s)}async handleAuthRetry(e){this.authProvider.clear();const r=await e();if(r.status===401)throw new xt("Unauthorized",r.status,r.url);return await Fo(r),r}async sendRequestOnce(e,r={}){try{const s=await this.authProvider.getAccessToken(),n=Ad(this.authProvider.getStrategy()),o=this.composeHeaders(r.headers,n,s);return await fetch(this.formatUrl(e),{...r,headers:o})}catch(s){throw s instanceof me?s:new xt("Network error",0,this.formatUrl(e),s)}}composeHeaders(e,r,s){const n=new Headers(e);return n.set(r.headerName,r.headerValue(s??"")),n.set("App-Version",this.version),n.set("App-Origin",window.location.href||""),n}formatUrl(e){const r=String(e);return/^https?:\/\//i.test(r)?r:`${this._baseUrl}${r.startsWith("/")?"":"/"}${r}`}}class Rd{constructor(){this.key="gaia-chat:visitor-token"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}const Pd=y.css`
530
+ .app{background:var(--gaia-color-surface-primary);container:chat/inline-size;display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.closeable{border:1px solid var(--gaia-color-border-tertiary)}
531
+ `;class $d{constructor(e,r){this.onOffline=()=>{this.store.dispatch(Ze({code:"NETWORK",message:E("You're offline. Check your connection.",{id:"error-offline"}),retryable:!1,source:"ui"}))},this.onOnline=()=>{this.store.snapshot.ui.error?.code==="NETWORK"&&this.store.dispatch(Ze(null))},e.addController(this),this.store=r}hostConnected(){window.addEventListener("offline",this.onOffline),window.addEventListener("online",this.onOnline)}hostDisconnected(){window.removeEventListener("offline",this.onOffline),window.removeEventListener("online",this.onOnline)}}var Od=Object.defineProperty,Dd=Object.getOwnPropertyDescriptor,ee=(t,e,r,s)=>{for(var n=s>1?void 0:s?Dd(e,r):e,o=t.length-1,i;o>=0;o--)(i=t[o])&&(n=(s?i(e,r,n):i(n))||n);return s&&n&&Od(e,r,n),n};P.ChatApp=class extends U{constructor(){super(...arguments),this.baseUrl="https://api.assistant.stag.vsn.dev",this.profileId="default",this.authStrategy="visitor",this.closeable=!0,this.store=new _l,this.state=null,this.isConnectedToSupport=!1}connectedCallback(){super.connectedCallback(),no(so(this.lang||this.ownerDocument.documentElement.lang||"en")),this.langObserver=new MutationObserver(s=>{for(const n of s)if(n.type==="attributes"&&n.attributeName==="lang"){const o=this.lang||this.ownerDocument.documentElement.lang||"en";no(so(o)),this.requestUpdate()}}),this.langObserver.observe(this,{attributes:!0,attributeFilter:["lang"]}),new $d(this,this.store),this.strategyFactory=new Oi({storage:new Rd}),this.authProvider=new Ti,this.apiClient=new Id(this.authProvider,this.baseUrl);const e=new Oh(this.apiClient),r=new _d(this.apiClient);this.bootstrapEffect=new Ch(this.store,new Eh(this.apiClient)),this.streamEffect=new Bh(this.store,e),this.supportEffect=new Sd(this.store,this.authProvider,r),this.conversationEffect=new Dh(this.store,e),this.feedbackEffect=new Lh(this.store,new Mh(this.apiClient)),this.unsubscribe=this.store.subscribe(s=>{const n=this.state;if(this.state=s,this.isConnectedToSupport=s.session.channel==="support",this.isConnectedToSupport&&n?.session.channel!=="support"){const o=this.store.snapshot.session.conversationId;o?this.supportEffect?.start(this.baseUrl,o):console.error("Cannot connect to support: conversationId is null")}})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.supportEffect?.stop(),this.langObserver?.disconnect()}async handleAuthChanged(){this.store.dispatch(Ze(null)),this.store.dispatch(_r(!0));try{const e=this.authProvider.getIdentifier();if(this.authStrategy==="visma"&&!this.tokenProvider){console.warn("Waiting for tokenProvider to be set...");return}const r=this.strategyFactory.create(this.authStrategy,this.tokenProvider,this.baseUrl);await r.refresh(),this.authProvider.useStrategy(r);const s=this.authProvider.getIdentifier();e!==s&&(this.bootstrapEffect.clear(),e&&(this.conversationEffect.clear(),this.streamEffect.abortCurrentTask?.(),this.supportEffect.stop()),this.bootstrapEffect.initialize(),this.conversationEffect.getHistory())}finally{this.store.dispatch(_r(!1))}}willUpdate(e){super.willUpdate(e),(e.has("tokenProvider")||e.has("authStrategy")||e.has("baseUrl"))&&this.handleAuthChanged(),e.has("baseUrl")&&(this.apiClient.baseUrl=this.baseUrl)}render(){return y.html`
573
532
  <div
574
- class=${_e("@container/main grid h-full w-full [grid-template-rows:auto_1fr_auto] overflow-hidden [grid-template-areas:'header''content''footer']",{"border border-solid border-neutral-300 shadow-md":this.closeable})}
533
+ class=${Gr.classMap({app:!0,closeable:this.closeable})}
575
534
  >
576
- <gaia-chat-menu
577
- .hasEmptyMessages=${this.messages.length===0}
578
- class="[grid-area:header]"
579
- .disabled=${!this.state.session.isActive}
580
- .closeable=${this.closeable}
581
- @clear-conversation=${this.onClearConversation}
582
- @toggle-feedback-form=${this.onToggleFeedbackForm}
583
- @close-chat=${this.onCloseChat}
584
- ></gaia-chat-menu>
585
- <gaia-chat-message-list
586
- .messages=${this.messages}
587
- .isInitialized=${this.state.config.initialized}
588
- .isThinking=${this.state.session.isThinking}
589
- .feedbackFormOpen=${this.state.ui.feedbackFormOpen}
590
- .feedbackFormTarget=${this.state.ui.feedbackFormTarget}
591
- .error=${this.state.ui.error??null}
592
- .isConnectedToSupport=${this.isConnectedToSupport}
593
- .welcomeMessage=${this.welcomeMessages?.[Vl()]}
594
- @clear-conversation=${this.onClearConversation}
595
- @approve-tool-call=${this.onApproveToolCall}
596
- @decline-tool-call=${this.onDeclineToolCall}
597
- @submit-feedback=${this.onSubmitFeedback}
598
- @toggle-feedback-form=${this.onToggleFeedbackForm}
599
- @clear-error=${this.onClearError}
600
- @mark-seen=${this.onMarkSeen}
601
- class="overflow-hidden [grid-area:content]"
602
- ></gaia-chat-message-list>
603
- <gaia-chat-composer
604
- class="[grid-area:footer]"
605
- .disabled=${!this.state.session.isActive}
606
- .loading=${this.state.session.isBusy}
607
- .maxInputLength=${this.state.config.maxInputLength}
608
- @send-message=${this.onSendMessage}
609
- @send-typing=${this.onSendTyping}
610
- ></gaia-chat-composer>
535
+ <gaia-app-header .closeable=${this.closeable}></gaia-app-header>
536
+ <gaia-conversation></gaia-conversation>
537
+ <gaia-message-composer
538
+ profile-id=${this.profileId}
539
+ partner-id=${Kr.ifDefined(this.supportPartnerId)}
540
+ .hostContextProvider=${this.hostContextProvider}
541
+ ></gaia-message-composer>
611
542
  </div>
612
- `}},Q([w.property({type:String,attribute:"base-url"})],C.ChatApp.prototype,"baseUrl",2),Q([w.property({type:String,attribute:"profile-id"})],C.ChatApp.prototype,"profileId",2),Q([w.property({type:String,attribute:"support-partner-id"})],C.ChatApp.prototype,"supportPartnerId",2),Q([w.property({type:String,attribute:"visma-token",reflect:!1})],C.ChatApp.prototype,"vismaAccessToken",2),Q([w.property({type:Boolean,attribute:"is-visitor"})],C.ChatApp.prototype,"isVisitor",2),Q([w.property({type:Number,attribute:"token-expiring-lead-seconds"})],C.ChatApp.prototype,"tokenExpiringLeadSeconds",2),Q([w.property({type:Boolean,attribute:"closeable",reflect:!0,converter:r=>r==="true"||r===""})],C.ChatApp.prototype,"closeable",2),Q([w.state()],C.ChatApp.prototype,"state",2),Q([w.state()],C.ChatApp.prototype,"messages",2),Q([w.state()],C.ChatApp.prototype,"isConnectedToSupport",2),Q([w.state()],C.ChatApp.prototype,"welcomeMessages",2),C.ChatApp=Q([w.customElement("gaia-chat")],C.ChatApp);const Kl={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Brugte ${0} kilder`,"assistant-message-decline":"Nej","composer-error-character-limit":"Tegngrænsen er overskredet.","composer-placeholder":"Skriv dit spørgsmål her...","disclaimer-link":"her","disclaimer-text":"Svar genereres af AI og kan indeholde fejl, læs mere","error-auth-generic":"Autentificeringsfejl. Venligst autentificer igen.","error-forbidden":"Du har ikke adgang til denne handling.","error-network-error":"Netværksfejl. Tjek din forbindelse.","error-not-found":"Ikke fundet.","error-offline":"Du er offline. Tjek din forbindelse.","error-profile-not-found":"Kunne ikke indlæse den aktuelle profil. Bruger du den rigtige profil?","error-rate-limit":"For mange forespørgsler. Vær venlig at sænke farten.","error-request-canceled":"Forespørgsel annulleret.","error-server-error":"Serveren havde et problem. Prøv venligst igen.","error-session-expired":"Din session er udløbet. Log venligst ind igen.","error-something-went-wrong":"Der gik noget galt.","error-sse-error":"Live-svarstrømmen blev afbrudt. Prøv igen.","error-token-expired":"Din adgangstoken er udløbet.","error-token-invalid":"Din adgangstoken er ugyldig.","error-token-required":"Du skal angive en adgangstoken for at fortsætte.","error-unexpected-error":"Uventet fejl. Prøv venligst igen.","error-ws-error":"Fejl i livechatforbindelsen. At genoprette forbindelsen kan hjælpe.","feedback-form-cancel":"Annuller","feedback-form-comment-placeholder":"Skriv din kommentar her","feedback-form-comments-title":"Nogle yderligere kommentarer?","feedback-form-description":"Del venligst dine tanker og forslag for at hjælpe os med at blive bedre.","feedback-form-satisfaction-title--assistant":"Hvor tilfreds er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor tilfreds er du med den hjælp, du fik?","feedback-form-submit":"Indsend feedback","feedback-form-title":"Feedback","system-message-provide-feedback":"Giv feedback","system-message-start-new-conversation":"Start ny samtale","system-message-support-completed":"Du er blevet afbrudt fra supportmedarbejderen.","system-message-support-feedback":"For at fortsætte, start venligst en ny samtale. Vi vil også gerne høre din feedback om vores supportoplevelse!","system-message-support-started":"Du er blevet forbundet med en menneskelig supportmedarbejder.","thinking-indicator-text":"Tænker..."},Jl=Object.freeze(Object.defineProperty({__proto__:null,templates:Kl},Symbol.toStringTag,{value:"Module"})),Ql={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Brukte ${0} kilder`,"assistant-message-decline":"Nei","composer-error-character-limit":"Karakterbegrensning overskredet.","composer-placeholder":"Skriv inn spørsmålet ditt her...","disclaimer-link":"her","disclaimer-text":"Svar er generert av AI og kan inneholde feil, les mer","error-auth-generic":"Autentiseringsfeil. Vennligst autentiser igjen.","error-forbidden":"Du har ikke tilgang til denne handlingen.","error-network-error":"Nettverksfeil. Sjekk tilkoblingen.","error-not-found":"Ikke funnet.","error-offline":"Du er frakoblet. Sjekk tilkoblingen din.","error-profile-not-found":"Kunne ikke laste inn nåværende profil. Bruker du riktig profil?","error-rate-limit":"For mange forespørsler. Vennligst sakt ned.","error-request-canceled":"Forespørsel avbrutt.","error-server-error":"Serverproblemer. Vennligst prøv igjen.","error-session-expired":"Din sesjon har utløpt. Vennligst logg inn igjen.","error-something-went-wrong":"Noe gikk galt.","error-sse-error":"Live responsestream avbrutt. Prøv igjen.","error-token-expired":"Din tilgangsnøkkel har utløpt.","error-token-invalid":"Din tilgangsnøkkel er ugyldig.","error-token-required":"Du må ha en tilgangsnøkkel for å fortsette.","error-unexpected-error":"Uventet feil. Vennligst prøv igjen.","error-ws-error":"Live chatsesjon feil. Det kan hjelpe å prøve igjen.","feedback-form-cancel":"Avbryt","feedback-form-comment-placeholder":"Skriv inn tilbakemeldingen her","feedback-form-comments-title":"Eventuelle tilbakemeldinger?","feedback-form-description":"Vennligst del dine tanker og forslag for å hjelpe oss å forbedre.","feedback-form-satisfaction-title--assistant":"Hvor fornøyd er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor fornøyd er du med hjelpen du fikk?","feedback-form-submit":"Send tilbakemelding","feedback-form-title":"Feedback","system-message-provide-feedback":"Gi tilbakemelding","system-message-start-new-conversation":"Start ny samtale","system-message-support-completed":"Du har blitt frakoblet fra den menneskelige support agenten.","system-message-support-feedback":"For å fortsette, vennligst start en ny samtale. Vi vil også gjerne høre din tilbakemelding på vår supportopplevelse!","system-message-support-started":"Du har blitt koblet til en menneskelig support agent.","thinking-indicator-text":"Tenker..."},ec=Object.freeze(Object.defineProperty({__proto__:null,templates:Ql},Symbol.toStringTag,{value:"Module"})),tc={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Använde ${0} källor`,"assistant-message-decline":"Nej","composer-error-character-limit":"Teckenbegränsningen har överskridits.","composer-placeholder":"Skriv din fråga här...","disclaimer-link":"här","disclaimer-text":"Svar genereras av AI och kan innehålla fel, läs mer","error-auth-generic":"Autentiseringsfel. Vänligen autentisera igen.","error-forbidden":"Du har inte behörighet till denna åtgärd.","error-network-error":"Nätverksfel. Kontrollera din anslutning.","error-not-found":"Hittades inte.","error-offline":"Du är offline. Kontrollera din anslutning.","error-profile-not-found":"Kunde inte ladda den aktuella profilen. Använder du rätt profil?","error-rate-limit":"För många förfrågningar. Vänligen sakta ner.","error-request-canceled":"Förfrågan avbröts.","error-server-error":"Servern hade ett problem. Vänligen försök igen.","error-session-expired":"Din session har löpt ut. Vänligen logga in igen.","error-something-went-wrong":"Något gick fel.","error-sse-error":"Live-svarströmmen avbröts. Försök igen.","error-token-expired":"Din åtkomsttoken har löpt ut.","error-token-invalid":"Din åtkomsttoken är ogiltig.","error-token-required":"Du måste ange en åtkomsttoken för att fortsätta.","error-unexpected-error":"Oväntat fel. Vänligen försök igen.","error-ws-error":"Fel vid livechattanslutning. Att återansluta kan hjälpa.","feedback-form-cancel":"Avbryt","feedback-form-comment-placeholder":"Skriv din kommentar här","feedback-form-comments-title":"Några ytterligare kommentarer?","feedback-form-description":"Dela gärna dina tankar och förslag för att hjälpa oss att bli bättre.","feedback-form-satisfaction-title--assistant":"Hur nöjd är du med assistenten?","feedback-form-satisfaction-title--support":"Hur nöjd är du med hjälpen du fick?","feedback-form-submit":"Skicka feedback","feedback-form-title":"Feedback","system-message-provide-feedback":"Lämna feedback","system-message-start-new-conversation":"Starta ny konversation","system-message-support-completed":"Du har blivit frånkopplad från supportagenten.","system-message-support-feedback":"För att fortsätta, vänligen starta en ny konversation. Vi vill också gärna höra din feedback om vår supportupplevelse!","system-message-support-started":"Du har blivit ansluten till en mänsklig supportagent.","thinking-indicator-text":"Tänker..."},rc=Object.freeze(Object.defineProperty({__proto__:null,templates:tc},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
613
- //# sourceMappingURL=index.umd.js.map
543
+ `}},P.ChatApp.styles=[Pd],ee([f.property({type:String,attribute:"base-url"})],P.ChatApp.prototype,"baseUrl",2),ee([f.property({type:String,attribute:"profile-id"})],P.ChatApp.prototype,"profileId",2),ee([f.property({type:String,attribute:"support-partner-id"})],P.ChatApp.prototype,"supportPartnerId",2),ee([f.property({attribute:!1})],P.ChatApp.prototype,"tokenProvider",2),ee([f.property({attribute:!1})],P.ChatApp.prototype,"hostContextProvider",2),ee([f.property({attribute:"auth-strategy"})],P.ChatApp.prototype,"authStrategy",2),ee([f.property({type:Boolean,attribute:"closeable",reflect:!0,converter:t=>t==="true"||t===""})],P.ChatApp.prototype,"closeable",2),ee([gt({context:kt})],P.ChatApp.prototype,"store",2),ee([gt({context:il})],P.ChatApp.prototype,"bootstrapEffect",2),ee([gt({context:dn})],P.ChatApp.prototype,"streamEffect",2),ee([gt({context:xr})],P.ChatApp.prototype,"supportEffect",2),ee([gt({context:un})],P.ChatApp.prototype,"conversationEffect",2),ee([gt({context:qs})],P.ChatApp.prototype,"feedbackEffect",2),ee([f.state()],P.ChatApp.prototype,"state",2),ee([f.state()],P.ChatApp.prototype,"isConnectedToSupport",2),P.ChatApp=ee([f.customElement("gaia-chat")],P.ChatApp);const Md={"assistant-message-approve":"Ja","assistant-message-decline":"Nej","composer-error-character-limit":"Tegngrænsen er overskredet.","composer-placeholder":"Skriv dit spørgsmål her...","disclaimer-link":"her","disclaimer-text":"Svar genereres af AI og kan indeholde fejl, læs mere","error-auth-generic":"Autentificeringsfejl. Venligst autentificer igen.","error-forbidden":"Du har ikke adgang til denne handling.","error-network-error":"Netværksfejl. Tjek din forbindelse.","error-not-found":"Ikke fundet.","error-offline":"Du er offline. Tjek din forbindelse.","error-profile-not-found":"Kunne ikke indlæse den aktuelle profil. Bruger du den rigtige profil?","error-rate-limit":"For mange forespørgsler. Vær venlig at sænke farten.","error-request-canceled":"Forespørgsel annulleret.","error-server-error":"Serveren havde et problem. Prøv venligst igen.","error-session-expired":"Din session er udløbet. Log venligst ind igen.","error-something-went-wrong":"Der gik noget galt.","error-sse-error":"Live-svarstrømmen blev afbrudt. Prøv igen.","error-token-expired":"Din adgangstoken er udløbet.","error-token-invalid":"Din adgangstoken er ugyldig.","error-unexpected-error":"Uventet fejl. Prøv venligst igen.","error-ws-error":"Fejl i livechatforbindelsen. At genoprette forbindelsen kan hjælpe.","feedback-form-comment-placeholder":"Skriv din kommentar her","feedback-form-comments-title":"Nogle yderligere kommentarer?","feedback-form-description":"Del venligst dine tanker og forslag for at hjælpe os med at blive bedre.","feedback-form-rating-hint":"Meget utilfreds → Meget tilfreds","feedback-form-reset":"Nulstil","feedback-form-satisfaction-title--assistant":"Hvor tilfreds er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor tilfreds er du med den hjælp, du fik?","feedback-form-submit":"Indsend","feedback-form-title":"Feedback","source-list-found-sources":ft`Fandt ${0} kilder`,"system-message-provide-feedback":"Giv feedback","system-message-start-new-conversation":"Ny samtale","system-message-support-completed":"Du er blevet afbrudt fra supportmedarbejderen.","system-message-support-feedback":"For at fortsætte, start venligst en ny samtale. Vi vil også gerne høre din feedback om vores supportoplevelse!","system-message-support-started":"Du er blevet forbundet med en menneskelig supportmedarbejder.","thinking-indicator-text":"Tænker...","tooltip-clear-conversation":"Ryd samtale","tooltip-minimize-chat":"Minimer chat","tooltip-open-feedback":"Åbn feedback"},Ld=Object.freeze(Object.defineProperty({__proto__:null,templates:Md},Symbol.toStringTag,{value:"Module"})),Nd={"assistant-message-approve":"Kyllä","assistant-message-decline":"Ei","composer-error-character-limit":"Merkkiraja ylitetty.","composer-placeholder":"Kirjoita kysymyksesi tähän...","disclaimer-link":"täältä","disclaimer-text":"Vastaukset ovat tekoälyn tuottamia ja voivat sisältää virheitä, lue lisää","error-auth-generic":"Tunnistautumisvirhe. Tunnistaudu uudelleen.","error-forbidden":"Sinulla ei ole oikeutta tähän toimintoon.","error-network-error":"Verkkoyhteysvirhe. Tarkista yhteytesi.","error-not-found":"Ei löytynyt.","error-offline":"Olet offline-tilassa. Tarkista yhteytesi.","error-profile-not-found":"Nykyisen profiilin lataus epäonnistui. Käytätkö oikeaa profiilia?","error-rate-limit":"Liian monta pyyntöä. Odota hetki.","error-request-canceled":"Pyyntö peruutettiin.","error-server-error":"Palvelimella ilmeni ongelma. Yritä uudelleen.","error-session-expired":"Istuntosi on vanhentunut. Kirjaudu uudelleen sisään.","error-something-went-wrong":"Jokin meni pieleen.","error-sse-error":"Reaaliaikainen vastausvirta keskeytyi. Yritä uudelleen.","error-token-expired":"Käyttöoikeutesi on vanhentunut.","error-token-invalid":"Käyttöoikeutesi on virheellinen.","error-unexpected-error":"Odottamaton virhe. Yritä uudelleen.","error-ws-error":"Reaaliaikaisen chatin yhteysvirhe. Uudelleenyhdistäminen saattaa auttaa.","feedback-form-comment-placeholder":"Kirjoita kommenttisi tähän","feedback-form-comments-title":"Muita kommentteja?","feedback-form-description":"Jaa ajatuksesi ja ehdotuksesi, jotta voimme parantaa palvelua.","feedback-form-rating-hint":"Erittäin tyytymätön → Erittäin tyytyväinen","feedback-form-reset":"Tyhjennä","feedback-form-satisfaction-title--assistant":"Kuinka tyytyväinen olet avustajaan?","feedback-form-satisfaction-title--support":"Kuinka tyytyväinen olet saamaasi apuun?","feedback-form-submit":"Lähetä","feedback-form-title":"Palaute","source-list-found-sources":ft`Löytyi ${0} lähdettä`,"system-message-provide-feedback":"Anna palautetta","system-message-start-new-conversation":"Uusi keskustelu","system-message-support-completed":"Yhteys asiakaspalvelijaan katkaistiin.","system-message-support-feedback":"Aloita uusi keskustelu jatkaaksesi. Haluaisimme myös kuulla palautteesi asiakaspalvelusta!","system-message-support-started":"Sinut on yhdistetty asiakaspalvelijalle.","thinking-indicator-text":"Miettii...","tooltip-clear-conversation":"Tyhjennä keskustelu","tooltip-minimize-chat":"Pienennä keskustelu","tooltip-open-feedback":"Avoin palaute"},zd=Object.freeze(Object.defineProperty({__proto__:null,templates:Nd},Symbol.toStringTag,{value:"Module"})),Fd={"assistant-message-approve":"Ja","assistant-message-decline":"Nei","composer-error-character-limit":"Karakterbegrensning overskredet.","composer-placeholder":"Skriv inn spørsmålet ditt her...","disclaimer-link":"her","disclaimer-text":"Svar er generert av AI og kan inneholde feil, les mer","error-auth-generic":"Autentiseringsfeil. Vennligst autentiser igjen.","error-forbidden":"Du har ikke tilgang til denne handlingen.","error-network-error":"Nettverksfeil. Sjekk tilkoblingen.","error-not-found":"Ikke funnet.","error-offline":"Du er frakoblet. Sjekk tilkoblingen din.","error-profile-not-found":"Kunne ikke laste inn nåværende profil. Bruker du riktig profil?","error-rate-limit":"For mange forespørsler. Vennligst sakt ned.","error-request-canceled":"Forespørsel avbrutt.","error-server-error":"Serverproblemer. Vennligst prøv igjen.","error-session-expired":"Din sesjon har utløpt. Vennligst logg inn igjen.","error-something-went-wrong":"Noe gikk galt.","error-sse-error":"Live responsestream avbrutt. Prøv igjen.","error-token-expired":"Din tilgangsnøkkel har utløpt.","error-token-invalid":"Din tilgangsnøkkel er ugyldig.","error-unexpected-error":"Uventet feil. Vennligst prøv igjen.","error-ws-error":"Live chatsesjon feil. Det kan hjelpe å prøve igjen.","feedback-form-comment-placeholder":"Skriv inn tilbakemeldingen her","feedback-form-comments-title":"Eventuelle tilbakemeldinger?","feedback-form-description":"Vennligst del dine tanker og forslag for å hjelpe oss å forbedre.","feedback-form-rating-hint":"Veldig misfornøyd → Veldig fornøyd","feedback-form-reset":"Tilbakestill","feedback-form-satisfaction-title--assistant":"Hvor fornøyd er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor fornøyd er du med hjelpen du fikk?","feedback-form-submit":"Send","feedback-form-title":"Feedback","source-list-found-sources":ft`Fant ${0} kilder`,"system-message-provide-feedback":"Gi tilbakemelding","system-message-start-new-conversation":"Ny samtale","system-message-support-completed":"Du har blitt frakoblet fra den menneskelige support agenten.","system-message-support-feedback":"For å fortsette, vennligst start en ny samtale. Vi vil også gjerne høre din tilbakemelding på vår supportopplevelse!","system-message-support-started":"Du har blitt koblet til en menneskelig support agent.","thinking-indicator-text":"Tenker...","tooltip-clear-conversation":"Slett samtale","tooltip-minimize-chat":"Minimer chat","tooltip-open-feedback":"Åpne tilbakemeldingsskjema"},Bd=Object.freeze(Object.defineProperty({__proto__:null,templates:Fd},Symbol.toStringTag,{value:"Module"})),Ud={"assistant-message-approve":"Ja","assistant-message-decline":"Nee","composer-error-character-limit":"Tekenlimiet overschreden.","composer-placeholder":"Typ hier je vraag...","disclaimer-link":"hier","disclaimer-text":"Antwoorden worden gegenereerd door AI en kunnen fouten bevatten, lees meer","error-auth-generic":"Authenticatiefout. Authenticeer opnieuw.","error-forbidden":"Je hebt geen toegang tot deze actie.","error-network-error":"Netwerkfout. Controleer je verbinding.","error-not-found":"Niet gevonden.","error-offline":"Je bent offline. Controleer je verbinding.","error-profile-not-found":"Kon het huidige profiel niet laden. Gebruik je het juiste profiel?","error-rate-limit":"Te veel verzoeken. Doe het rustig aan.","error-request-canceled":"Verzoek geannuleerd.","error-server-error":"Er is een probleem met de server. Probeer het opnieuw.","error-session-expired":"Je sessie is verlopen. Log opnieuw in.","error-something-went-wrong":"Er is iets misgegaan.","error-sse-error":"Live-responsstroom onderbroken. Probeer het opnieuw.","error-token-expired":"Je toegangstoken is verlopen.","error-token-invalid":"Je toegangstoken is ongeldig.","error-unexpected-error":"Onverwachte fout. Probeer het opnieuw.","error-ws-error":"Verbindingsfout live chat. Opnieuw verbinden kan helpen.","feedback-form-comment-placeholder":"Voer hier je opmerking in","feedback-form-comments-title":"Nog andere opmerkingen?","feedback-form-description":"Deel je ideëen en suggesties om ons te helpen verbeteren.","feedback-form-rating-hint":"Zeer ontevreden → Zeer tevreden","feedback-form-reset":"Wissen","feedback-form-satisfaction-title--assistant":"Hoe tevreden ben je over de assistent?","feedback-form-satisfaction-title--support":"Hoe tevreden ben je over de ontvangen hulp?","feedback-form-submit":"Verzenden","feedback-form-title":"Feedback","source-list-found-sources":ft`${0} bronnen gevonden`,"system-message-provide-feedback":"Geef feedback","system-message-start-new-conversation":"Nieuw gesprek","system-message-support-completed":"De verbinding met de supportmedewerker is verbroken.","system-message-support-feedback":"Start een nieuw gesprek om door te gaan. We horen ook graag je feedback over onze support!","system-message-support-started":"Je bent doorverbonden met een supportmedewerker.","thinking-indicator-text":"Aan het denken...","tooltip-clear-conversation":"Gesprek wissen","tooltip-minimize-chat":"Chat minimaliseren","tooltip-open-feedback":"Feedback openen"},Hd=Object.freeze(Object.defineProperty({__proto__:null,templates:Ud},Symbol.toStringTag,{value:"Module"})),Wd={"assistant-message-approve":"Ja","assistant-message-decline":"Nej","composer-error-character-limit":"Teckenbegränsningen har överskridits.","composer-placeholder":"Skriv din fråga här...","disclaimer-link":"här","disclaimer-text":"Svar genereras av AI och kan innehålla fel, läs mer","error-auth-generic":"Autentiseringsfel. Vänligen autentisera igen.","error-forbidden":"Du har inte behörighet till denna åtgärd.","error-network-error":"Nätverksfel. Kontrollera din anslutning.","error-not-found":"Hittades inte.","error-offline":"Du är offline. Kontrollera din anslutning.","error-profile-not-found":"Kunde inte ladda den aktuella profilen. Använder du rätt profil?","error-rate-limit":"För många förfrågningar. Vänligen sakta ner.","error-request-canceled":"Förfrågan avbröts.","error-server-error":"Servern hade ett problem. Vänligen försök igen.","error-session-expired":"Din session har löpt ut. Vänligen logga in igen.","error-something-went-wrong":"Något gick fel.","error-sse-error":"Live-svarströmmen avbröts. Försök igen.","error-token-expired":"Din åtkomsttoken har löpt ut.","error-token-invalid":"Din åtkomsttoken är ogiltig.","error-unexpected-error":"Oväntat fel. Vänligen försök igen.","error-ws-error":"Fel vid livechattanslutning. Att återansluta kan hjälpa.","feedback-form-comment-placeholder":"Skriv din kommentar här","feedback-form-comments-title":"Några ytterligare kommentarer?","feedback-form-description":"Dela gärna dina tankar och förslag för att hjälpa oss att bli bättre.","feedback-form-rating-hint":"Mycket missnöjd → Mycket nöjd","feedback-form-reset":"Återställ","feedback-form-satisfaction-title--assistant":"Hur nöjd är du med assistenten?","feedback-form-satisfaction-title--support":"Hur nöjd är du med hjälpen du fick?","feedback-form-submit":"Skicka","feedback-form-title":"Feedback","source-list-found-sources":ft`Hittade ${0} källor`,"system-message-provide-feedback":"Lämna feedback","system-message-start-new-conversation":"Ny konversation","system-message-support-completed":"Du har blivit frånkopplad från supportagenten.","system-message-support-feedback":"För att fortsätta, vänligen starta en ny konversation. Vi vill också gärna höra din feedback om vår supportupplevelse!","system-message-support-started":"Du har blivit ansluten till en mänsklig supportagent.","thinking-indicator-text":"Tänker...","tooltip-clear-conversation":"Rensa konversation","tooltip-minimize-chat":"Minimera chatt","tooltip-open-feedback":"Öppna feedback"},jd=Object.freeze(Object.defineProperty({__proto__:null,templates:Wd},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));